Are there cases where the values of xcconfig cannot be overridden?

While configuring a project using Tuist 4.30 (It was happend in Tuist 4.26 also), I encountered instances where xcconfig values were overridden by Tuist. If a key in the build settings exists as a property of the target, I was able to resolve this by specifying the key value or using the settings’ excluding feature. However, for the TEST_HOST of the UnitTest target, I was unable to prevent the overriding by any means, even with defaultsSettings: .none.

Ultimately, I resolved this by adding code to the settings.

Furthermore, since it seems there are exceptional cases like this, I changed the approach to avoid using xcconfig and instead only add settings through code.

Are there cases where it is impossible to prevent such overriding?


let project = Project(
    name: "unittest",
    settings: .settings(configurations: [
        .debug(name: "TEST2", xcconfig: .relativeToRoot("test.xcconfig")) // TEST_HOST = "asdfasdf"
    ], defaultSettings: .none),
    targets: [
        .target(
            name: "unittest",
            destinations: .iOS,
            product: .app,
            bundleId: "io.tuist.unittest",
            infoPlist: .extendingDefault(
                with: [
                    "UILaunchScreen": [
                        "UIColorName": "",
                        "UIImageName": "",
                    ],
                ]
            ),
            sources: ["unittest/Sources/**"],
            resources: ["unittest/Resources/**"],
            dependencies: []
        ),
        .target(
            name: "unittestTests",
            destinations: .iOS,
            product: .unitTests,
            bundleId: "io.tuist.unittestTests",
            infoPlist: .default,
            sources: ["unittest/Tests/**"],
            resources: [],
            dependencies: [.target(name: "unittest")],
            settings: .settings(configurations: [
                .debug(name: "TEST", xcconfig: .relativeToRoot("test.xcconfig"))
            ], defaultSettings: .none)
        ),
    ]
)

Hey @gustn3965 :wave:

This is most likely a bug. We merge the Tuist-generated settings with your settings here. I believe instead of taking the new value ($1) that’s equal to Tuist’s value, we should respect the value set by you.

Would you mind opening a GitHub issue with a reproducible sample? Additionally, would you want to try and fix this yourself? Happy to help if needed!

I encountered instances where xcconfig values were overridden by Tuist. If a key in the build settings exists as a property of the target, I was able to resolve this by specifying the key value or using the settings’ excluding feature

Yes, this might be necessary in some cases because we don’t have access to .xcconfig values during generation, so we can’t decide whether to apply Tuist’s value or not.

1 Like