-
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
Skipping incompatible targets is too cumbersome #17403
Comments
This adds an argument to skip incompatible targets even if they were explicitly requested on the command line. This is useful for CI to allow it to build changed targets from rdeps queries without needing to filter them all through a cquery to check if they are compatible. Closes bazelbuild#17403 RELNOTES: Add `--skip_incompatible_explicit_targets` option
This adds an argument to skip incompatible targets even if they were explicitly requested on the command line. This is useful for CI to allow it to build changed targets from rdeps queries without needing to filter them all through a cquery to check if they are compatible. Closes bazelbuild#17403 RELNOTES: Add `--skip_incompatible_explicit_targets` option
I understand what you're expressing. I'm generally hesitant to add more flags to toggle Bazel features - Bazel has too many toggles as it is. That doesn't mean we can't add them. Just that we want to to careful due diligence to justify their cost. @philsc do you remember if we considered this sort of thing when defining the current semantics? What was the rationale again for making direct calls errors while |
Yeah, this is a fair criticism I think.
Looking at the original proposal, it looks like we didn't have a justification for the "why" it should work this way. My suspicion is that it just "felt" like the right thing to do. I.e. if you request bazel to build something that can't be built, that "feels" like an error. Most likely user error. But that doesn't account for the fact that I'm hesitant to change the default behaviour because (at least in my experience) the error that gets printed when trying to build an incompatible target is super helpful. It will tell the user immediately why their target cannot be built. Obviously not helpful for a CI system. I'm not opposed to adding a flag to toggle the behaviour. I can't immediately think of a better way to handle this. |
Thanks for the comments! I understand the hesitation of adding yet another command line flag. I'm on the fence about what the default behavior should be. On one hand, if you ask bazel to build something it shouldn't silently skip it and exit 0. However, that's kind of what Maybe |
The main other feedback was to not make such a flag part of build configuration, so people can't write configuration transitions over it. https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/analysis/AnalysisOptions.java would be a good place for the flag. Re: communicating the error, we'd prefer updates to the |
Just wanted to add a note that passing targets to cquery and aquery using file recently got fixed here (fb23246). Also, would it be better for this to be some sort of filter in the query language? |
Sounds good! I can push an update to the PR.
Nice!
This sounds much easier than the |
This adds an argument to skip incompatible targets even if they were explicitly requested on the command line. This is useful for CI to allow it to build changed targets from rdeps queries without needing to filter them all through a cquery to check if they are compatible. Closes bazelbuild#17403 RELNOTES: Add `--skip_incompatible_explicit_targets` option
This adds an argument to skip incompatible targets even if they were explicitly requested on the command line. This is useful for CI to allow it to build changed targets from rdeps queries without needing to filter them all through a cquery to check if they are compatible. Closes bazelbuild#17403 RELNOTES: Add `--skip_incompatible_explicit_targets` option Closes bazelbuild#17404. PiperOrigin-RevId: 519636134 Change-Id: I16d6a4896cf920f42364cba162001b1bb7658e65
Description of the feature request:
Skipping incompatible targets with target pattern expansion (e.g.
//...
) is great: https://bazel.build/extending/platforms#skipping-incompatible-targets. However, it's common in CI to usebazel query
to find the minimal set of targets to build/test to validate a proposed change. This typically produces a list of explicit targets which may include incompatible targets. Filtering them withcquery
(https://bazel.build/extending/platforms#skipping-incompatible-targets) works but is an extra step which takes time. Additionally, there might be thousands of targets to filter which must be chunked into separate command line invocations becausecquery
doesn't have any support for target pattern files like build and query do.A command line argument like
--skip_incompatible_explicit_targets
that skips incompatible explicit targets would allow us to take the output frombazel query
and use it directly in abazel test
command without usingcquery
to filter out incompatible targets.What underlying problem are you trying to solve with this feature?
I'd like to speed up our CI builds by not filtering all of the affected targets through
cquery
.Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?release 4.2.2-2.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.We've internally forked bazel but this feature request is unrelated to our modifications.
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?Have you found anything relevant by searching the web?
I started a discussion in the Bazel Slack workspace here: https://bazelbuild.slack.com/archives/CA31HN1T3/p1670884944989049
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: