MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
518 stars 82 forks source link

Bug: Cache splits based on host platform #1094

Open thii opened 1 year ago

thii commented 1 year ago

Describe the bug

Given the following declaration:

[
    xcodeproj(
        name = "xcodeproj-{0}-{1}".format(build_mode, ios_simulator_cpus),
        build_mode = build_mode,
        ios_simulator_cpus = ios_simulator_cpus,
        ...
    )
    for build_mode in [
        "bazel",
        "xcode",
    ]
    for ios_simulator_cpus in [
        "sim_arm64",
        "x86_64",
    ]
]

Run this on an Intel-based Mac to populate to remote cache.

bazel run //:xcodeproj-bazel-sim_arm64 -- --build_output_groups all_targets

On an Apple silicon Mac, generate an Xcode project with:

bazel run //:xcodeproj-bazel-sim_arm64

Open it, build, and see a lot of cache misses.

(10:50:06) INFO: 2529 processes: 253 remote cache hit, 1132 internal, 1144 local.

Versions

brentleyjones commented 1 year ago

The reason there are missies is because the simulator cpus are different for all of the other platforms. And even though they aren't used, they are part of the transition and affect the Starlark hash.

For now can you set a value for all simulators instead of just iOS?

thii commented 1 year ago

It seems to work if I set a value for all simulators. Thanks.

(12:58:55) INFO: 2529 processes: 1380 remote cache hit, 1132 internal, 17 local.
brentleyjones commented 1 year ago

Awesome! I think --platforms might help us here in the future. I'll look into it more post-1.0.