Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gopackagesdriver: Descend into go_proto_compiler's deps #3240

Merged
merged 1 commit into from
Jul 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions go/tools/gopackagesdriver/aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ load(

GoPkgInfo = provider()

DEPS_ATTRS = [
"deps",
"embed",
]

PROTO_COMPILER_ATTRS = [
"compiler",
"compilers",
]

def _is_file_external(f):
return f.owner.workspace_root != ""

Expand Down Expand Up @@ -67,8 +77,8 @@ def _go_pkg_info_aspect_impl(target, ctx):
transitive_export_files = []
transitive_compiled_go_files = []

for attr in ["deps", "embed"]:
for dep in getattr(ctx.rule.attr, attr, []):
for attr in DEPS_ATTRS + PROTO_COMPILER_ATTRS:
for dep in getattr(ctx.rule.attr, attr, []) or []:
if GoPkgInfo in dep:
pkg_info = dep[GoPkgInfo]
transitive_json_files.append(pkg_info.pkg_json_files)
Expand Down Expand Up @@ -133,7 +143,7 @@ def _go_pkg_info_aspect_impl(target, ctx):

go_pkg_info_aspect = aspect(
implementation = _go_pkg_info_aspect_impl,
attr_aspects = ["embed", "deps"],
attr_aspects = DEPS_ATTRS + PROTO_COMPILER_ATTRS,
attrs = {
"_go_stdlib": attr.label(
default = "//:stdlib",
Expand Down