Skip to content

Commit 099e8e2

Browse files
committed
Remove explicit rule restriction on deps
Previously this list of rules was used for what deps were allowed, but the providers is a more lenient way to do this. This allows rulesets to write native android rules as long as they correctly use CcInfo, without having to wrap it in an empty cc_library.
1 parent f143859 commit 099e8e2

1 file changed

Lines changed: 13 additions & 30 deletions

File tree

rules/android_binary/attrs.bzl

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414
"""Attributes."""
1515

16+
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
17+
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
1618
load("//providers:providers.bzl", "StarlarkApkInfo")
1719
load("//rules:android_neverlink_aspect.bzl", "android_neverlink_aspect")
1820
load("//rules:android_platforms_transition.bzl", "android_platforms_transition")
@@ -27,46 +29,27 @@ load(
2729
"split_config_aspect",
2830
)
2931
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
30-
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
31-
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
3232

3333
visibility(PROJECT_VISIBILITY)
3434

35-
def make_deps(allow_rules, providers, aspects):
36-
return attr.label_list(
37-
allow_rules = allow_rules,
38-
providers = providers,
39-
aspects = aspects,
40-
cfg = android_split_transition,
41-
)
42-
43-
DEPS_ALLOW_RULES = [
44-
"aar_import",
45-
"android_library",
46-
"cc_library",
47-
"java_import",
48-
"java_library",
49-
"java_lite_proto_library",
50-
]
51-
52-
DEPS_PROVIDERS = [
53-
[CcInfo],
54-
[JavaInfo],
55-
]
56-
57-
DEPS_ASPECTS = [
58-
dex_desugar_aspect,
59-
android_neverlink_aspect,
60-
]
61-
6235
ATTRS = _attrs.replace(
6336
_attrs.add(
6437
dict(
6538
srcs = attr.label_list(
6639
# TODO(timpeut): Set PropertyFlag direct_compile_time_input
6740
allow_files = [".java", ".srcjar"],
6841
),
69-
deps = make_deps(DEPS_ALLOW_RULES, DEPS_PROVIDERS, DEPS_ASPECTS),
42+
deps = attr.label_list(
43+
providers = [
44+
[CcInfo],
45+
[JavaInfo],
46+
],
47+
aspects = [
48+
dex_desugar_aspect,
49+
android_neverlink_aspect,
50+
],
51+
cfg = android_split_transition,
52+
),
7053
enable_data_binding = attr.bool(),
7154
instruments = attr.label(),
7255
manifest_values = attr.string_dict(),

0 commit comments

Comments
 (0)