-
Notifications
You must be signed in to change notification settings - Fork 276
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
Use platforms inside Apple rules transitions #2227
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
The Bazel crash in CI was fixed in bazelbuild/bazel@e3e2448
|
For the second problem on CI, I did some investigation, but I don't have a machine (Mac/C++toolchain/swiftc) where I could test it. It seems as a problem in transitions/flags used in the tests. (Same tests are passing internally, but I don't see where's the difference).
|
We can't take this. We can't assume what platforms the user has set. They might have different remote execution platform properties. Or other things. So we need to use platform mapping until proper multi-platform APIs are available for us to transition to. |
cc @katre |
This makes C++ toolchain selection work without using platform mapping for Apple rules. PiperOrigin-RevId: 561560820
would it be possible for this to work alongside platform_mappings? as in if the user wanted to use custom platforms their platform_mappings would take precedence over this? |
was this backported to 6.x? seems like otherwise we might not be able to take this? |
I'm not sure on that second issue but I suppose it's just something around us not being fully compatible with platforms. |
Hey @keith, this is a replacement for What can be helpful here is to define standard build in
I've made this change, because platform_mappings have sometimes weird behaviours. Mapping can be applied twice, to plaforms and back. So if the mapping is not bijective, you get flag changes that are hard to explain. Your platform_mapping is good, and can support C++ toolchains. (I'm planning to flip that on by default soon, and now I have the last fix, so that also rules_apple are not broken). |
hrm but I guess I assume if this was 1:1 to what we had before, that it wouldn't be failing here? we're not explicitly passing platforms or CPUs today, so that should continue to work I assume? |
This makes C++ toolchain selection work without using platform mapping for Apple rules. PiperOrigin-RevId: 561560820
4d1bce4
to
6e5dcdc
Compare
I spent quite some time investigating this, but haven't found a fix. Findings are: Simplest reproduction: The tests won't fail running one at a time. The conflict happens in Notice there are different ST hashes in the config. If you grep
Different orders of The cause seems more likely to be in Comparing google vs main branch, in rule_attrs.common_bundle_attrs(
+ deps_cfg = transition_support.apple_platform_split_transition,
), I couldn't locate how this difference happend or why. |
that diff fixes a bug that resources aren't affected by the expected transition rules_apple/apple/internal/rule_attrs.bzl Line 602 in 11471c5
you can remove that and it doesn't affect this issue. I tried removing
Now that I look at the specific test targets I think I'm not surprised by this, because it's building the same target with 2 different transitions. The default here: rules_apple/test/starlark_tests/ios_static_framework_tests.bzl Lines 57 to 59 in 11471c5
and forcing platforms here: rules_apple/test/starlark_tests/ios_static_framework_tests.bzl Lines 97 to 100 in 11471c5
|
If we can get CI passing, I have an idea on how to land a version of this PR that supports custom platforms as well. Also, this change is probably needed to unblock rules_apple at Bazel HEAD, right? |
No, it's not needed. We had Apple rules working with:
|
Okay, so strike that part of the need for it. Either way, once this is passing CI I plan to add a way to customize the platforms, so people can still use custom platforms without the platform mapping file. |
@keith Same as the other one, once this is green, we can merge. I'll get the customization change in after. |
@comius any idea how we could potentially work around this crash with bazel 6.x? |
I merged #2256 which hacks around 6.x and only applies this new behavior for 7.x, but I'd love to hear any workaround ideas to improve that and be able to drop platform_mappings for 6.x as well |
closing since i merged that other one, still open to bazel 6.x compat ideas though! |
This makes C++ toolchain selection work without using platform mapping for Apple rules.