diff options
author | Romain Jobredeaux <jobredeaux@google.com> | 2023-03-14 07:45:13 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-03-14 07:45:54 -0700 |
commit | 263b164a0879021682e7341381c687789fd532b6 (patch) | |
tree | ae509c80ce78560686aaaba25ffc024727d627a0 | |
parent | 96cfc9e436965ec3a1597af99ed5037d77a183b2 (diff) | |
download | bazelbuild-rules_android-263b164a0879021682e7341381c687789fd532b6.tar.gz |
Add an _android_sdk_toolchain_type attribute to the open source Starlark rules.
When using platform resolution, the native DexArchiveAspect needs this attribute to find the proper SDK
PiperOrigin-RevId: 516522155
Change-Id: I75f1c7e9aa8a37cbb6e7a75aca1a7498e51230a8
-rw-r--r-- | rules/aar_import/attrs.bzl | 1 | ||||
-rw-r--r-- | rules/android_binary_internal/attrs.bzl | 1 | ||||
-rw-r--r-- | rules/android_library/attrs.bzl | 1 | ||||
-rw-r--r-- | rules/attrs.bzl | 9 | ||||
-rw-r--r-- | tools/android/BUILD | 6 |
5 files changed, 18 insertions, 0 deletions
diff --git a/rules/aar_import/attrs.bzl b/rules/aar_import/attrs.bzl index 6fefdb0..022231b 100644 --- a/rules/aar_import/attrs.bzl +++ b/rules/aar_import/attrs.bzl @@ -69,4 +69,5 @@ ATTRS = _attrs.add( ), ), _attrs.DATA_CONTEXT, + _attrs.ANDROID_TOOLCHAIN_ATTRS, ) diff --git a/rules/android_binary_internal/attrs.bzl b/rules/android_binary_internal/attrs.bzl index 09fa24d..5d5fe49 100644 --- a/rules/android_binary_internal/attrs.bzl +++ b/rules/android_binary_internal/attrs.bzl @@ -84,6 +84,7 @@ ATTRS = _attrs.replace( ), _attrs.COMPILATION, _attrs.DATA_CONTEXT, + _attrs.ANDROID_TOOLCHAIN_ATTRS, ), # TODO(b/167599192): don't override manifest attr to remove .xml file restriction. manifest = attr.label( diff --git a/rules/android_library/attrs.bzl b/rules/android_library/attrs.bzl index 2bc3a0d..6b7380b 100644 --- a/rules/android_library/attrs.bzl +++ b/rules/android_library/attrs.bzl @@ -212,4 +212,5 @@ ATTRS = _attrs.add( ), _attrs.COMPILATION, _attrs.DATA_CONTEXT, + _attrs.ANDROID_TOOLCHAIN_ATTRS, ) diff --git a/rules/attrs.bzl b/rules/attrs.bzl index fcab354..c084016 100644 --- a/rules/attrs.bzl +++ b/rules/attrs.bzl @@ -325,6 +325,14 @@ ANDROID_SDK_ATTRS = dict( ), ) +# Attributes for resolving platform-based toolchains. Only needed by the native DexArchiveAspect. +_ANDROID_TOOLCHAIN_ATTRS = dict( + _android_sdk_toolchain_type = attr.label( + allow_rules = ["toolchain_type"], + default = Label("//tools/android:sdk_toolchain_type"), + ), +) + ANDROID_TOOLS_DEFAULTS_JAR_ATTRS = _add(_ANDROID_SDK) attrs = struct( @@ -332,6 +340,7 @@ attrs = struct( COMPILATION = _COMPILATION, DATA_CONTEXT = _DATA_CONTEXT, JAVA_RUNTIME = _JAVA_RUNTIME, + ANDROID_TOOLCHAIN_ATTRS = _ANDROID_TOOLCHAIN_ATTRS, tristate = _tristate, add = _add, replace = _replace, diff --git a/tools/android/BUILD b/tools/android/BUILD index 7a85b59..2995c06 100644 --- a/tools/android/BUILD +++ b/tools/android/BUILD @@ -5,6 +5,12 @@ android_jar( visibility = ["//visibility:public"], ) +alias( + name = "sdk_toolchain_type", + actual = "@bazel_tools//tools/android:sdk_toolchain_type", + visibility = ["//visibility:public"], +) + # TODO(b/175833857): This is a stub, should remove. alias( name = "merge_manifests", |