-
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
Add visionOS support #18905
Add visionOS support #18905
Conversation
038c87a
to
7578c68
Compare
CI can't be green here until we update to include bazelbuild/platforms#71 |
b6fc6b2
to
47626a5
Compare
src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java
Show resolved
Hide resolved
Ok this is green! sounds like @nglevin is going to review |
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.
Overall looks good to me.
I have some feedback regarding where bits will go, and some concern about introducing a minimum OS version CLI flag for visionOS specifically when there's a shared attribute that we have an opportunity to adopt before it has users depending on it.
help = | ||
"Minimum compatible visionOS version for target simulators and devices. " | ||
+ "If unspecified, uses 'visionos_sdk_version'.") | ||
public DottedVersion.Option visionosMinimumOs; |
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.
Have you considered using the existing --minimum_os_version flag instead of establishing a new --visionos_minimum_os flag, here?
Context; the flag was established for Android Crosstool purposes, to be shared by Apple Crosstools. You can access it from Starlark via the cpp fragment.
Ideally every Apple platform should source from a shared flag instead of platform-specific --*_minimum_os-es since the Apple transitions set it based on rule-level attributes, the minimum_os_version is typically set from an Apple bundling rule, and as far as building a _library rule for a given SDK with support for a minimum OS version, there shouldn't be a need to separate that for iOS vs watchOS between a _library and its explicit deps.
There's quite a few folks around Bazel who support the effort, and it'd be easier to go straight for that as we introduce the new Apple platform rather than attempt to add a new --*_minimum_os command line option that we'd then have to try to rapidly depreciate.
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.
Definitely an option, the first I heard about the desire to not have these platform specific flags was from TVL after I submitted this so if you think we should avoid adding it here that's fine. I think as far as bazel users go there aren't many folks relying on this for building library rules (doing that for a specific platform is not easy given the intermediate state around migrating to platforms). Do you think we should commit and not add this flag?
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.
I think it'd be best to avoid adding this flag in this PR, absolutely.
At least that would keep the scope of changes smaller, until a better solution for sourcing the minimum OS version for visionOS is available.
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.
I looked into removing this and it's not super straight-forward. The current issue is that the CppOptions / CppConfiguration depend on the AppleConfiguration, which is where we compute the minimum OS and we would need to reference CppOptions.minimumOsVersion. Unless we want to move the Apple specific logic / flags from that into the CppConfiguration, which I don't think we would? Although we have done that for some other flags like --apple_generate_dsym
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.
We spoke about this in another shared channel. I see the issue, and I've relayed it to folks who own those options.
As agreed, we shouldn't do anything about that in this PR, but it would also be best not to introduce a --visionos_minimum_os
flag in this PR.
For now, in the absence of any versions of visionOS to support besides "1.0" until shipping products come sometime next year, we'll stub this out and I'll look into addressing --minimum_os_version
as the source of truth for visionOS builds in follow up work for myself.
src/main/java/com/google/devtools/build/lib/rules/objc/MultiArchBinarySupport.java
Outdated
Show resolved
Hide resolved
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 for J2ObjC, correct? Just making sure I understand the existing client usage.
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.
I think this one is on its way out but it's still used here as well
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/objc/BazelObjcLibraryRule.java
Lines 27 to 32 in 896b358
@Override | |
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { | |
return builder | |
.cfg(AppleCrosstoolTransition.APPLE_CROSSTOOL_TRANSITION) | |
.build(); | |
} |
src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java
Outdated
Show resolved
Hide resolved
Added two more comments as I was really looking up and down to see what the other CLI options were being used for these days... some of which might just be historical inertia. If there's an odd dependency of Bazel Apple crosstool or a similar service that needs it, that may be alright for now. |
ada9410
to
94e5052
Compare
d67ae1c
to
b773227
Compare
This broke downstream builds: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/3225#0189d812-974f-43a7-8c36-2b8ee3698598 |
All of those downstream projects should update to the platforms repo at 0.0.7 , as the change @ bazelbuild/platforms#71 was rolled in to that release. Is there a common process for that? Or are all downstream builds expected to manually update to the latest platforms repo independently? |
Downstream projects we track are on BuildKite are expected to update themselves, cc @meteorcloudy |
It feels like we could do better on this sort of problem in a few ways.
To summarize the core issue:
- the built in apple rules in Bazel reference a label
***@***.***//os:visionos"
- this creates an implicit dependency that the *user* is using platforms at
at least 0.0.7
- rules_apple can depend on the appropriate platforms release, so it can
mask the problem
Just throwing out some ideas...
- Allow the LHS of a select() entry to be non-existent. The big downside
is that typos never get caught
- We could have a place in bazel, post workspace construction, where
modules can check repositories for various properties (like version). They
could fail out if various constraints were not met. This would still fail
the build, but the reason would be clearer.
- src/main/starlark/builtins_bzl/common/cc/cc_test.bzl could be
rewritten to only depend on visionos if the label exists.
|
This cherry picks bazelbuild#18905 and bazelbuild#19133
6.x cherry pick #19436 |
This cherry picks bazelbuild#18905 and bazelbuild#19133
This cherry picks bazelbuild#18905 and bazelbuild#19133
The changes in this PR have been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
No description provided.