Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build settings from PackageSettings not work as expected #6266

Open
mo5tone opened this issue May 9, 2024 · 0 comments
Open

Build settings from PackageSettings not work as expected #6266

mo5tone opened this issue May 9, 2024 · 0 comments
Labels
type:bug Something isn't working

Comments

@mo5tone
Copy link
Contributor

mo5tone commented May 9, 2024

What happened?

I want to add some build setting for my local swift package through PackageSettings.

But I found baseSettings and targetSettings cannot work as expected. Check below Package.swift.

Some build settings are missing in generated project and some are overwritten.

Tuist/Package.swift
// swift-tools-version: 5.9
import PackageDescription

#if TUIST
    import ProjectDescription

    let packageSettings = PackageSettings(
        baseSettings: .settings(
            base: [
                "SWIFT_ACTIVE_COMPILATION_CONDITIONS": [
                    "$(inherited)",
                    "BASE_SETTINGS_A", // ❌ missing
                ],
                "OTHER_SWIFT_FLAGS": [
                    "$(inherited)",
                    "-D",
                    "BASE_SETTINGS_B", // ❌ missing
                ],
                "FOO": "FOO", // ✅ works as expected
            ]
        ),
        targetSettings: [
            "LocalPackageTarget": [
                "SWIFT_ACTIVE_COMPILATION_CONDITIONS": [
                    "$(inherited)",
                    "TARGET_SETTINGS_A", // 🤔 works, but SWIFT_PACKAGE is missing, have to add back manually
                ],
                "OTHER_SWIFT_FLAGS": [
                    "$(inherited)",
                    "-D",
                    "TARGET_SETTINGS_B", // ✅ works as expected
                ],
                "BAR": "BAR", // ✅ works as expected
            ],
        ]
    )
#endif

let package = Package(
    name: "Demo",
    dependencies: [
        .package(url: "https://github.com/Alamofire/Alamofire", from: "5.9.1"),
        .package(path: "LocalPackagePath"),
    ]
)

How do we reproduce it?

  1. mkdir tuist_issue_project && cd tuist_issue_project
  2. tuist init
  3. edit Tuist/Package.swift to the above code
  4. tuist install && tuist generate
  5. check the build settings from generated project

Error log

No error messages, just unexpected behaviors.

macOS version

13.6.6

Tuist version

4.11.0

Xcode version

15.2

@mo5tone mo5tone added the type:bug Something isn't working label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant