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
This commit is contained in:
Michael Pratt
2021-08-18 12:10:09 -07:00
committed by gVisor bot
parent 216b740663
commit e0bf522502
+5
View File
@@ -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(