bazel: genquery + transitions: build error when query succeeds
Description of the problem / feature request:
Using Bazel 4.2.0, a genquery expression fails when the corresponding bazel query succeeds, apparently due to not handling an important transition used by rules_go to implement the “nogo” static analysis tool.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
To reproduce:
git clone git@github.com:robfig/rules_go-issue2991.git
cd rules_go-issue2991
bazel build //:foo_go_proto # works
bazel query "kind('proto_library', deps(//:foo_go_proto))" # works
bazel build //:deps # fails
The error message:
ERROR: /private/var/tmp/_bazel_robfig/cf4a500e949de5c5d412d75252cf434f/external/io_bazel_rules_go/BUILD.bazel:73:16: in go_context_data rule @io_bazel_rules_go//:go_context_data: cycle in dependency graph:
//:deps
//:foo_go_proto
@io_bazel_rules_go//proto:go_proto
@org_golang_google_protobuf//types/known/structpb:structpb
@org_golang_google_protobuf//reflect/protoreflect:protoreflect
@org_golang_google_protobuf//encoding/protowire:protowire
@org_golang_google_protobuf//internal/errors:errors
@org_golang_google_protobuf//internal/detrand:detrand
.-> @io_bazel_rules_go//:go_context_data
| @io_bazel_rules_nogo//:nogo
| //:default_nogo
| //:default_nogo_actual
| @io_bazel_rules_go//go/tools/builders:nogo_srcs
| @org_golang_x_tools//go/gcexportdata:gcexportdata
| @org_golang_x_tools//go/internal/gcimporter:gcimporter
`-- @io_bazel_rules_go//:go_context_data
ERROR: Analysis of target '//:deps' failed; build aborted
This was discovered after rules_go moved to transitions for static analysis support in this commit: https://github.com/bazelbuild/rules_go/commit/63dfd99403076331fef0775d52a8039d502d4115
I don’t see any way to fix it within rules_go.
What operating system are you running Bazel on?
MacOS Catalina
What’s the output of bazel info release?
release 4.2.0
Have you found anything relevant by searching the web?
I found no relevant results for the terms: genquery transitions
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 36 (22 by maintainers)
Commits related to this issue
- Flip `--experimental_skip_ttvs_for_genquery` Fixes #14169 RELNOTES: `genquery` now supports (unconfigured) cycles, but may have higher peak memory usage. The default value of `--skyframe_high_water_... — committed to bazel-io/bazel by fmeum 2 years ago
- Preserve `--experimental_skip_ttvs_for_genquery` in the exec cfg (#23032) This is not a cherry-pick, but a dedicated fix for Bazel 7.x. Bazel 8 is not affected as the switch to the Starlarkified exec... — committed to bazelbuild/bazel by fmeum 2 years ago
- Preserve `--experimental_skip_ttvs_for_genquery` in the exec config Fixes https://github.com/bazelbuild/bazel/issues/14169#issuecomment-2189634085 Closes #22892. PiperOrigin-RevId: 654305152 Change... — committed to fishbone/bazel by fmeum 2 years ago
Update: we’ve begun the process of passing the current default values as flags where needed and need to wait for that to propagate to all environments. I will update once it’s safe to proceed with changing the defaults.
This has come up again in https://github.com/bazelbuild/rules_go/issues/3883, so I will reopen.
@gregestren @haxorz Do you see a way to make
genquerybehave in some reasonable way here? Happy to work on a fix, but I wouldn’t want to break any google3 requirements.