Gracefully filter targets not compatible with the current Platform
See original GitHub issueThere was a discussion recently on bazel-discuss about selectively building targets based on a platform: https://groups.google.com/forum/#!topic/bazel-discuss/U6sFbPWiXGM
Greg Estren suggested:
Ultimately we should integrate this with Bazel’s upcoming platform semantics (which builds on the concepts above) to provide as much granularity and flexibility as you want.
This is a request to do exactly that. I’d like to be able to say “build for this platform, but gracefully exclude targets that aren’t compatible” (where gracefully means not failing the build). Perhaps a --filter_unsupported_platforms
flag? This would let a CI script do something conceptually like for platform in [list of supported platforms]; bazel build --platform=$platform --filter_unsupported_platforms //...; done
, while maintaining targets in the repository that aren’t compatible with all platforms.
A suggested alternative in that thread is to use --build_tag_filters
/--test_tag_filters
. I’ve found this to be clunky because those flags don’t accumulate when passed multiple times - if you have configurations in tools/bazel.rc that set these flags, you can’t subsequently add another copy of --{build/test}_tag_filters on the command-line, or the value from bazel.rc will be overwritten.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:38 (21 by maintainers)
Just a quick update: @philsc is working on implementation now!
I’ve had a few detailed email conversations with @katre about this, to the point where I’m interested in speccing up a brainstorm proposal of what it might look like.
With Bazel’s platform integration steadily humming along, now may be a good time to follow through on this. If there’s still interest. There are still some unresolved design considerations, hence the desire for the brainstorm proposal.
If anyone currently wants this, please ping here.
If anyone wants to be part of the design discussion, also ping here.