xref: /aosp_15_r20/external/bazelbuild-rules_android/mobile_install/tools.bzl (revision 9e965d6fece27a77de5377433c2f7e6999b8cc0b)
1# Copyright 2018 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Tools needed by the mobile-install aspect defined as aspect attributes."""
15
16load(":dependency_map.bzl", "versioned_deps")
17
18TOOL_ATTRS = dict(
19    # Target Attrs
20    # This library should not be versioned. It needs to be built with the same
21    # config that is used to build the app. Android binds the application to a
22    # concrete achitecture during install time. If no libs are on the apk, it
23    # will select the most specific to the device is running. We want to use
24    # whatever the user builds as long as it is compatible. And since we push
25    # the native libs outside the apk to speed up transfer times, we need to
26    # use dummy libs.
27    _android_sdk = attr.label(
28        default = Label(
29            "//tools/android:android_jar",
30        ),
31        allow_files = True,
32        cfg = "target",
33    ),
34    _flags = attr.label(
35        default = Label(
36            "//rules/flags",
37        ),
38    ),
39    _studio_deployer = attr.label(
40        default = "//tools/android:gen_fail", # TODO(#119): Studio deployer jar to be released
41        allow_single_file = True,
42        cfg = "exec",
43        executable = True,
44    ),
45    _mi_shell_dummy_native_libs = attr.label(
46        default = Label(
47            "//tools/android:gen_fail", # FIXME: Unused internally
48        ),
49        allow_single_file = True,
50        cfg = "target",
51    ),
52    _mi_shell_app = attr.label(
53        default = versioned_deps.mi_shell_app.head,
54        allow_files = True,
55        cfg = "target",
56        executable = True,
57    ),
58    _mi_java8_legacy_dex = attr.label(
59        default = Label("//tools/android:java8_legacy_dex"),
60        allow_single_file = True,
61        cfg = "target",
62    ),
63
64    # Host Attrs
65    _aapt2 = attr.label(
66        default = Label(
67            "@androidsdk//:aapt2_binary",
68        ),
69        allow_single_file = True,
70        cfg = "exec",
71        executable = True,
72    ),
73    _android_test_runner = attr.label(
74        default = Label(
75            "@bazel_tools//tools/jdk:TestRunner_deploy.jar",
76        ),
77        allow_single_file = True,
78        cfg = "exec",
79        executable = True,
80    ),
81    _apk_signer = attr.label(
82        default = Label("@androidsdk//:apksigner"),
83        allow_files = True,
84        cfg = "exec",
85        executable = True,
86    ),
87    _desugar_java8 = attr.label(
88        default = Label("//tools/android:desugar_java8"),
89        allow_files = True,
90        cfg = "exec",
91        executable = True,
92    ),
93    _d8 = attr.label(
94        default = Label("//tools/android:d8"),
95        allow_files = True,
96        cfg = "exec",
97        executable = True,
98    ),
99    _host_java_runtime = attr.label(
100        default = Label("//tools/jdk:current_host_java_runtime"),
101        cfg = "exec",
102    ),
103    _java_jdk = attr.label(
104        default = Label("//tools/jdk:current_java_runtime"),
105        allow_files = True,
106        cfg = "exec",
107    ),
108    _resource_busybox = attr.label(
109        default = Label("@bazel_tools//src/tools/android/java/com/google/devtools/build/android:ResourceProcessorBusyBox_deploy.jar"),
110        allow_files = True,
111        cfg = "exec",
112        executable = True,
113    ),
114    _zipalign = attr.label(
115        default = Label(
116            "@androidsdk//:zipalign_binary",
117        ),
118        allow_single_file = True,
119        cfg = "exec",
120        executable = True,
121    ),
122
123
124    # Versioned Host Attrs
125    _android_kit = attr.label(
126        default = versioned_deps.android_kit.head,
127        allow_files = True,
128        cfg = "exec",
129        executable = True,
130    ),
131    _deploy = attr.label(
132        default = versioned_deps.deploy.head,
133        allow_files = True,
134        cfg = "exec",
135        executable = True,
136    ),
137    _deploy_info = attr.label(
138        default = versioned_deps.deploy_info.head,
139        allow_files = True,
140        cfg = "exec",
141        executable = True,
142    ),
143    _jar_tool = attr.label(
144        default = versioned_deps.jar_tool.head,
145        allow_files = True,
146        cfg = "exec",
147        executable = True,
148    ),
149    _make_sync = attr.label(
150        default = versioned_deps.make_sync.head,
151        allow_files = True,
152        cfg = "exec",
153        executable = True,
154    ),
155    _merge_syncs = attr.label(
156        default = versioned_deps.merge_syncs.head,
157        allow_files = True,
158        cfg = "exec",
159        executable = True,
160    ),
161    _mi_android_java_toolchain = attr.label(
162        default = Label("//tools/jdk:toolchain_android_only"),
163    ),
164    _mi_java_toolchain = attr.label(
165        cfg = "exec",
166        default = Label("//tools/jdk:toolchain"),
167    ),
168    _mi_host_javabase = attr.label(
169        default = Label("//tools/jdk:current_host_java_runtime"),
170    ),
171    _pack_dexes = attr.label(
172        default = versioned_deps.pack_dexes.head,
173        allow_files = True,
174        cfg = "exec",
175        executable = True,
176    ),
177    _pack_generic = attr.label(
178        default = versioned_deps.pack_generic.head,
179        allow_files = True,
180        cfg = "exec",
181        executable = True,
182    ),
183    _res_v3_dummy_manifest = attr.label(
184        allow_single_file = True,
185        default = versioned_deps.res_v3_dummy_manifest.head,
186    ),
187    _res_v3_dummy_r_txt = attr.label(
188        allow_single_file = True,
189        default = versioned_deps.res_v3_dummy_r_txt.head,
190    ),
191    _resource_extractor = attr.label(
192        allow_single_file = True,
193        cfg = "exec",
194        default = versioned_deps.resource_extractor.head,
195        executable = True,
196    ),
197    _sync_merger = attr.label(
198        default = versioned_deps.sync_merger.head,
199        allow_files = True,
200        cfg = "exec",
201        executable = True,
202    ),
203
204)
205