MobileNativeFoundation/rules_xcodeproj

SWIFT_ACTIVE_COMPILATION_CONDITIONS not being set in the generated project

alanpaivaa opened this issue · 3 comments

Hi, I'm not sure whether this is a bug or a setup issue on my end, but I am unable to set the SWIFT_ACTIVE_COMPILATION_CONDITIONS build setting in the generated project. For other configs, it seems to work, but it doesn't specifically for this one. This is what my BUILD file looks like:

ios_application(
    name = "App",
   ...
    xcconfig = {
        ...
        "SWIFT_ACTIVE_COMPILATION_CONDITIONS": ["SOME_CONDITION"]
    },
)

xcodeproj(
    name = "xcodeproj",
    build_mode = "bazel",
    generation_mode = "incremental",
    project_name = "ProjName",
    tags = ["manual"],
    top_level_targets = [
        top_level_target(
            ":App",
            target_environments = ["simulator", "device"]
        ),
    ],
    minimum_xcode_version = "16.0",
)

I don't see this config being set:
Captura de Tela 2024-07-25 às 09 17 18

I looked around in the examples and all, but I couldn't get this to work. Could anyone help?

Thanks in advance.

The generated project doesn't have it's build settings set, but all of the compiler flags are pass in via OTHER_SWIFT_FLAGS.

@brentleyjones The problem is that I need to do something like #if SOME_CONDITION, and that is not possible to do with OTHER_SWIFT_FLAGS. Do you know if I could achieve that by any other means?

The -D should be set correctly if it's set correctly in the Bazel build. rules_xcodeproj builds with bazel, nothing you set in Xcode will impact the actual build (though it might impact indexing).