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

Bug: "Make" variable expansion in the env of test bundles does not work. #3056

Open
aaronsky opened this issue Jul 9, 2024 · 0 comments · May be fixed by #3088
Open

Bug: "Make" variable expansion in the env of test bundles does not work. #3056

aaronsky opened this issue Jul 9, 2024 · 0 comments · May be fixed by #3088
Labels
bug Something isn't working

Comments

@aaronsky
Copy link

aaronsky commented Jul 9, 2024

Description

"Make" variable expansion support was added to rules_apple in this commit and shipped with version 3.6.0. This allows for Starlark like this to work without requiring a --test_env in a bazelrc.

string_flag(
    name = "my_make_var",
    build_setting_default = "",
    make_variable = "MY_MAKE_VAR",
)

objc_library(
    name = "make_var_unit_test_lib",
    srcs = ["make_var_unit_test.m"],
)

ios_unit_test(
    name = "MakeVarUnitTest",
    deps = [":make_var_unit_test_lib"],
    env = {
        "MY_MAKE_VAR": "$(MY_MAKE_VAR)",
    },
    toolchains = [":my_make_var"],
)

This works well enough when building with Bazel's CLI. With Xcode, however, the scheme that is generated for this test produces the uninterpolated value for the env. Is this possible to support in the xcodeproj generator?

Reproduction steps

  1. Create a string_flag with a make_variable value
  2. Create a *_unit_test that takes the string_flag as one of its toolchains and expands the value in its env attr.
  3. Create an xcodeproj that takes the unit test as a top-level target.
  4. Generate the xcodeproj.

Expected behavior

Observe that the generated scheme has the literal $(MY_MAKE_VAR) (or whatever your make_variable was named), and not the interpolated value from bazelrc or even the default value.

rules_xcodeproj version

2.5.1

Xcode version

15F31d

Bazel version

7.2.1

rules_apple version

3.6.0

rules_swift version

2.0.0

Additional information

I am using incremental generation and automatic scheme generation.

@aaronsky aaronsky added the bug Something isn't working label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant