-
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
bazelrc: Remove inheritance of targets from bazel build
in bazel cquery
, bazel clean
#8014
Comments
Yuch. I would propose that the request is really more like The docs (https://docs.bazel.build/versions/master/guide.html#bazelrc), OTOH, talk about rule inheritance, such that test inherits from build. That is convenient, but magical behavior, since it is not obvious it should be so. I would advocate that we should eliminate that inheritance and clarify that
|
@aiuto I see it more like "only apply inheritance rules to options (starting from '-')". Generally, you cquery the same option set as you build for. That is why inheritance is a good thing here. |
I didn't even realize you could set targets in the bazelrc. I wonder how common that is. @excitoon - what exactly do you do with this? Are you usually only building a single target? |
@gregestren Well, building bunch of targets by one |
No, I don't think it's accidental. But I wasn't personally familiar with it, and I know people have different usage patterns. That honestly sounds reasonable to me. |
Just ran into this with $ cat .bazelrc
build --no//my/project:boolean_flag
$ bazel clean
...
ERROR: Unrecognized arguments: --no//my/project:boolean_flag A comment in bazel/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java Lines 53 to 54 in 93e269e
It makes sense to me why |
Please share what you find, Ryan. I'm also marking this to discuss later this week among some core Bazel devs to see if anyone knows the history on this. |
Okay, so I read the rest of CleanCommand.java, and the only referenced flag from However, @aiuto's take in #8014 (comment) is prolly the right call for Bazel as a whole. I'm guessing it wouldn't take a whole lot of surgery to implement, but as a breaking change it'd have to wait until the next major release to ship. bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java Lines 165 to 187 in e904605
bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java Lines 522 to 535 in e904605
(Delete |
Thanks for this feedback.
It's not obvious to me breaking the inheritance between |
You could always add a I think we need Bazel changes to make this use case work cleanly. |
Thanks for the suggestion. I'm using |
Hi, What is the status of this ticket? I also stumbled upon this issue. We have configs where we exclude targets during the build, but the list of excluded targets is inherited also by the |
I think we could fix Excluding targets differently for |
It seems that if a string or string list flag contains the string "//" then it still fails:
Changing this to just a single slash causes the warning instead:
|
@djmarcin which Bazel version were you using? Note #12808 (comment). |
It fails on 4.0.0 and 4.1.0. Maybe I need to wait for 4.2.0? |
#12808 (comment) confirms the latest code will only show up in 4.2.0 (assuming the cherrypick is accepted). I think that will address your use case too. You can also try with a rolling release Bazel, which has everything: #13505. |
Any update on this issue? We would like NOT to get any warning for user defined build settings when running bazel clean command. |
See the final comments at #13473. I'd ask for any further clarification on that thread. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post |
.bazelrc
:With such settings one no longer use
cquery
andclean
because targets are going to its command line which is not intended for that.Can we just skip inheriting targets from build (but leave settings as they are useful) in these commands?
The text was updated successfully, but these errors were encountered: