blob: f29ec90cc0869078c558dbe8e1372e69a5089347 [file] [log] [blame]
Tao Bao30e31142019-04-09 00:12:30 -07001// Copyright (C) 2019 The Android Open Source Project
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
Tao Bao3c7b2a62019-08-07 12:24:20 -070015//
16// Module-specific defaults.
17//
18// For module X, if we need to build it both as a library and an executable:
19// - A default rule `releasetools_X_defaults` is created, which lists `srcs`, `libs` and
20// `required` properties.
21// - `python_library_host` and `python_binary_host` are created by listing
22// `releasetools_X_defaults` in their defaults.
23//
24
25python_defaults {
26 name: "releasetools_add_img_to_target_files_defaults",
27 srcs: [
28 "add_img_to_target_files.py",
29 ],
30 libs: [
31 "releasetools_build_image",
32 "releasetools_build_super_image",
33 "releasetools_common",
34 ],
35 required: [
36 "care_map_generator",
37 ],
38}
39
40python_defaults {
41 name: "releasetools_build_image_defaults",
42 srcs: [
43 "build_image.py",
44 ],
45 libs: [
46 "releasetools_common",
47 "releasetools_verity_utils",
48 ],
49 required: [
50 "blk_alloc_to_base_fs",
51 "e2fsck",
52 "simg2img",
53 "tune2fs",
54 ],
55}
56
57python_defaults {
58 name: "releasetools_build_super_image_defaults",
59 srcs: [
60 "build_super_image.py",
61 ],
62 libs: [
63 "releasetools_common",
64 ],
65}
66
67python_defaults {
68 name: "releasetools_img_from_target_files_defaults",
69 srcs: [
70 "img_from_target_files.py",
71 ],
72 libs: [
73 "releasetools_build_super_image",
74 "releasetools_common",
75 ],
Tao Bao57f8ed62019-08-14 23:08:18 -070076 required: [
77 "zip2zip",
78 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -070079}
80
81python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070082 name: "releasetools_check_target_files_vintf_defaults",
83 srcs: [
84 "check_target_files_vintf.py",
85 ],
86 libs: [
87 "releasetools_common",
88 ],
89 required: [
90 "checkvintf",
91 ],
92}
93
94python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -070095 name: "releasetools_ota_from_target_files_defaults",
96 srcs: [
97 "edify_generator.py",
98 "ota_from_target_files.py",
99 "target_files_diff.py",
100 ],
101 libs: [
Yifan Hong9276cf02019-08-21 16:37:04 -0700102 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700103 "releasetools_common",
104 "releasetools_verity_utils",
105 ],
106 required: [
107 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700108 "checkvintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700109 ],
110}
111
112//
113// Host libraries.
114//
115
Tao Bao30e31142019-04-09 00:12:30 -0700116python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700117 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700118 version: {
119 py2: {
120 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700121 },
122 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700123 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700124 },
125 },
126}
127
128python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700129 name: "releasetools_add_img_to_target_files",
130 defaults: [
131 "releasetools_library_defaults",
132 "releasetools_add_img_to_target_files_defaults",
133 ],
134}
135
136python_library_host {
137 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700138 defaults: ["releasetools_library_defaults"],
139 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700140 "apex_utils.py",
141 ],
142 libs: [
143 "releasetools_common",
144 ],
145}
146
147python_library_host {
148 name: "releasetools_build_image",
149 defaults: [
150 "releasetools_library_defaults",
151 "releasetools_build_image_defaults",
152 ],
153}
154
155python_library_host {
156 name: "releasetools_build_super_image",
157 defaults: [
158 "releasetools_library_defaults",
159 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700160 ],
161}
162
163python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700164 name: "releasetools_check_target_files_vintf",
165 defaults: [
166 "releasetools_library_defaults",
167 "releasetools_check_target_files_vintf_defaults",
168 ],
169}
170
171python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700172 name: "releasetools_common",
173 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700174 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700175 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700176 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700177 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700178 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700179 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700180 ],
181 // Only the tools that are referenced directly are listed as required modules. For example,
182 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
183 required: [
changho.shin0f125362019-07-08 10:59:00 +0900184 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700185 "boot_signer",
186 "brotli",
187 "bsdiff",
188 "imgdiff",
189 "minigzip",
190 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100191 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700192 ],
193}
194
195python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700196 name: "releasetools_img_from_target_files",
197 defaults: [
198 "releasetools_library_defaults",
199 "releasetools_img_from_target_files_defaults",
200 ],
201}
202
203python_library_host {
204 name: "releasetools_ota_from_target_files",
205 defaults: [
206 "releasetools_library_defaults",
207 "releasetools_ota_from_target_files_defaults",
208 ],
209}
210
211python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700212 name: "releasetools_verity_utils",
213 defaults: ["releasetools_library_defaults"],
214 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700215 "verity_utils.py",
216 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700217 required: [
218 "append2simg",
219 "build_verity_metadata",
220 "build_verity_tree",
221 "fec",
222 ],
223}
224
Tao Bao3c7b2a62019-08-07 12:24:20 -0700225//
226// Host binaries.
227//
228
Tao Bao2bbb07c2019-05-07 13:12:21 -0700229python_defaults {
230 name: "releasetools_binary_defaults",
231 version: {
232 py2: {
233 enabled: true,
234 embedded_launcher: true,
235 },
236 py3: {
237 enabled: false,
238 embedded_launcher: false,
239 },
240 },
241}
242
243python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700244 name: "add_img_to_target_files",
245 defaults: [
246 "releasetools_binary_defaults",
247 "releasetools_add_img_to_target_files_defaults",
248 ],
249}
250
251python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700252 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700253 defaults: [
254 "releasetools_binary_defaults",
255 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700256 ],
257}
258
259python_binary_host {
260 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700261 defaults: [
262 "releasetools_binary_defaults",
263 "releasetools_build_super_image_defaults",
264 ],
265}
266
267python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000268 name: "check_partition_sizes",
269 srcs: [
270 "check_partition_sizes.py",
271 ],
272 libs: [
273 "releasetools_common",
274 ],
275 defaults: [
276 "releasetools_binary_defaults",
277 ],
278}
279
280python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700281 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700282 defaults: ["releasetools_binary_defaults"],
283 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700284 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700285 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700286 libs: [
287 "releasetools_common",
288 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700289 required: [
290 "delta_generator",
291 ],
292}
293
294python_binary_host {
295 name: "check_target_files_signatures",
296 defaults: ["releasetools_binary_defaults"],
297 srcs: [
298 "check_target_files_signatures.py",
299 ],
300 libs: [
301 "releasetools_common",
302 ],
303 required: [
304 "aapt",
305 ],
306}
307
308python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700309 name: "check_target_files_vintf",
310 defaults: [
311 "releasetools_binary_defaults",
312 "releasetools_check_target_files_vintf_defaults"
313 ],
314}
315
316python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700317 name: "img_from_target_files",
318 defaults: [
319 "releasetools_binary_defaults",
320 "releasetools_img_from_target_files_defaults",
321 ],
Tao Bao30e31142019-04-09 00:12:30 -0700322}
323
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700324python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700325 name: "make_recovery_patch",
326 defaults: ["releasetools_binary_defaults"],
327 srcs: [
328 "make_recovery_patch.py",
329 ],
330 libs: [
331 "releasetools_common",
332 ],
333}
334
335python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700336 name: "merge_builds",
337 defaults: ["releasetools_binary_defaults"],
338 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700339 "merge_builds.py",
340 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700341 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700342 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700343 "releasetools_common",
344 ],
345}
346
Tao Bao8821d642019-08-05 12:05:45 -0700347python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700348 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700349 defaults: ["releasetools_binary_defaults"],
350 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700351 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700352 ],
353 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700354 "releasetools_add_img_to_target_files",
355 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700356 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700357 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700358 "releasetools_img_from_target_files",
359 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700360 ],
Yifan Hong09298552019-09-04 11:49:01 -0700361 required: [
362 "checkvintf",
363 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700364}
365
366python_binary_host {
367 name: "ota_from_target_files",
368 defaults: [
369 "releasetools_binary_defaults",
370 "releasetools_ota_from_target_files_defaults",
371 ],
372}
373
374python_binary_host {
375 name: "ota_package_parser",
376 defaults: ["releasetools_binary_defaults"],
377 srcs: [
378 "ota_package_parser.py",
379 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700380 ],
381}
382
Tao Baoe11a4602019-08-06 23:21:23 -0700383python_binary_host {
384 name: "sparse_img",
385 defaults: ["releasetools_binary_defaults"],
386 srcs: [
387 "rangelib.py",
388 "sparse_img.py",
389 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700390}
391
Tao Bao3c7b2a62019-08-07 12:24:20 -0700392python_binary_host {
393 name: "sign_apex",
394 defaults: ["releasetools_binary_defaults"],
395 srcs: [
396 "sign_apex.py",
397 ],
398 libs: [
399 "releasetools_apex_utils",
400 "releasetools_common",
401 ],
402}
403
404python_binary_host {
405 name: "sign_target_files_apks",
406 defaults: ["releasetools_binary_defaults"],
407 srcs: [
408 "sign_target_files_apks.py",
409 ],
410 libs: [
411 "releasetools_add_img_to_target_files",
412 "releasetools_apex_utils",
413 "releasetools_common",
414 ],
415}
416
417python_binary_host {
418 name: "validate_target_files",
419 defaults: ["releasetools_binary_defaults"],
420 srcs: [
421 "validate_target_files.py",
422 ],
423 libs: [
424 "releasetools_common",
425 ],
426}
427
428//
429// Tests.
430//
431
Tao Baoca82fc92019-05-01 21:58:03 -0700432python_defaults {
433 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700434 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700435 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000436 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700437 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700438 "make_recovery_patch.py",
439 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700440 "ota_package_parser.py",
441 "sign_apex.py",
442 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700443 "validate_target_files.py",
444
Tao Bao30e31142019-04-09 00:12:30 -0700445 "test_*.py",
446 ],
447 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700448 "releasetools_add_img_to_target_files",
449 "releasetools_apex_utils",
450 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700451 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700452 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700453 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700454 "releasetools_img_from_target_files",
455 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700456 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700457 ],
458 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700459 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700460 ],
461 required: [
462 "otatools",
463 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700464}
465
466python_test_host {
467 name: "releasetools_test",
468 defaults: ["releasetools_test_defaults"],
469 main: "test_utils.py",
470 version: {
471 py2: {
472 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700473 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
474 // host, because the test executable won't be able to find the needed libs via its
475 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700476 embedded_launcher: false,
477 },
478 py3: {
479 enabled: false,
480 embedded_launcher: false,
481 },
482 },
483 test_suites: ["general-tests"],
484}
485
486python_test_host {
487 name: "releasetools_py3_test",
488 defaults: ["releasetools_test_defaults"],
489 main: "test_utils.py",
490 version: {
491 py2: {
492 enabled: false,
493 embedded_launcher: false,
494 },
495 py3: {
496 enabled: true,
497 embedded_launcher: false,
498 },
499 },
Tao Bao30e31142019-04-09 00:12:30 -0700500 test_suites: ["general-tests"],
501}