diff options
author | Michael Pratt <mpratt@google.com> | 2021-08-18 12:07:23 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-18 12:10:09 -0700 |
commit | e0bf52250289d23cff5c6ef10aa60b9cf0997647 (patch) | |
tree | 9d796651aa0714ca42fdbb60a31d02e7f188dbdb /tools | |
parent | 216b740663bd897dad177b57953c59860105020d (diff) |
Declare default outputs from nogo_stdlib
nogo_stdlib propogate facts and findings to downstream nogo_aspects via
NogoStdlibInfo. This all works fine except one case: directly building a
nogo_stdlib. e.g., bazel build //tools/nogo:stdlib.
In this case, nothing is requesting the NogoStdlibInfo, and thus the target has
nothing to do. This can be rather confusing when trying to debug failures in
:stdlib, as building :stdlib does nothing.
Fix this by declaring the facts and findings as default outputs from
nogo_stdlib. Now direct bazel build will request these outputs and actually
trigger the analysis. Standard aspect builds are unaffected.
PiperOrigin-RevId: 391580126
Diffstat (limited to 'tools')
-rw-r--r-- | tools/nogo/defs.bzl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/nogo/defs.bzl b/tools/nogo/defs.bzl index 80182ff6c..dc9a8b24e 100644 --- a/tools/nogo/defs.bzl +++ b/tools/nogo/defs.bzl @@ -160,6 +160,11 @@ def _nogo_stdlib_impl(ctx): return [NogoStdlibInfo( facts = facts, raw_findings = raw_findings, + ), DefaultInfo( + # Declare the facts and findings as default outputs. This is not + # strictly required, but ensures that the target still perform analysis + # when built directly rather than just indirectly via a nogo_test. + files = depset([facts, raw_findings]), )] nogo_stdlib = go_rule( |