blob: bca70a9f03d4293346ad71cedec53419523562ae [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",
Gao Xiang961041a2020-06-17 13:59:16 +080052 "mkerofsimage.sh",
Yifan Hong77023452020-08-25 16:15:16 -070053 "mkuserimg_mke2fs",
Tao Bao3c7b2a62019-08-07 12:24:20 -070054 "simg2img",
55 "tune2fs",
56 ],
57}
58
59python_defaults {
60 name: "releasetools_build_super_image_defaults",
61 srcs: [
62 "build_super_image.py",
63 ],
64 libs: [
65 "releasetools_common",
66 ],
67}
68
69python_defaults {
70 name: "releasetools_img_from_target_files_defaults",
71 srcs: [
72 "img_from_target_files.py",
73 ],
74 libs: [
75 "releasetools_build_super_image",
76 "releasetools_common",
77 ],
78}
79
80python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070081 name: "releasetools_check_target_files_vintf_defaults",
82 srcs: [
83 "check_target_files_vintf.py",
84 ],
85 libs: [
86 "releasetools_common",
87 ],
88 required: [
89 "checkvintf",
90 ],
91}
92
Tianjiea2076132020-08-19 17:25:32 -070093python_library_host {
94 name: "ota_metadata_proto",
95 version: {
96 py2: {
97 enabled: true,
98 },
99 py3: {
100 enabled: true,
101 },
102 },
103 srcs: [
104 "ota_metadata.proto",
105 ],
106 proto: {
107 canonical_path_from_root: false,
108 },
109}
110
Yifan Honge3ba82c2019-08-21 13:29:30 -0700111python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700112 name: "releasetools_ota_from_target_files_defaults",
113 srcs: [
114 "edify_generator.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400115 "non_ab_ota.py",
Tianjiea2076132020-08-19 17:25:32 -0700116 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400117 "ota_utils.py",
Tianjiea2076132020-08-19 17:25:32 -0700118 "target_files_diff.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700119 ],
120 libs: [
Tianjiea2076132020-08-19 17:25:32 -0700121 "ota_metadata_proto",
Yifan Hong9276cf02019-08-21 16:37:04 -0700122 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700123 "releasetools_common",
124 "releasetools_verity_utils",
125 ],
126 required: [
127 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700128 "checkvintf",
Yifan Hong125d0b62020-09-24 17:07:03 -0700129 "lz4",
130 "toybox",
131 "unpack_bootimg"
Tao Bao3c7b2a62019-08-07 12:24:20 -0700132 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000133 target: {
134 darwin: {
135 // required module "brillo_update_payload" is disabled on darwin
136 enabled: false,
137 },
138 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700139}
140
141//
142// Host libraries.
143//
144
Tao Bao30e31142019-04-09 00:12:30 -0700145python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700146 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700147 version: {
148 py2: {
149 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700150 },
151 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700152 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700153 },
154 },
155}
156
157python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700158 name: "releasetools_add_img_to_target_files",
159 defaults: [
160 "releasetools_library_defaults",
161 "releasetools_add_img_to_target_files_defaults",
162 ],
163}
164
165python_library_host {
166 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700167 defaults: ["releasetools_library_defaults"],
168 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700169 "apex_utils.py",
170 ],
171 libs: [
172 "releasetools_common",
173 ],
174}
175
176python_library_host {
177 name: "releasetools_build_image",
178 defaults: [
179 "releasetools_library_defaults",
180 "releasetools_build_image_defaults",
181 ],
182}
183
184python_library_host {
185 name: "releasetools_build_super_image",
186 defaults: [
187 "releasetools_library_defaults",
188 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700189 ],
190}
191
192python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700193 name: "releasetools_check_target_files_vintf",
194 defaults: [
195 "releasetools_library_defaults",
196 "releasetools_check_target_files_vintf_defaults",
197 ],
198}
199
200python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700201 name: "releasetools_common",
202 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700203 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700204 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700205 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700206 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700207 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700208 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700209 ],
210 // Only the tools that are referenced directly are listed as required modules. For example,
211 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
212 required: [
changho.shin0f125362019-07-08 10:59:00 +0900213 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700214 "boot_signer",
215 "brotli",
216 "bsdiff",
217 "imgdiff",
218 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000219 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700220 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100221 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800222 "toybox",
223 "unpack_bootimg",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700224 ],
225}
226
227python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700228 name: "releasetools_img_from_target_files",
229 defaults: [
230 "releasetools_library_defaults",
231 "releasetools_img_from_target_files_defaults",
232 ],
233}
234
235python_library_host {
236 name: "releasetools_ota_from_target_files",
237 defaults: [
238 "releasetools_library_defaults",
239 "releasetools_ota_from_target_files_defaults",
240 ],
241}
242
243python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700244 name: "releasetools_verity_utils",
245 defaults: ["releasetools_library_defaults"],
246 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700247 "verity_utils.py",
248 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700249 required: [
250 "append2simg",
251 "build_verity_metadata",
252 "build_verity_tree",
253 "fec",
254 ],
255}
256
Tao Bao3c7b2a62019-08-07 12:24:20 -0700257//
258// Host binaries.
259//
260
Tao Bao2bbb07c2019-05-07 13:12:21 -0700261python_defaults {
262 name: "releasetools_binary_defaults",
263 version: {
264 py2: {
265 enabled: true,
266 embedded_launcher: true,
267 },
268 py3: {
269 enabled: false,
270 embedded_launcher: false,
271 },
272 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900273 // TODO (b/140144201) Build imgdiff from releasetools_common
274 required: [
275 "aapt2",
276 "boot_signer",
277 "brotli",
278 "bsdiff",
279 "imgdiff",
280 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000281 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900282 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000283 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800284 "toybox",
285 "unpack_bootimg",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900286 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700287}
288
289python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700290 name: "add_img_to_target_files",
291 defaults: [
292 "releasetools_binary_defaults",
293 "releasetools_add_img_to_target_files_defaults",
294 ],
295}
296
297python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700298 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700299 defaults: [
300 "releasetools_binary_defaults",
301 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700302 ],
303}
304
305python_binary_host {
306 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700307 defaults: [
308 "releasetools_binary_defaults",
309 "releasetools_build_super_image_defaults",
310 ],
311}
312
313python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000314 name: "check_partition_sizes",
315 srcs: [
316 "check_partition_sizes.py",
317 ],
318 libs: [
319 "releasetools_common",
320 ],
321 defaults: [
322 "releasetools_binary_defaults",
323 ],
324}
325
326python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700327 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700328 defaults: ["releasetools_binary_defaults"],
329 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700330 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700331 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700332 libs: [
333 "releasetools_common",
334 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700335 required: [
336 "delta_generator",
337 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000338 target: {
339 darwin: {
340 // required module "delta_generator" is disabled on darwin
341 enabled: false,
342 },
343 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700344}
345
346python_binary_host {
347 name: "check_target_files_signatures",
348 defaults: ["releasetools_binary_defaults"],
349 srcs: [
350 "check_target_files_signatures.py",
351 ],
352 libs: [
353 "releasetools_common",
354 ],
355 required: [
356 "aapt",
357 ],
358}
359
360python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700361 name: "check_target_files_vintf",
362 defaults: [
363 "releasetools_binary_defaults",
364 "releasetools_check_target_files_vintf_defaults"
365 ],
366}
367
368python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700369 name: "img_from_target_files",
370 defaults: [
371 "releasetools_binary_defaults",
372 "releasetools_img_from_target_files_defaults",
373 ],
Tao Bao30e31142019-04-09 00:12:30 -0700374}
375
Daniel Normanb8d52a22020-10-26 17:55:00 -0700376python_defaults {
377 name: "releasetools_find_shareduid_violation_defaults",
378 srcs: [
379 "find_shareduid_violation.py",
380 ],
381 libs: [
382 "releasetools_common",
383 ],
384}
385
386python_binary_host {
387 name: "find_shareduid_violation",
388 defaults: [
389 "releasetools_binary_defaults",
390 "releasetools_find_shareduid_violation_defaults",
391 ],
392}
393
394python_library_host {
395 name: "releasetools_find_shareduid_violation",
396 defaults: [
397 "releasetools_find_shareduid_violation_defaults",
398 "releasetools_library_defaults",
399 ],
400}
401
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700402python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700403 name: "make_recovery_patch",
404 defaults: ["releasetools_binary_defaults"],
405 srcs: [
406 "make_recovery_patch.py",
407 ],
408 libs: [
409 "releasetools_common",
410 ],
411}
412
413python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700414 name: "merge_builds",
415 defaults: ["releasetools_binary_defaults"],
416 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700417 "merge_builds.py",
418 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700419 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700420 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700421 "releasetools_common",
422 ],
423}
424
Tao Bao8821d642019-08-05 12:05:45 -0700425python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700426 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700427 defaults: ["releasetools_binary_defaults"],
428 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700429 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700430 ],
431 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700432 "releasetools_add_img_to_target_files",
433 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700434 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700435 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700436 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700437 "releasetools_img_from_target_files",
438 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700439 ],
Yifan Hong09298552019-09-04 11:49:01 -0700440 required: [
441 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800442 "host_init_verifier",
Yifan Hong09298552019-09-04 11:49:01 -0700443 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000444 target: {
445 darwin: {
446 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
447 enabled: false,
448 },
449 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700450}
451
452python_binary_host {
453 name: "ota_from_target_files",
454 defaults: [
455 "releasetools_binary_defaults",
456 "releasetools_ota_from_target_files_defaults",
457 ],
458}
459
460python_binary_host {
461 name: "ota_package_parser",
462 defaults: ["releasetools_binary_defaults"],
463 srcs: [
464 "ota_package_parser.py",
465 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700466 ],
467}
468
Tao Baoe11a4602019-08-06 23:21:23 -0700469python_binary_host {
470 name: "sparse_img",
471 defaults: ["releasetools_binary_defaults"],
472 srcs: [
473 "rangelib.py",
474 "sparse_img.py",
475 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700476}
477
Tao Bao3c7b2a62019-08-07 12:24:20 -0700478python_binary_host {
479 name: "sign_apex",
480 defaults: ["releasetools_binary_defaults"],
481 srcs: [
482 "sign_apex.py",
483 ],
484 libs: [
485 "releasetools_apex_utils",
486 "releasetools_common",
487 ],
488}
489
490python_binary_host {
491 name: "sign_target_files_apks",
492 defaults: ["releasetools_binary_defaults"],
493 srcs: [
494 "sign_target_files_apks.py",
495 ],
496 libs: [
497 "releasetools_add_img_to_target_files",
498 "releasetools_apex_utils",
499 "releasetools_common",
500 ],
501}
502
503python_binary_host {
504 name: "validate_target_files",
505 defaults: ["releasetools_binary_defaults"],
506 srcs: [
507 "validate_target_files.py",
508 ],
509 libs: [
510 "releasetools_common",
511 ],
512}
513
514//
515// Tests.
516//
517
Tao Baoca82fc92019-05-01 21:58:03 -0700518python_defaults {
519 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700520 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700521 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000522 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700523 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700524 "make_recovery_patch.py",
525 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700526 "ota_package_parser.py",
527 "sign_apex.py",
528 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700529 "validate_target_files.py",
530
Tao Bao30e31142019-04-09 00:12:30 -0700531 "test_*.py",
532 ],
533 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700534 "releasetools_add_img_to_target_files",
535 "releasetools_apex_utils",
536 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700537 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700538 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700539 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700540 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700541 "releasetools_img_from_target_files",
542 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700543 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700544 ],
545 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700546 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700547 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000548 target: {
549 darwin: {
550 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
551 enabled: false,
552 },
553 },
Tao Baoca82fc92019-05-01 21:58:03 -0700554}
555
556python_test_host {
557 name: "releasetools_test",
558 defaults: ["releasetools_test_defaults"],
559 main: "test_utils.py",
560 version: {
561 py2: {
562 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700563 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
564 // host, because the test executable won't be able to find the needed libs via its
565 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700566 embedded_launcher: false,
567 },
568 py3: {
569 enabled: false,
570 embedded_launcher: false,
571 },
572 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800573 test_options: {
574 unit_test: true,
575 },
Tao Baoca82fc92019-05-01 21:58:03 -0700576}
577
578python_test_host {
579 name: "releasetools_py3_test",
580 defaults: ["releasetools_test_defaults"],
581 main: "test_utils.py",
582 version: {
583 py2: {
584 enabled: false,
585 embedded_launcher: false,
586 },
587 py3: {
588 enabled: true,
589 embedded_launcher: false,
590 },
591 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800592 test_options: {
593 unit_test: true,
594 },
Tao Bao30e31142019-04-09 00:12:30 -0700595}