1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5android_sdk_repo_host {
6    name: "build-tools",
7    product_variables: {
8        platform_version_name: {
9            base_dir: "android-%s",
10        },
11    },
12
13    srcs: [
14        ":build_tools_source_properties",
15        ":build_tools_runtime_properties",
16    ],
17
18    merge_zips: [
19        ":build-tools_renderscript_includes",
20        ":renderscript-clang-include",
21        ":renderscript_sdk_prebuilts",
22    ],
23
24    multilib: {
25        common: {
26            deps: [
27                "build-tools_core-lambda-stubs",
28            ],
29        },
30    },
31    deps_remap: [
32        {
33            from: "framework/build-tools_core-lambda-stubs.jar",
34            to: "core-lambda-stubs.jar",
35        },
36    ],
37
38    target: {
39        linux: {
40            merge_zips: [":build-tools-lld-linux"],
41            strip_files: [
42                "lib64/*.so",
43                "lld-bin/lld",
44                "lib64/libc++.so.1",
45            ],
46        },
47        darwin: {
48            merge_zips: [":build-tools-lld-darwin"],
49            strip_files: [
50                "lib64/*.dylib",
51                "lld-bin/lld",
52            ],
53        },
54        not_windows: {
55            deps: [
56                "aapt",
57                "aapt2",
58                "aidl",
59                "apksigner",
60                "bcc_compat",
61                "d8",
62                "dexdump",
63                "llvm-rs-cc",
64                "split-select",
65                "zipalign",
66            ],
67            deps_remap: [
68                {
69                    from: "bin/*",
70                    to: "./",
71                },
72                {
73                    from: "framework/*",
74                    to: "./lib/",
75                },
76            ],
77            strip_files: [
78                "aapt",
79                "aapt2",
80                "aidl",
81                "bcc_compat",
82                "llvm-rs-cc",
83                "split-select",
84                "zipalign",
85            ],
86        },
87        windows: {
88            enabled: true,
89            merge_zips: [":build-tools-lld-windows"],
90
91            compile_multilib: "both",
92            multilib: {
93                lib32: {
94                    deps: [
95                        "aapt",
96                        "aidl",
97                        "apksigner",
98                        "bcc_compat",
99                        "d8",
100                        "dexdump",
101                        "libwinpthread-1",
102                        "lld",
103                        "llvm-rs-cc",
104                        "split-select",
105                        "zipalign",
106                    ],
107                },
108                lib64: {
109                    deps: [
110                        "aapt2",
111                        "libwinpthread-1",
112                    ],
113                },
114            },
115            deps_remap: [
116                {
117                    from: "bin/*",
118                    to: "./",
119                },
120                {
121                    from: "lib/*",
122                    to: "./",
123                },
124                {
125                    from: "framework/*",
126                    to: "./lib/",
127                },
128            ],
129            strip_files: [
130                "*.dll",
131                "aapt.exe",
132                "aapt2.exe",
133                "aidl.exe",
134                "bcc_compat.exe",
135                "dexdump.exe",
136                "lib64/*.dll",
137                "lld-bin/*.dll",
138                "lld-bin/*.exe",
139                "lld.exe",
140                "llvm-rs-cc.exe",
141                "split-select.exe",
142                "zipalign.exe",
143            ],
144        },
145    },
146}
147
148// Rename rs_script_api files to renderscript/include/...
149genrule {
150    name: "build-tools_renderscript_includes",
151    visibility: ["//visibility:private"],
152    tools: ["soong_zip"],
153    cmd: "echo $(in) >$(genDir)/list && " +
154        "$(location soong_zip) -o $(out) -P renderscript " +
155        "-C $$(dirname $$(dirname $$(awk '{ print $$1 }' $(genDir)/list))) -l $(genDir)/list",
156    srcs: [":rs_script_api"],
157    out: ["rs_script_api.zip"],
158}
159
160// This is a device library, so it can't be used by android_sdk_repo_host directly.
161java_device_for_host {
162    name: "build-tools_core-lambda-stubs-device",
163    visibility: ["//visibility:private"],
164    // Use the prebuilt of the stubs irrespective of whether prebuilts are enabled
165    // in this build configuration. This ensures that this non-host specific library
166    // is treated consistently on all hosts.
167    libs: ["prebuilt_core-lambda-stubs"],
168    target: {
169        windows: {
170            enabled: true,
171        },
172    },
173}
174
175java_library_host {
176    name: "build-tools_core-lambda-stubs",
177    visibility: ["//visibility:private"],
178    installable: true,
179    static_libs: ["build-tools_core-lambda-stubs-device"],
180    target: {
181        windows: {
182            enabled: true,
183        },
184    },
185}
186
187android_sdk_repo_host {
188    name: "platform-tools",
189    base_dir: "platform-tools",
190
191    deps: [
192        "adb",
193        "etc1tool",
194        "fastboot",
195        "hprof-conv",
196        "make_f2fs",
197        "make_f2fs_casefold",
198        "mke2fs",
199        "sqlite3",
200    ],
201    deps_remap: [
202        {
203            from: "bin/*",
204            to: "./",
205        },
206    ],
207
208    srcs: [
209        ":mke2fs_conf",
210        ":platform_tools_properties",
211    ],
212
213    target: {
214        linux: {
215            strip_files: ["lib64/*.so"],
216        },
217        linux_bionic: {
218            enabled: false,
219        },
220        darwin: {
221            strip_files: ["lib64/*.dylib"],
222        },
223        not_windows: {
224            strip_files: [
225                "adb",
226                "etc1tool",
227                "fastboot",
228                "hprof-conv",
229                "make_f2fs_casefold",
230                "make_f2fs",
231                "mke2fs",
232                "sqlite3",
233            ],
234        },
235        windows: {
236            enabled: true,
237            deps: [
238                "AdbWinUsbApi",
239                "AdbWinApi",
240                "libwinpthread-1",
241            ],
242            deps_remap: [
243                {
244                    from: "lib/*",
245                    to: "./",
246                },
247            ],
248            strip_files: [
249                "*.exe",
250            ],
251        },
252    },
253}
254