From e0bf52250289d23cff5c6ef10aa60b9cf0997647 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 18 Aug 2021 12:07:23 -0700 Subject: 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 --- tools/nogo/defs.bzl | 5 +++++ 1 file changed, 5 insertions(+) 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( -- cgit v1.2.3