blob: 6d882492a5c808a824a964bf01bb2e545d0fb8cf [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
Bob Badour03905802021-02-12 21:42:54 -080025package {
26 default_applicable_licenses: ["Android-Apache-2.0"],
27}
28
Tao Bao3c7b2a62019-08-07 12:24:20 -070029python_defaults {
30 name: "releasetools_add_img_to_target_files_defaults",
31 srcs: [
32 "add_img_to_target_files.py",
33 ],
34 libs: [
Kelvin Zhang5f0fcee2021-01-19 15:30:46 -050035 "ota_metadata_proto",
36 "releasetools_apex_utils",
Tao Bao3c7b2a62019-08-07 12:24:20 -070037 "releasetools_build_image",
38 "releasetools_build_super_image",
39 "releasetools_common",
40 ],
41 required: [
42 "care_map_generator",
43 ],
44}
45
46python_defaults {
47 name: "releasetools_build_image_defaults",
48 srcs: [
49 "build_image.py",
50 ],
51 libs: [
52 "releasetools_common",
53 "releasetools_verity_utils",
54 ],
55 required: [
56 "blk_alloc_to_base_fs",
57 "e2fsck",
Gao Xiang961041a2020-06-17 13:59:16 +080058 "mkerofsimage.sh",
Yifan Hong77023452020-08-25 16:15:16 -070059 "mkuserimg_mke2fs",
Tao Bao3c7b2a62019-08-07 12:24:20 -070060 "simg2img",
61 "tune2fs",
62 ],
63}
64
65python_defaults {
66 name: "releasetools_build_super_image_defaults",
67 srcs: [
68 "build_super_image.py",
69 ],
70 libs: [
71 "releasetools_common",
72 ],
73}
74
75python_defaults {
76 name: "releasetools_img_from_target_files_defaults",
77 srcs: [
78 "img_from_target_files.py",
79 ],
80 libs: [
81 "releasetools_build_super_image",
82 "releasetools_common",
83 ],
84}
85
86python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070087 name: "releasetools_check_target_files_vintf_defaults",
88 srcs: [
89 "check_target_files_vintf.py",
90 ],
91 libs: [
92 "releasetools_common",
93 ],
94 required: [
95 "checkvintf",
96 ],
97}
98
Tianjiea2076132020-08-19 17:25:32 -070099python_library_host {
100 name: "ota_metadata_proto",
101 version: {
102 py2: {
103 enabled: true,
104 },
105 py3: {
106 enabled: true,
107 },
108 },
109 srcs: [
110 "ota_metadata.proto",
111 ],
112 proto: {
113 canonical_path_from_root: false,
114 },
115}
116
Yifan Honge3ba82c2019-08-21 13:29:30 -0700117python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700118 name: "releasetools_ota_from_target_files_defaults",
119 srcs: [
120 "edify_generator.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400121 "non_ab_ota.py",
Tianjiea2076132020-08-19 17:25:32 -0700122 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400123 "ota_utils.py",
Tianjiea2076132020-08-19 17:25:32 -0700124 "target_files_diff.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700125 ],
126 libs: [
Tianjiea2076132020-08-19 17:25:32 -0700127 "ota_metadata_proto",
Yifan Hong9276cf02019-08-21 16:37:04 -0700128 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700129 "releasetools_common",
130 "releasetools_verity_utils",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000131 "apex_manifest",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700132 ],
133 required: [
134 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700135 "checkvintf",
Yifan Hong125d0b62020-09-24 17:07:03 -0700136 "lz4",
137 "toybox",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000138 "unpack_bootimg",
139 "deapexer",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700140 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000141 target: {
142 darwin: {
143 // required module "brillo_update_payload" is disabled on darwin
144 enabled: false,
145 },
146 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700147}
148
149//
150// Host libraries.
151//
152
Tao Bao30e31142019-04-09 00:12:30 -0700153python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700154 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700155 version: {
156 py2: {
157 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700158 },
159 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700160 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700161 },
162 },
163}
164
165python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700166 name: "releasetools_add_img_to_target_files",
167 defaults: [
168 "releasetools_library_defaults",
169 "releasetools_add_img_to_target_files_defaults",
170 ],
171}
172
173python_library_host {
174 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700175 defaults: ["releasetools_library_defaults"],
176 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700177 "apex_utils.py",
178 ],
179 libs: [
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000180 "apex_manifest",
181 "ota_metadata_proto",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700182 "releasetools_common",
183 ],
184}
185
186python_library_host {
187 name: "releasetools_build_image",
188 defaults: [
189 "releasetools_library_defaults",
190 "releasetools_build_image_defaults",
191 ],
192}
193
194python_library_host {
195 name: "releasetools_build_super_image",
196 defaults: [
197 "releasetools_library_defaults",
198 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700199 ],
200}
201
202python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700203 name: "releasetools_check_target_files_vintf",
204 defaults: [
205 "releasetools_library_defaults",
206 "releasetools_check_target_files_vintf_defaults",
207 ],
208}
209
210python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700211 name: "releasetools_common",
212 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700213 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700214 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700215 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700216 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700217 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700218 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700219 ],
220 // Only the tools that are referenced directly are listed as required modules. For example,
221 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
222 required: [
changho.shin0f125362019-07-08 10:59:00 +0900223 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700224 "boot_signer",
225 "brotli",
226 "bsdiff",
227 "imgdiff",
228 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000229 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700230 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100231 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800232 "toybox",
233 "unpack_bootimg",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700234 ],
235}
236
237python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700238 name: "releasetools_img_from_target_files",
239 defaults: [
240 "releasetools_library_defaults",
241 "releasetools_img_from_target_files_defaults",
242 ],
243}
244
245python_library_host {
246 name: "releasetools_ota_from_target_files",
247 defaults: [
248 "releasetools_library_defaults",
249 "releasetools_ota_from_target_files_defaults",
250 ],
251}
252
253python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700254 name: "releasetools_verity_utils",
255 defaults: ["releasetools_library_defaults"],
256 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700257 "verity_utils.py",
258 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700259 required: [
260 "append2simg",
261 "build_verity_metadata",
262 "build_verity_tree",
263 "fec",
264 ],
265}
266
Tao Bao3c7b2a62019-08-07 12:24:20 -0700267//
268// Host binaries.
269//
270
Tao Bao2bbb07c2019-05-07 13:12:21 -0700271python_defaults {
272 name: "releasetools_binary_defaults",
273 version: {
274 py2: {
275 enabled: true,
276 embedded_launcher: true,
277 },
278 py3: {
279 enabled: false,
280 embedded_launcher: false,
281 },
282 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900283 // TODO (b/140144201) Build imgdiff from releasetools_common
284 required: [
285 "aapt2",
286 "boot_signer",
287 "brotli",
288 "bsdiff",
Mohammad Samiul Islamf4909b42021-02-01 20:43:41 +0000289 "deapexer",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900290 "imgdiff",
291 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000292 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900293 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000294 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800295 "toybox",
296 "unpack_bootimg",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900297 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700298}
299
300python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700301 name: "add_img_to_target_files",
302 defaults: [
303 "releasetools_binary_defaults",
304 "releasetools_add_img_to_target_files_defaults",
305 ],
306}
307
308python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700309 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700310 defaults: [
311 "releasetools_binary_defaults",
312 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700313 ],
314}
315
316python_binary_host {
317 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700318 defaults: [
319 "releasetools_binary_defaults",
320 "releasetools_build_super_image_defaults",
321 ],
322}
323
324python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000325 name: "check_partition_sizes",
326 srcs: [
327 "check_partition_sizes.py",
328 ],
329 libs: [
330 "releasetools_common",
331 ],
332 defaults: [
333 "releasetools_binary_defaults",
334 ],
335}
336
337python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700338 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700339 defaults: ["releasetools_binary_defaults"],
340 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700341 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700342 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700343 libs: [
344 "releasetools_common",
345 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700346 required: [
347 "delta_generator",
348 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000349 target: {
350 darwin: {
351 // required module "delta_generator" is disabled on darwin
352 enabled: false,
353 },
354 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700355}
356
357python_binary_host {
358 name: "check_target_files_signatures",
359 defaults: ["releasetools_binary_defaults"],
360 srcs: [
361 "check_target_files_signatures.py",
362 ],
363 libs: [
364 "releasetools_common",
365 ],
366 required: [
367 "aapt",
368 ],
369}
370
371python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700372 name: "check_target_files_vintf",
373 defaults: [
374 "releasetools_binary_defaults",
375 "releasetools_check_target_files_vintf_defaults"
376 ],
377}
378
379python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700380 name: "img_from_target_files",
381 defaults: [
382 "releasetools_binary_defaults",
383 "releasetools_img_from_target_files_defaults",
384 ],
Tao Bao30e31142019-04-09 00:12:30 -0700385}
386
Daniel Normanb8d52a22020-10-26 17:55:00 -0700387python_defaults {
388 name: "releasetools_find_shareduid_violation_defaults",
389 srcs: [
390 "find_shareduid_violation.py",
391 ],
392 libs: [
393 "releasetools_common",
394 ],
395}
396
397python_binary_host {
398 name: "find_shareduid_violation",
399 defaults: [
400 "releasetools_binary_defaults",
401 "releasetools_find_shareduid_violation_defaults",
402 ],
403}
404
405python_library_host {
406 name: "releasetools_find_shareduid_violation",
407 defaults: [
408 "releasetools_find_shareduid_violation_defaults",
409 "releasetools_library_defaults",
410 ],
411}
412
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700413python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700414 name: "make_recovery_patch",
415 defaults: ["releasetools_binary_defaults"],
416 srcs: [
417 "make_recovery_patch.py",
418 ],
419 libs: [
420 "releasetools_common",
421 ],
422}
423
424python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700425 name: "merge_builds",
426 defaults: ["releasetools_binary_defaults"],
427 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700428 "merge_builds.py",
429 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700430 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700431 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700432 "releasetools_common",
433 ],
434}
435
Tao Bao8821d642019-08-05 12:05:45 -0700436python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700437 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700438 defaults: ["releasetools_binary_defaults"],
439 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700440 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700441 ],
442 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700443 "releasetools_add_img_to_target_files",
444 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700445 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700446 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700447 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700448 "releasetools_img_from_target_files",
449 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700450 ],
Yifan Hong09298552019-09-04 11:49:01 -0700451 required: [
452 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800453 "host_init_verifier",
Daniel Norman48603ff2021-02-22 15:15:24 -0800454 "secilc",
Yifan Hong09298552019-09-04 11:49:01 -0700455 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000456 target: {
457 darwin: {
458 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
459 enabled: false,
460 },
461 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700462}
463
464python_binary_host {
465 name: "ota_from_target_files",
466 defaults: [
467 "releasetools_binary_defaults",
468 "releasetools_ota_from_target_files_defaults",
469 ],
470}
471
472python_binary_host {
473 name: "ota_package_parser",
474 defaults: ["releasetools_binary_defaults"],
475 srcs: [
476 "ota_package_parser.py",
477 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700478 ],
479}
480
Tao Baoe11a4602019-08-06 23:21:23 -0700481python_binary_host {
482 name: "sparse_img",
483 defaults: ["releasetools_binary_defaults"],
484 srcs: [
485 "rangelib.py",
486 "sparse_img.py",
487 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700488}
489
Tao Bao3c7b2a62019-08-07 12:24:20 -0700490python_binary_host {
491 name: "sign_apex",
492 defaults: ["releasetools_binary_defaults"],
493 srcs: [
494 "sign_apex.py",
495 ],
496 libs: [
497 "releasetools_apex_utils",
498 "releasetools_common",
499 ],
500}
501
502python_binary_host {
503 name: "sign_target_files_apks",
504 defaults: ["releasetools_binary_defaults"],
505 srcs: [
506 "sign_target_files_apks.py",
507 ],
508 libs: [
509 "releasetools_add_img_to_target_files",
510 "releasetools_apex_utils",
511 "releasetools_common",
512 ],
513}
514
515python_binary_host {
516 name: "validate_target_files",
517 defaults: ["releasetools_binary_defaults"],
518 srcs: [
519 "validate_target_files.py",
520 ],
521 libs: [
522 "releasetools_common",
523 ],
524}
525
526//
527// Tests.
528//
529
Tao Baoca82fc92019-05-01 21:58:03 -0700530python_defaults {
531 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700532 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700533 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000534 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700535 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700536 "make_recovery_patch.py",
537 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700538 "ota_package_parser.py",
539 "sign_apex.py",
540 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700541 "validate_target_files.py",
542
Tao Bao30e31142019-04-09 00:12:30 -0700543 "test_*.py",
544 ],
545 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700546 "releasetools_add_img_to_target_files",
547 "releasetools_apex_utils",
548 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700549 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700550 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700551 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700552 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700553 "releasetools_img_from_target_files",
554 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700555 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700556 ],
557 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700558 "testdata/**/*",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000559 ":com.android.apex.compressed.v1",
560 ":com.android.apex.compressed.v1_original",
Tao Bao30e31142019-04-09 00:12:30 -0700561 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000562 target: {
563 darwin: {
564 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
565 enabled: false,
566 },
567 },
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000568 required: [
569 "deapexer",
570 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700571}
572
573python_test_host {
574 name: "releasetools_test",
575 defaults: ["releasetools_test_defaults"],
576 main: "test_utils.py",
577 version: {
578 py2: {
579 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700580 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
581 // host, because the test executable won't be able to find the needed libs via its
582 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700583 embedded_launcher: false,
584 },
585 py3: {
586 enabled: false,
587 embedded_launcher: false,
588 },
589 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800590 test_options: {
591 unit_test: true,
592 },
Tao Baoca82fc92019-05-01 21:58:03 -0700593}
594
595python_test_host {
596 name: "releasetools_py3_test",
597 defaults: ["releasetools_test_defaults"],
598 main: "test_utils.py",
Kelvin Zhang553efca2021-02-01 17:25:41 -0500599 test_suites: ["general-tests"],
Tao Baoca82fc92019-05-01 21:58:03 -0700600 version: {
601 py2: {
602 enabled: false,
603 embedded_launcher: false,
604 },
605 py3: {
606 enabled: true,
607 embedded_launcher: false,
608 },
609 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800610 test_options: {
611 unit_test: true,
612 },
Tao Bao30e31142019-04-09 00:12:30 -0700613}