blob: ccf5bf568b296654aef14a3cc49add67a14ca8bd [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: [
Kelvin Zhang5f0fcee2021-01-19 15:30:46 -050031 "ota_metadata_proto",
32 "releasetools_apex_utils",
Tao Bao3c7b2a62019-08-07 12:24:20 -070033 "releasetools_build_image",
34 "releasetools_build_super_image",
35 "releasetools_common",
36 ],
37 required: [
38 "care_map_generator",
39 ],
40}
41
42python_defaults {
43 name: "releasetools_build_image_defaults",
44 srcs: [
45 "build_image.py",
46 ],
47 libs: [
48 "releasetools_common",
49 "releasetools_verity_utils",
50 ],
51 required: [
52 "blk_alloc_to_base_fs",
53 "e2fsck",
Gao Xiang961041a2020-06-17 13:59:16 +080054 "mkerofsimage.sh",
Yifan Hong77023452020-08-25 16:15:16 -070055 "mkuserimg_mke2fs",
Tao Bao3c7b2a62019-08-07 12:24:20 -070056 "simg2img",
57 "tune2fs",
58 ],
59}
60
61python_defaults {
62 name: "releasetools_build_super_image_defaults",
63 srcs: [
64 "build_super_image.py",
65 ],
66 libs: [
67 "releasetools_common",
68 ],
69}
70
71python_defaults {
72 name: "releasetools_img_from_target_files_defaults",
73 srcs: [
74 "img_from_target_files.py",
75 ],
76 libs: [
77 "releasetools_build_super_image",
78 "releasetools_common",
79 ],
80}
81
82python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070083 name: "releasetools_check_target_files_vintf_defaults",
84 srcs: [
85 "check_target_files_vintf.py",
86 ],
87 libs: [
88 "releasetools_common",
89 ],
90 required: [
91 "checkvintf",
92 ],
93}
94
Tianjiea2076132020-08-19 17:25:32 -070095python_library_host {
96 name: "ota_metadata_proto",
97 version: {
98 py2: {
99 enabled: true,
100 },
101 py3: {
102 enabled: true,
103 },
104 },
105 srcs: [
106 "ota_metadata.proto",
107 ],
108 proto: {
109 canonical_path_from_root: false,
110 },
111}
112
Yifan Honge3ba82c2019-08-21 13:29:30 -0700113python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700114 name: "releasetools_ota_from_target_files_defaults",
115 srcs: [
116 "edify_generator.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400117 "non_ab_ota.py",
Tianjiea2076132020-08-19 17:25:32 -0700118 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400119 "ota_utils.py",
Tianjiea2076132020-08-19 17:25:32 -0700120 "target_files_diff.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700121 ],
122 libs: [
Tianjiea2076132020-08-19 17:25:32 -0700123 "ota_metadata_proto",
Yifan Hong9276cf02019-08-21 16:37:04 -0700124 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700125 "releasetools_common",
126 "releasetools_verity_utils",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000127 "apex_manifest",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700128 ],
129 required: [
130 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700131 "checkvintf",
Yifan Hong125d0b62020-09-24 17:07:03 -0700132 "lz4",
133 "toybox",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000134 "unpack_bootimg",
135 "deapexer",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700136 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000137 target: {
138 darwin: {
139 // required module "brillo_update_payload" is disabled on darwin
140 enabled: false,
141 },
142 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700143}
144
145//
146// Host libraries.
147//
148
Tao Bao30e31142019-04-09 00:12:30 -0700149python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700150 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700151 version: {
152 py2: {
153 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700154 },
155 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700156 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700157 },
158 },
159}
160
161python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700162 name: "releasetools_add_img_to_target_files",
163 defaults: [
164 "releasetools_library_defaults",
165 "releasetools_add_img_to_target_files_defaults",
166 ],
167}
168
169python_library_host {
170 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700171 defaults: ["releasetools_library_defaults"],
172 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700173 "apex_utils.py",
174 ],
175 libs: [
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000176 "apex_manifest",
177 "ota_metadata_proto",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700178 "releasetools_common",
179 ],
180}
181
182python_library_host {
183 name: "releasetools_build_image",
184 defaults: [
185 "releasetools_library_defaults",
186 "releasetools_build_image_defaults",
187 ],
188}
189
190python_library_host {
191 name: "releasetools_build_super_image",
192 defaults: [
193 "releasetools_library_defaults",
194 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700195 ],
196}
197
198python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700199 name: "releasetools_check_target_files_vintf",
200 defaults: [
201 "releasetools_library_defaults",
202 "releasetools_check_target_files_vintf_defaults",
203 ],
204}
205
206python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700207 name: "releasetools_common",
208 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700209 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700210 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700211 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700212 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700213 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700214 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700215 ],
216 // Only the tools that are referenced directly are listed as required modules. For example,
217 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
218 required: [
changho.shin0f125362019-07-08 10:59:00 +0900219 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700220 "boot_signer",
221 "brotli",
222 "bsdiff",
223 "imgdiff",
224 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000225 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700226 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100227 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800228 "toybox",
229 "unpack_bootimg",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700230 ],
231}
232
233python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700234 name: "releasetools_img_from_target_files",
235 defaults: [
236 "releasetools_library_defaults",
237 "releasetools_img_from_target_files_defaults",
238 ],
239}
240
241python_library_host {
242 name: "releasetools_ota_from_target_files",
243 defaults: [
244 "releasetools_library_defaults",
245 "releasetools_ota_from_target_files_defaults",
246 ],
247}
248
249python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700250 name: "releasetools_verity_utils",
251 defaults: ["releasetools_library_defaults"],
252 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700253 "verity_utils.py",
254 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700255 required: [
256 "append2simg",
257 "build_verity_metadata",
258 "build_verity_tree",
259 "fec",
260 ],
261}
262
Tao Bao3c7b2a62019-08-07 12:24:20 -0700263//
264// Host binaries.
265//
266
Tao Bao2bbb07c2019-05-07 13:12:21 -0700267python_defaults {
268 name: "releasetools_binary_defaults",
269 version: {
270 py2: {
271 enabled: true,
272 embedded_launcher: true,
273 },
274 py3: {
275 enabled: false,
276 embedded_launcher: false,
277 },
278 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900279 // TODO (b/140144201) Build imgdiff from releasetools_common
280 required: [
281 "aapt2",
282 "boot_signer",
283 "brotli",
284 "bsdiff",
Mohammad Samiul Islamf4909b42021-02-01 20:43:41 +0000285 "deapexer",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900286 "imgdiff",
287 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000288 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900289 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000290 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800291 "toybox",
292 "unpack_bootimg",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900293 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700294}
295
296python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700297 name: "add_img_to_target_files",
298 defaults: [
299 "releasetools_binary_defaults",
300 "releasetools_add_img_to_target_files_defaults",
301 ],
302}
303
304python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700305 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700306 defaults: [
307 "releasetools_binary_defaults",
308 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700309 ],
310}
311
312python_binary_host {
313 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700314 defaults: [
315 "releasetools_binary_defaults",
316 "releasetools_build_super_image_defaults",
317 ],
318}
319
320python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000321 name: "check_partition_sizes",
322 srcs: [
323 "check_partition_sizes.py",
324 ],
325 libs: [
326 "releasetools_common",
327 ],
328 defaults: [
329 "releasetools_binary_defaults",
330 ],
331}
332
333python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700334 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700335 defaults: ["releasetools_binary_defaults"],
336 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700337 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700338 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700339 libs: [
340 "releasetools_common",
341 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700342 required: [
343 "delta_generator",
344 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000345 target: {
346 darwin: {
347 // required module "delta_generator" is disabled on darwin
348 enabled: false,
349 },
350 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700351}
352
353python_binary_host {
354 name: "check_target_files_signatures",
355 defaults: ["releasetools_binary_defaults"],
356 srcs: [
357 "check_target_files_signatures.py",
358 ],
359 libs: [
360 "releasetools_common",
361 ],
362 required: [
363 "aapt",
364 ],
365}
366
367python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700368 name: "check_target_files_vintf",
369 defaults: [
370 "releasetools_binary_defaults",
371 "releasetools_check_target_files_vintf_defaults"
372 ],
373}
374
375python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700376 name: "img_from_target_files",
377 defaults: [
378 "releasetools_binary_defaults",
379 "releasetools_img_from_target_files_defaults",
380 ],
Tao Bao30e31142019-04-09 00:12:30 -0700381}
382
Daniel Normanb8d52a22020-10-26 17:55:00 -0700383python_defaults {
384 name: "releasetools_find_shareduid_violation_defaults",
385 srcs: [
386 "find_shareduid_violation.py",
387 ],
388 libs: [
389 "releasetools_common",
390 ],
391}
392
393python_binary_host {
394 name: "find_shareduid_violation",
395 defaults: [
396 "releasetools_binary_defaults",
397 "releasetools_find_shareduid_violation_defaults",
398 ],
399}
400
401python_library_host {
402 name: "releasetools_find_shareduid_violation",
403 defaults: [
404 "releasetools_find_shareduid_violation_defaults",
405 "releasetools_library_defaults",
406 ],
407}
408
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700409python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700410 name: "make_recovery_patch",
411 defaults: ["releasetools_binary_defaults"],
412 srcs: [
413 "make_recovery_patch.py",
414 ],
415 libs: [
416 "releasetools_common",
417 ],
418}
419
420python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700421 name: "merge_builds",
422 defaults: ["releasetools_binary_defaults"],
423 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700424 "merge_builds.py",
425 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700426 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700427 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700428 "releasetools_common",
429 ],
430}
431
Tao Bao8821d642019-08-05 12:05:45 -0700432python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700433 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700434 defaults: ["releasetools_binary_defaults"],
435 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700436 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700437 ],
438 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700439 "releasetools_add_img_to_target_files",
440 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700441 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700442 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700443 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700444 "releasetools_img_from_target_files",
445 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700446 ],
Yifan Hong09298552019-09-04 11:49:01 -0700447 required: [
448 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800449 "host_init_verifier",
Yifan Hong09298552019-09-04 11:49:01 -0700450 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000451 target: {
452 darwin: {
453 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
454 enabled: false,
455 },
456 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700457}
458
459python_binary_host {
460 name: "ota_from_target_files",
461 defaults: [
462 "releasetools_binary_defaults",
463 "releasetools_ota_from_target_files_defaults",
464 ],
465}
466
467python_binary_host {
468 name: "ota_package_parser",
469 defaults: ["releasetools_binary_defaults"],
470 srcs: [
471 "ota_package_parser.py",
472 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700473 ],
474}
475
Tao Baoe11a4602019-08-06 23:21:23 -0700476python_binary_host {
477 name: "sparse_img",
478 defaults: ["releasetools_binary_defaults"],
479 srcs: [
480 "rangelib.py",
481 "sparse_img.py",
482 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700483}
484
Tao Bao3c7b2a62019-08-07 12:24:20 -0700485python_binary_host {
486 name: "sign_apex",
487 defaults: ["releasetools_binary_defaults"],
488 srcs: [
489 "sign_apex.py",
490 ],
491 libs: [
492 "releasetools_apex_utils",
493 "releasetools_common",
494 ],
495}
496
497python_binary_host {
498 name: "sign_target_files_apks",
499 defaults: ["releasetools_binary_defaults"],
500 srcs: [
501 "sign_target_files_apks.py",
502 ],
503 libs: [
504 "releasetools_add_img_to_target_files",
505 "releasetools_apex_utils",
506 "releasetools_common",
507 ],
508}
509
510python_binary_host {
511 name: "validate_target_files",
512 defaults: ["releasetools_binary_defaults"],
513 srcs: [
514 "validate_target_files.py",
515 ],
516 libs: [
517 "releasetools_common",
518 ],
519}
520
521//
522// Tests.
523//
524
Tao Baoca82fc92019-05-01 21:58:03 -0700525python_defaults {
526 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700527 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700528 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000529 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700530 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700531 "make_recovery_patch.py",
532 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700533 "ota_package_parser.py",
534 "sign_apex.py",
535 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700536 "validate_target_files.py",
537
Tao Bao30e31142019-04-09 00:12:30 -0700538 "test_*.py",
539 ],
540 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700541 "releasetools_add_img_to_target_files",
542 "releasetools_apex_utils",
543 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700544 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700545 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700546 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700547 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700548 "releasetools_img_from_target_files",
549 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700550 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700551 ],
552 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700553 "testdata/**/*",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000554 ":com.android.apex.compressed.v1",
555 ":com.android.apex.compressed.v1_original",
Tao Bao30e31142019-04-09 00:12:30 -0700556 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000557 target: {
558 darwin: {
559 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
560 enabled: false,
561 },
562 },
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000563 required: [
564 "deapexer",
565 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700566}
567
568python_test_host {
569 name: "releasetools_test",
570 defaults: ["releasetools_test_defaults"],
571 main: "test_utils.py",
572 version: {
573 py2: {
574 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700575 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
576 // host, because the test executable won't be able to find the needed libs via its
577 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700578 embedded_launcher: false,
579 },
580 py3: {
581 enabled: false,
582 embedded_launcher: false,
583 },
584 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800585 test_options: {
586 unit_test: true,
587 },
Tao Baoca82fc92019-05-01 21:58:03 -0700588}
589
590python_test_host {
591 name: "releasetools_py3_test",
592 defaults: ["releasetools_test_defaults"],
593 main: "test_utils.py",
594 version: {
595 py2: {
596 enabled: false,
597 embedded_launcher: false,
598 },
599 py3: {
600 enabled: true,
601 embedded_launcher: false,
602 },
603 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800604 test_options: {
605 unit_test: true,
606 },
Tao Bao30e31142019-04-09 00:12:30 -0700607}