diff options
author | Adin Scannell <ascannell@google.com> | 2020-10-28 17:25:58 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-28 17:28:03 -0700 |
commit | b4b42a5fce4cdd134d7d28d96ae7d4862791d911 (patch) | |
tree | 6d0d4b345ac90a87dd2c95dce5ea9e5ca4bf8d94 /tools/nogo | |
parent | d20ef61a839efa19bed44a1cfa4a30a247056ffe (diff) |
Traversal embedded libraries, even for go_library rules.
PiperOrigin-RevId: 339570821
Diffstat (limited to 'tools/nogo')
-rw-r--r-- | tools/nogo/defs.bzl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/nogo/defs.bzl b/tools/nogo/defs.bzl index b3d297308..161ea972e 100644 --- a/tools/nogo/defs.bzl +++ b/tools/nogo/defs.bzl @@ -1,6 +1,6 @@ """Nogo rules.""" -load("//tools/bazeldefs:go.bzl", "go_context", "go_importpath", "go_rule", "go_test_library") +load("//tools/bazeldefs:go.bzl", "go_context", "go_embed_libraries", "go_importpath", "go_rule") NogoConfigInfo = provider( "information about a nogo configuration", @@ -200,14 +200,12 @@ def _nogo_aspect_impl(target, ctx): # If we're using the "library" attribute, then we need to aggregate the # original library sources and dependencies into this target to perform # proper type analysis. - if ctx.rule.kind == "go_test": - library = go_test_library(ctx.rule) - if library != None: - info = library[NogoInfo] - if hasattr(info, "srcs"): - srcs = srcs + info.srcs - if hasattr(info, "deps"): - deps = deps + info.deps + for embed in go_embed_libraries(ctx.rule): + info = embed[NogoInfo] + if hasattr(info, "srcs"): + srcs = srcs + info.srcs + if hasattr(info, "deps"): + deps = deps + info.deps # Start with all target files and srcs as input. inputs = target.files.to_list() + srcs |