Skip to content

Commit e6e58a6

Browse files
A Googlercopybara-github
authored andcommitted
Attach aspects to proto attributes defined by Starlark flags.
PiperOrigin-RevId: 857263444 Change-Id: I9abb73442416229cad95cd83330af8273dd160dc
1 parent 880cd0e commit e6e58a6

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

mobile_install/adapters/java_lite_proto_library.bzl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ visibility(PROJECT_VISIBILITY)
2626

2727
def _aspect_attrs():
2828
"""Attrs of the rule requiring traversal by the aspect."""
29-
return ["deps", "_aspect_proto_toolchain_for_javalite"]
29+
return ["deps", "_aspect_proto_toolchain_for_javalite", "_proto_toolchain_for_javalite"]
3030

3131
def _adapt(target, ctx):
3232
"""Adapts the rule and target data.
@@ -40,19 +40,23 @@ def _adapt(target, ctx):
4040
"""
4141
if not ctx.rule.attr.deps:
4242
return []
43+
if getattr(ctx.rule.attr, "_aspect_proto_toolchain_for_javalite"):
44+
toolchain_dep = [ctx.rule.attr._aspect_proto_toolchain_for_javalite]
45+
else:
46+
toolchain_dep = [ctx.rule.attr._proto_toolchain_for_javalite]
4347
return [
4448
providers.make_mi_android_dex_info(
4549
deps = providers.collect(
4650
MIAndroidDexInfo,
4751
ctx.rule.attr.deps,
48-
[ctx.rule.attr._aspect_proto_toolchain_for_javalite],
52+
toolchain_dep,
4953
),
5054
),
5155
providers.make_mi_java_resources_info(
5256
deps = providers.collect(
5357
MIJavaResourcesInfo,
5458
ctx.rule.attr.deps,
55-
[ctx.rule.attr._aspect_proto_toolchain_for_javalite],
59+
toolchain_dep,
5660
),
5761
),
5862
]

rules/dex_desugar_aspect.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ _ATTR_ASPECTS = [
3535
"_build_stamp_deps", # for build stamp runtime class deps
3636
"_build_stamp_mergee_manifest_lib", # for empty build stamp Service class implementation
3737
"_desugared_lib_config", # For java8 desugaring config file
38+
"_proto_toolchain_for_javalite", # To get from proto_library through proto_lang_toolchain rule to proto runtime library.
3839
"_toolchain", # For _java_lite_grpc_library
3940
"deps",
4041
"exports",

0 commit comments

Comments
 (0)