-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Change default apple_platform_type to macOS #6366
Conversation
This change would have very broad ranging implications within Google. I believe there is a significant amount of cleanup that would need to be done before we could flip this switch, which is why we haven't done it yet. |
What other rules are affected by this? |
All the The reason for the iOS default is entirely historical (the first users of Apple support in Bazel were building iOS apps, and today it's still the case that that's the majority of our users), so it "made sense" at the time (in fact, iOS was the only supported target for a while). It's not so much the rules themselves that matter here, but all the implicit assumptions elsewhere that assume that a flagless build will target iOS that would break. |
I only touched I think it would be worthwhile to eventually unify the configuration distinguisher and the platform type, but that would require adding the "unspecified Apple" platform type. But since I don't actually know much about Apple rules, much less about how this change would affect Google-internal use cases, I'll defer to Sergio. |
Does this mean google internally is using this undocumented flag as well? It seems like we should either add a way for rules to specify this, or publicize this flag |
Yes, the flag is definitely used. It seems to be set on an ios config (in a bazelrc); if everyone is using that, changing the default would be safe. |
While it is set in the |
I assume there would be a problem there too where if you had a target that you built for macOS for tools, it would need to have that overridden (but maybe that's already happening so it would be ok) |
Any thoughts on how we can get to the point where you can build some targets like |
One thing that the bazel team could do is to copybara this change so that bazel by default is MACOS, while internally it's still IOS. Another thing would be to make it MACOS by default and add IOS as the default in bazelrc files. |
@aragos do you have any thoughts on the possible solutions here? |
ef76e0c
to
34029f4
Compare
I've updated the tests that were relying on the iOS default to pass |
@@ -41,12 +41,12 @@ public void testToolchainSelectionDefault() throws Exception { | |||
|
|||
assertThat(cppConfig.getRuleProvidingCcToolchainProvider().toString()) | |||
.isEqualTo("//tools/osx/crosstool:crosstool"); | |||
assertThat(cppConfig.getTransformedCpuFromOptions()).isEqualTo("ios_x86_64"); | |||
assertThat(cppConfig.getTransformedCpuFromOptions()).isEqualTo("darwin_x86_64"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only test I intentionally changed the behavior of, I believe that we want to now test the default is macOS (and therefore is this default arch)
Looks good to me in principle, I can take care of explicitly setting the Google-internal default so that this change doesn't cause any behavioral differences there. We should also test (and fix) any other downstream projects that may be affected, this can be done following this guide: https://github.com/bazelbuild/continuous-integration/blob/master/docs/downstream-testing.md. EDIT: I think this can only be done with owner privileges so I'll take care of this step as well once the tests (see below) are fixed. Finally there still appear to be some failing tests in Bazel's buildkite, please fix those as well. Once the two buildkite verifications are done I'll import the PR. |
Sounds good. Quick question @aragos should I follow those word for word and create a new branch with this same change, or can we trigger that build on this branch when we're ready? |
@keith I believe we'll need a fresh branch with this same change. Feel free to create it and run the downstream projects if you have the necessary permissions, otherwise let me know and I can help. |
Sounds good. I've emailed bazel_dev asking for the right permissions. If I don't get them by the time I'm ready I'll ask, thanks! |
When using rules for Apple platforms that aren't platform specific, such as `swift_binary`, the default of iOS doesn't make sense, instead we should default this to the current platform, which currently can only be macOS.
34029f4
to
f2fd7c9
Compare
Oh actually, the recommendation is to create that branch on the bazel repo itself, not my fork, which isn't something I can do without having push access to this repo. I've pushed a branch with the naming suggested in that doc to my fork master...keith:keith-test-feature-platform-default @aragos is this something you can mirror to the bazel repo so we can run the tests (we might want to wait until all other tests are green here first though) |
f2fd7c9
to
7a24b2d
Compare
Ok, it passed, so @aragos I guess we're good to start the others |
Great! I imported and pushed your changes to https://github.com/bazelbuild/bazel/tree/aragos-test-macos-default-platform and started a buildkite run with that at https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/735. This may take a while, let's see how it goes. |
Thanks! I don't have access yet but hopefully I'll get it soon.
…--
Keith Smiley
On Jan 8, 2019, at 12:18, aragos ***@***.***> wrote:
Great! I imported and pushed your changes to https://github.com/bazelbuild/bazel/tree/aragos-test-macos-default-platform and started a buildkite run with that at https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/735. This may take a while, let's see how it goes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Downstream tests have passed. I'm currently working on preserving the old default internally then I'll merge the PR. |
🎉 thanks a ton everyone! |
When using rules for Apple platforms that aren't platform specific, such
as
swift_binary
, the default of iOS doesn't make sense, instead weshould default this to the current platform, which currently can only be
macOS.
More details about this issue can be found here bazelbuild/rules_swift#51