blob: cafc2bb1fff3e4a2d797203ddf92881d1e21b153 [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",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700222 ],
223}
224
225python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700226 name: "releasetools_img_from_target_files",
227 defaults: [
228 "releasetools_library_defaults",
229 "releasetools_img_from_target_files_defaults",
230 ],
231}
232
233python_library_host {
234 name: "releasetools_ota_from_target_files",
235 defaults: [
236 "releasetools_library_defaults",
237 "releasetools_ota_from_target_files_defaults",
238 ],
239}
240
241python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700242 name: "releasetools_verity_utils",
243 defaults: ["releasetools_library_defaults"],
244 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700245 "verity_utils.py",
246 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700247 required: [
248 "append2simg",
249 "build_verity_metadata",
250 "build_verity_tree",
251 "fec",
252 ],
253}
254
Tao Bao3c7b2a62019-08-07 12:24:20 -0700255//
256// Host binaries.
257//
258
Tao Bao2bbb07c2019-05-07 13:12:21 -0700259python_defaults {
260 name: "releasetools_binary_defaults",
261 version: {
262 py2: {
263 enabled: true,
264 embedded_launcher: true,
265 },
266 py3: {
267 enabled: false,
268 embedded_launcher: false,
269 },
270 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900271 // TODO (b/140144201) Build imgdiff from releasetools_common
272 required: [
273 "aapt2",
274 "boot_signer",
275 "brotli",
276 "bsdiff",
277 "imgdiff",
278 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000279 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900280 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000281 "signapk",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900282 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700283}
284
285python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700286 name: "add_img_to_target_files",
287 defaults: [
288 "releasetools_binary_defaults",
289 "releasetools_add_img_to_target_files_defaults",
290 ],
291}
292
293python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700294 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700295 defaults: [
296 "releasetools_binary_defaults",
297 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700298 ],
299}
300
301python_binary_host {
302 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700303 defaults: [
304 "releasetools_binary_defaults",
305 "releasetools_build_super_image_defaults",
306 ],
307}
308
309python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000310 name: "check_partition_sizes",
311 srcs: [
312 "check_partition_sizes.py",
313 ],
314 libs: [
315 "releasetools_common",
316 ],
317 defaults: [
318 "releasetools_binary_defaults",
319 ],
320}
321
322python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700323 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700324 defaults: ["releasetools_binary_defaults"],
325 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700326 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700327 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700328 libs: [
329 "releasetools_common",
330 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700331 required: [
332 "delta_generator",
333 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000334 target: {
335 darwin: {
336 // required module "delta_generator" is disabled on darwin
337 enabled: false,
338 },
339 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700340}
341
342python_binary_host {
343 name: "check_target_files_signatures",
344 defaults: ["releasetools_binary_defaults"],
345 srcs: [
346 "check_target_files_signatures.py",
347 ],
348 libs: [
349 "releasetools_common",
350 ],
351 required: [
352 "aapt",
353 ],
354}
355
356python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700357 name: "check_target_files_vintf",
358 defaults: [
359 "releasetools_binary_defaults",
360 "releasetools_check_target_files_vintf_defaults"
361 ],
362}
363
364python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700365 name: "img_from_target_files",
366 defaults: [
367 "releasetools_binary_defaults",
368 "releasetools_img_from_target_files_defaults",
369 ],
Tao Bao30e31142019-04-09 00:12:30 -0700370}
371
Daniel Normanb8d52a22020-10-26 17:55:00 -0700372python_defaults {
373 name: "releasetools_find_shareduid_violation_defaults",
374 srcs: [
375 "find_shareduid_violation.py",
376 ],
377 libs: [
378 "releasetools_common",
379 ],
380}
381
382python_binary_host {
383 name: "find_shareduid_violation",
384 defaults: [
385 "releasetools_binary_defaults",
386 "releasetools_find_shareduid_violation_defaults",
387 ],
388}
389
390python_library_host {
391 name: "releasetools_find_shareduid_violation",
392 defaults: [
393 "releasetools_find_shareduid_violation_defaults",
394 "releasetools_library_defaults",
395 ],
396}
397
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700398python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700399 name: "make_recovery_patch",
400 defaults: ["releasetools_binary_defaults"],
401 srcs: [
402 "make_recovery_patch.py",
403 ],
404 libs: [
405 "releasetools_common",
406 ],
407}
408
409python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700410 name: "merge_builds",
411 defaults: ["releasetools_binary_defaults"],
412 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700413 "merge_builds.py",
414 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700415 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700416 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700417 "releasetools_common",
418 ],
419}
420
Tao Bao8821d642019-08-05 12:05:45 -0700421python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700422 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700423 defaults: ["releasetools_binary_defaults"],
424 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700425 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700426 ],
427 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700428 "releasetools_add_img_to_target_files",
429 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700430 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700431 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700432 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700433 "releasetools_img_from_target_files",
434 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700435 ],
Yifan Hong09298552019-09-04 11:49:01 -0700436 required: [
437 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800438 "host_init_verifier",
Yifan Hong09298552019-09-04 11:49:01 -0700439 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000440 target: {
441 darwin: {
442 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
443 enabled: false,
444 },
445 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700446}
447
448python_binary_host {
449 name: "ota_from_target_files",
450 defaults: [
451 "releasetools_binary_defaults",
452 "releasetools_ota_from_target_files_defaults",
453 ],
454}
455
456python_binary_host {
457 name: "ota_package_parser",
458 defaults: ["releasetools_binary_defaults"],
459 srcs: [
460 "ota_package_parser.py",
461 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700462 ],
463}
464
Tao Baoe11a4602019-08-06 23:21:23 -0700465python_binary_host {
466 name: "sparse_img",
467 defaults: ["releasetools_binary_defaults"],
468 srcs: [
469 "rangelib.py",
470 "sparse_img.py",
471 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700472}
473
Tao Bao3c7b2a62019-08-07 12:24:20 -0700474python_binary_host {
475 name: "sign_apex",
476 defaults: ["releasetools_binary_defaults"],
477 srcs: [
478 "sign_apex.py",
479 ],
480 libs: [
481 "releasetools_apex_utils",
482 "releasetools_common",
483 ],
484}
485
486python_binary_host {
487 name: "sign_target_files_apks",
488 defaults: ["releasetools_binary_defaults"],
489 srcs: [
490 "sign_target_files_apks.py",
491 ],
492 libs: [
493 "releasetools_add_img_to_target_files",
494 "releasetools_apex_utils",
495 "releasetools_common",
496 ],
497}
498
499python_binary_host {
500 name: "validate_target_files",
501 defaults: ["releasetools_binary_defaults"],
502 srcs: [
503 "validate_target_files.py",
504 ],
505 libs: [
506 "releasetools_common",
507 ],
508}
509
510//
511// Tests.
512//
513
Tao Baoca82fc92019-05-01 21:58:03 -0700514python_defaults {
515 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700516 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700517 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000518 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700519 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700520 "make_recovery_patch.py",
521 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700522 "ota_package_parser.py",
523 "sign_apex.py",
524 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700525 "validate_target_files.py",
526
Tao Bao30e31142019-04-09 00:12:30 -0700527 "test_*.py",
528 ],
529 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700530 "releasetools_add_img_to_target_files",
531 "releasetools_apex_utils",
532 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700533 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700534 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700535 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700536 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700537 "releasetools_img_from_target_files",
538 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700539 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700540 ],
541 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700542 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700543 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000544 target: {
545 darwin: {
546 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
547 enabled: false,
548 },
549 },
Tao Baoca82fc92019-05-01 21:58:03 -0700550}
551
552python_test_host {
553 name: "releasetools_test",
554 defaults: ["releasetools_test_defaults"],
555 main: "test_utils.py",
556 version: {
557 py2: {
558 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700559 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
560 // host, because the test executable won't be able to find the needed libs via its
561 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700562 embedded_launcher: false,
563 },
564 py3: {
565 enabled: false,
566 embedded_launcher: false,
567 },
568 },
569 test_suites: ["general-tests"],
570}
571
572python_test_host {
573 name: "releasetools_py3_test",
574 defaults: ["releasetools_test_defaults"],
575 main: "test_utils.py",
576 version: {
577 py2: {
578 enabled: false,
579 embedded_launcher: false,
580 },
581 py3: {
582 enabled: true,
583 embedded_launcher: false,
584 },
585 },
Tao Bao30e31142019-04-09 00:12:30 -0700586 test_suites: ["general-tests"],
587}