Change rules based toolchain macOS conditions to Apple#614
Conversation
|
That's great ! |
bf20a1f to
2bfe8a4
Compare
2bfe8a4 to
638ca4b
Compare
638ca4b to
4e764a8
Compare
| label_flag( | ||
| name = "apple", | ||
| build_setting_default = ":default_apple", | ||
| visibility = ["//visibility:public"], |
There was a problem hiding this comment.
Sorry, didn't catch this on my first pass:
Does this need to be public? Considering it's a flag, anyone can set it to match their own canonical definition. I'd prefer this doesn't become load-bearing. If it does, we might want to bikeshed for a moment on naming:
@rules_cc//cc/constraint:apple
@rules_cc//cc/toolchains/constraint:apple
platform doesn't seem correct to me, since that's a very distinct thing.
There was a problem hiding this comment.
yea very good question. I think the downside of not making it public is that downstream toolchains cannot perfectly mirror what happens in the default cc_args that read this version. realistically that's minor, but it would cause very subtly issues for the few people who would ever need to change this.
it being load bearing is annoying because actual downstream users should use apple_support's definitions for this instead, I just don't want to try to add that circular dependency here.
it's also possible that the best solution is to move this into platforms_contrib (since it's unlikely platforms itself wants this)
There was a problem hiding this comment.
I suggest putting it in @rules_cc/cc/settings:apple_constraint if we're going to make this public. Centralizing the configuration flags makes for a better user experience, and is consistent with existing rules_* modules.
Other rulesets have varying naming patterns for centralized settings:
- https://github.com/bazel-contrib/rules_scala/blob/master/scala/settings/BUILD
- https://github.com/bazel-contrib/rules_go/blob/master/go/config/BUILD.bazel
- https://github.com/bazelbuild/rules_rust/blob/main/rust/settings/BUILD.bazel
- https://github.com/bazel-contrib/rules_python/blob/main/python/config_settings/BUILD.bazel
Then we should pursue putting the flag and base definition in platforms_contrib, and we can just swap the label_flag with an alias eventually.
@trybka this will be setting a precedent, so flagging the discussion.
There was a problem hiding this comment.
fine with me, moved it to the suggestion
5283593 to
f3b5225
Compare
This allows you to write a rules based toolchain that targets Apple platforms that aren't macOS. Fixes bazelbuild#370
f3b5225 to
e9e150a
Compare
This allows you to write a rules based toolchain that targets Apple
platforms that aren't macOS.
I made this overridable since there are other constraints in apple_support
that denote you're building for an apple platform. But those only matter
if you're building a non-standard platform.
Fixes #370