-
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
Dependency cycle involving label_flag and configuration transition #11291
Comments
My suspicion is that for some reason the rule-level transition isn't being used. I'll debug and take a look. |
No, it's being called. Still trying to figure out what's happening. |
@juliexxia, Do you know how to debug this further? |
I think I have a workaround.
|
No, turns out the workaround doesn't work. Bazel still reports a dependency cycle when a binary is built in the host configuration. To reproduce, try building the -- WORKSPACE -- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") It doesn't seem like there's another way around this, so I think I'll have to roll back the change in rules_go. Too bad. It simplified a lot of things. |
The problem with the workaround is just that you can't transition in the host configuration, so the flag can't be changed. We don't yet have a way to set the values of Starlark flags in the host configuration specifically, unfortunately. @gregestren and @juliexxia we should figure this out. |
Hey Jay, not totally sure what's going on here but I can believe we have a bug with our label_flags and transitions. Is this bug blocking you? This week is a bazel fixit so I'd like to come back and investigate next week if this isn't totally keeping you from getting things done. |
Thanks Julie, it would be amazing if this could be fixed. This blocks migration of our static analysis framework (nogo) to build settings and transitions. Essentially we have a Currently, every package the If we can fix this dependency cycle, then This seems to work everywhere except the host configuration. We do have a couple binaries that need to run on hosts like Gazelle. (I've migrated everything else to build settings and transitions by the way, and I'm about to tag a new release with that. I'm quite happy with the simplifications that's enabled. Thanks for working on this!) |
What are you using the host configuration for at this point? I had hoped that at this point you'd be entirely into execution transitions. |
The main thing is the Is there another way to express that with execution transitions? |
Hmm, Does that make sense for you? |
Triaged inline with Julie's comments above. |
Just tried changing |
if you try |
I see this error. Do I need to define the repository
|
Sorry, I meant |
Ah, ok. In that case, it's the same dependency cycle error:
|
Okay, looks like go:std_package_list has a host dependency on gen_std_package_list:gen_std_package_list. |
Actually, in testing it looks like |
@jayconrod This hasn't been updated in a while. Is it still an issue? |
Yes I think so. The example still reproduces the error in Bazel 4.0.0. I tried making |
value. This prevents an extra analysis, since the dependency should only be on the value being used. Fixes bazelbuild#11291.
Good news: I have a fix out in #13372. For posterity: The transition was working correctly, and was in fact converting to use The fix is that the default should be a |
value. This prevents an extra analysis, since the dependency should only be on the value being used. Fixes bazelbuild#11291. Closes bazelbuild#13372. PiperOrigin-RevId: 369445041
value. This prevents an extra analysis, since the dependency should only be on the value being used. Fixes bazelbuild#11291. Closes bazelbuild#13372. PiperOrigin-RevId: 369445041
value. This prevents an extra analysis, since the dependency should only be on the value being used. Fixes bazelbuild#11291. Closes bazelbuild#13372. PiperOrigin-RevId: 369445041
value. This prevents an extra analysis, since the dependency should only be on the value being used. Fixes bazelbuild#11291. Closes bazelbuild#13372. PiperOrigin-RevId: 369445041
Description of the problem / feature request:
In rules_go, we have a customizable static analysis system called nogo. There's a
nogo
rule that generates a binary that is run alongside the Go compiler when building eachgo_library
. Developers use it to define a binary with a customizable set of static analyzers.I'd like to migrate nogo to the new Starlark Build Configuration system. Ideally, there should be a
label_flag
that points to anogo
target to use, and that could be set on the command-line. Currently, eachgo_binary
andgo_library
implicitly depends on a defaultnogo
target, which is set using some hacks involving repository rules. To break the dependency cycle,nogo
targets may only depend on targets defined withgo_tool_library
, a bootstrap rule similar togo_library
except it doesn't depend onnogo
in order to break the dependency cycle.Unfortunately, I'm seeing a different kind of dependency cycle. The workspace below is a minimal, standalone example of what I want to do with
nogo
.x_binary
is analogous togo_binary
.x_checker
is analogous tonogo
.x_binary
implicitly depends on alabel_flag
(withcfg = "exec"
) that points to anx_checker
that depends on anx_binary
.x_checker
has an incoming transition that sets the flag to a special target with no dependencies to break the cycle.Any build involving the
label_flag
reports a dependency cycle. It doesn't seem like the current value of the flag is taken into account when the dependency graph is loaded.This works if
checker_flag
defaults to//:null_checker
and is set to another value. It just doesn't work whenchecker_flag
defaults to a realx_checker
target.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Run
bazel build //:x
in this workspace:What operating system are you running Bazel on?
Darwin / amd64 (macOS 10.15.4)
What's the output of
bazel info release
?release 3.1.0
cc @juliexxia @gregestren @katre
The text was updated successfully, but these errors were encountered: