Skip to content

Commit 42de4f8

Browse files
ted-xiecopybara-github
authored andcommitted
Re-organize tools.bzl
PiperOrigin-RevId: 687067778 Change-Id: Ic91246883b7c164eef13f5c5ab30e7e2c91552b0
1 parent f53342f commit 42de4f8

File tree

2 files changed

+161
-140
lines changed

2 files changed

+161
-140
lines changed

mobile_install/tools.bzl

Lines changed: 4 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 The Bazel Authors. All rights reserved.
1+
# Copyright 2024 The Bazel Authors. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,150 +11,14 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
"""Tools needed by the mobile-install aspect defined as aspect attributes."""
14+
"""Tools needed by the OSS mobile-install aspect defined as aspect attributes."""
1515

16+
load("//mobile_install:tools_common.bzl", _TOOL_ATTRS = "TOOL_ATTRS")
1617
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
17-
load(":dependency_map.bzl", "versioned_deps")
1818

1919
visibility(PROJECT_VISIBILITY)
2020

21-
TOOL_ATTRS = dict(
22-
# Target Attrs
23-
# This library should not be versioned. It needs to be built with the same
24-
# config that is used to build the app. Android binds the application to a
25-
# concrete architecture during install time. If no libs are on the apk, it
26-
# will select the most specific to the device is running. We want to use
27-
# whatever the user builds as long as it is compatible. And since we push
28-
# the native libs outside the apk to speed up transfer times, we need to
29-
# use dummy libs.
30-
_android_sdk = attr.label(
31-
default = Label(
32-
"//tools/android:android_jar",
33-
),
34-
allow_files = True,
35-
cfg = "target",
36-
),
37-
_flags = attr.label(
38-
default = Label(
39-
"//rules/flags",
40-
),
41-
),
42-
_studio_deployer = attr.label(
43-
default = Label("//tools/android:apkdeployer_deploy.jar"),
44-
allow_single_file = True,
45-
cfg = "exec",
46-
executable = True,
47-
),
48-
_mi_java8_legacy_dex = attr.label(
49-
default = Label("//tools/android:java8_legacy_dex"),
50-
allow_single_file = True,
51-
cfg = "target",
52-
),
53-
54-
# Host Attrs
55-
_aapt2 = attr.label(
56-
default = Label(
57-
"@androidsdk//:aapt2_binary",
58-
),
59-
allow_files = True,
60-
cfg = "exec",
61-
executable = True,
62-
),
63-
_apk_signer = attr.label(
64-
default = Label("@apksig//:apksigner_deploy.jar"),
65-
allow_files = True,
66-
cfg = "exec",
67-
executable = True,
68-
),
69-
_desugar_java8 = attr.label(
70-
default = Label("//tools/android:desugar_java8"),
71-
allow_files = True,
72-
cfg = "exec",
73-
executable = True,
74-
),
75-
_dexmerger = attr.label(
76-
cfg = "exec",
77-
default = Label("//tools/android:dexmerger"),
78-
executable = True,
79-
),
80-
_dexbuilder = attr.label(
81-
cfg = "exec",
82-
default = Label("//tools/android:dexbuilder"),
83-
executable = True,
84-
),
85-
_host_java_runtime = attr.label(
86-
default = Label("//tools/jdk:current_host_java_runtime"),
87-
cfg = "exec",
88-
),
89-
_java_jdk = attr.label(
90-
default = Label("//tools/jdk:current_java_runtime"),
91-
allow_files = True,
92-
cfg = "exec",
93-
),
94-
_java_toolchain = attr.label(
95-
default = Label("//tools/jdk:current_java_toolchain"),
96-
),
97-
_resource_busybox = attr.label(
98-
default = Label("//src/tools/java/com/google/devtools/build/android:ResourceProcessorBusyBox_deploy.jar"),
99-
allow_files = True,
100-
cfg = "exec",
101-
executable = True,
102-
),
103-
_zipalign = attr.label(
104-
default = Label(
105-
"@androidsdk//:zipalign_binary",
106-
),
107-
allow_files = True,
108-
cfg = "exec",
109-
executable = True,
110-
),
111-
112-
113-
# Versioned Host Attrs
114-
_android_kit = attr.label(
115-
default = versioned_deps.android_kit.head,
116-
allow_files = True,
117-
cfg = "exec",
118-
executable = True,
119-
),
120-
_deploy = attr.label(
121-
default = versioned_deps.deploy.head,
122-
allow_files = True,
123-
cfg = "exec",
124-
executable = True,
125-
),
126-
_deploy_info = attr.label(
127-
default = versioned_deps.deploy_info.head,
128-
allow_files = True,
129-
cfg = "exec",
130-
executable = True,
131-
),
132-
_jar_tool = attr.label(
133-
default = versioned_deps.jar_tool.head,
134-
allow_files = True,
135-
cfg = "exec",
136-
executable = True,
137-
),
138-
_mi_android_java_toolchain = attr.label(
139-
default = Label("//tools/jdk:toolchain_android_only"),
140-
),
141-
_mi_java_toolchain = attr.label(
142-
cfg = "exec",
143-
default = Label("//tools/jdk:toolchain"),
144-
),
145-
_mi_host_javabase = attr.label(
146-
default = Label("//tools/jdk:current_host_java_runtime"),
147-
),
148-
_res_v3_dummy_manifest = attr.label(
149-
allow_single_file = True,
150-
default = versioned_deps.res_v3_dummy_manifest.head,
151-
),
152-
_res_v3_dummy_r_txt = attr.label(
153-
allow_single_file = True,
154-
default = versioned_deps.res_v3_dummy_r_txt.head,
155-
),
156-
157-
)
21+
TOOL_ATTRS = _TOOL_ATTRS
15822

15923
# Toolchains that will be traversed by the adapters.
16024
TOOLCHAIN_TYPES = []

mobile_install/tools_common.bzl

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
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+
"""Common tools needed by the mobile-install aspect defined as aspect attributes."""
15+
16+
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
17+
load(":dependency_map.bzl", "versioned_deps")
18+
19+
visibility(PROJECT_VISIBILITY)
20+
21+
TOOL_ATTRS = dict(
22+
# Target Attrs
23+
# This library should not be versioned. It needs to be built with the same
24+
# config that is used to build the app. Android binds the application to a
25+
# concrete architecture during install time. If no libs are on the apk, it
26+
# will select the most specific to the device is running. We want to use
27+
# whatever the user builds as long as it is compatible. And since we push
28+
# the native libs outside the apk to speed up transfer times, we need to
29+
# use dummy libs.
30+
_android_sdk = attr.label(
31+
default = Label(
32+
"//tools/android:android_jar",
33+
),
34+
allow_files = True,
35+
cfg = "target",
36+
),
37+
_flags = attr.label(
38+
default = Label(
39+
"//rules/flags",
40+
),
41+
),
42+
_studio_deployer = attr.label(
43+
default = Label("//tools/android:apkdeployer_deploy.jar"),
44+
allow_single_file = True,
45+
cfg = "exec",
46+
executable = True,
47+
),
48+
_mi_java8_legacy_dex = attr.label(
49+
default = Label("//tools/android:java8_legacy_dex"),
50+
allow_single_file = True,
51+
cfg = "target",
52+
),
53+
54+
# Host Attrs
55+
_aapt2 = attr.label(
56+
default = Label(
57+
"@androidsdk//:aapt2_binary",
58+
),
59+
allow_files = True,
60+
cfg = "exec",
61+
executable = True,
62+
),
63+
_apk_signer = attr.label(
64+
default = Label("@apksig//:apksigner_deploy.jar"),
65+
allow_files = True,
66+
cfg = "exec",
67+
executable = True,
68+
),
69+
_desugar_java8 = attr.label(
70+
default = Label("//tools/android:desugar_java8"),
71+
allow_files = True,
72+
cfg = "exec",
73+
executable = True,
74+
),
75+
_dexmerger = attr.label(
76+
cfg = "exec",
77+
default = Label("//tools/android:dexmerger"),
78+
executable = True,
79+
),
80+
_dexbuilder = attr.label(
81+
cfg = "exec",
82+
default = Label("//tools/android:dexbuilder"),
83+
executable = True,
84+
),
85+
_host_java_runtime = attr.label(
86+
default = Label("//tools/jdk:current_host_java_runtime"),
87+
cfg = "exec",
88+
),
89+
_java_jdk = attr.label(
90+
default = Label("//tools/jdk:current_java_runtime"),
91+
allow_files = True,
92+
cfg = "exec",
93+
),
94+
_java_toolchain = attr.label(
95+
default = Label("//tools/jdk:current_java_toolchain"),
96+
),
97+
_resource_busybox = attr.label(
98+
default = Label("//src/tools/java/com/google/devtools/build/android:ResourceProcessorBusyBox_deploy.jar"),
99+
allow_files = True,
100+
cfg = "exec",
101+
executable = True,
102+
),
103+
_zipalign = attr.label(
104+
default = Label(
105+
"@androidsdk//:zipalign_binary",
106+
),
107+
allow_files = True,
108+
cfg = "exec",
109+
executable = True,
110+
),
111+
112+
113+
# Versioned Host Attrs
114+
_android_kit = attr.label(
115+
default = versioned_deps.android_kit.head,
116+
allow_files = True,
117+
cfg = "exec",
118+
executable = True,
119+
),
120+
_deploy = attr.label(
121+
default = versioned_deps.deploy.head,
122+
allow_files = True,
123+
cfg = "exec",
124+
executable = True,
125+
),
126+
_deploy_info = attr.label(
127+
default = versioned_deps.deploy_info.head,
128+
allow_files = True,
129+
cfg = "exec",
130+
executable = True,
131+
),
132+
_jar_tool = attr.label(
133+
default = versioned_deps.jar_tool.head,
134+
allow_files = True,
135+
cfg = "exec",
136+
executable = True,
137+
),
138+
_mi_android_java_toolchain = attr.label(
139+
default = Label("//tools/jdk:toolchain_android_only"),
140+
),
141+
_mi_java_toolchain = attr.label(
142+
cfg = "exec",
143+
default = Label("//tools/jdk:toolchain"),
144+
),
145+
_mi_host_javabase = attr.label(
146+
default = Label("//tools/jdk:current_host_java_runtime"),
147+
),
148+
_res_v3_dummy_manifest = attr.label(
149+
allow_single_file = True,
150+
default = versioned_deps.res_v3_dummy_manifest.head,
151+
),
152+
_res_v3_dummy_r_txt = attr.label(
153+
allow_single_file = True,
154+
default = versioned_deps.res_v3_dummy_r_txt.head,
155+
),
156+
157+
)

0 commit comments

Comments
 (0)