summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2021-08-18 12:07:23 -0700
committergVisor bot <gvisor-bot@google.com>2021-08-18 12:10:09 -0700
commite0bf52250289d23cff5c6ef10aa60b9cf0997647 (patch)
tree9d796651aa0714ca42fdbb60a31d02e7f188dbdb
parent216b740663bd897dad177b57953c59860105020d (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
-rw-r--r--tools/nogo/defs.bzl5
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(