blob: c28c4dc462c44b7e6d5f2da759e36b0d96c3c250 [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",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000125 "apex_manifest",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700126 ],
127 required: [
128 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700129 "checkvintf",
Yifan Hong125d0b62020-09-24 17:07:03 -0700130 "lz4",
131 "toybox",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000132 "unpack_bootimg",
133 "deapexer",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700134 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000135 target: {
136 darwin: {
137 // required module "brillo_update_payload" is disabled on darwin
138 enabled: false,
139 },
140 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700141}
142
143//
144// Host libraries.
145//
146
Tao Bao30e31142019-04-09 00:12:30 -0700147python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700148 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700149 version: {
150 py2: {
151 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700152 },
153 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700154 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700155 },
156 },
157}
158
159python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700160 name: "releasetools_add_img_to_target_files",
161 defaults: [
162 "releasetools_library_defaults",
163 "releasetools_add_img_to_target_files_defaults",
164 ],
165}
166
167python_library_host {
168 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700169 defaults: ["releasetools_library_defaults"],
170 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700171 "apex_utils.py",
172 ],
173 libs: [
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000174 "apex_manifest",
175 "ota_metadata_proto",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700176 "releasetools_common",
177 ],
178}
179
180python_library_host {
181 name: "releasetools_build_image",
182 defaults: [
183 "releasetools_library_defaults",
184 "releasetools_build_image_defaults",
185 ],
186}
187
188python_library_host {
189 name: "releasetools_build_super_image",
190 defaults: [
191 "releasetools_library_defaults",
192 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700193 ],
194}
195
196python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700197 name: "releasetools_check_target_files_vintf",
198 defaults: [
199 "releasetools_library_defaults",
200 "releasetools_check_target_files_vintf_defaults",
201 ],
202}
203
204python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700205 name: "releasetools_common",
206 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700207 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700208 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700209 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700210 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700211 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700212 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700213 ],
214 // Only the tools that are referenced directly are listed as required modules. For example,
215 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
216 required: [
changho.shin0f125362019-07-08 10:59:00 +0900217 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700218 "boot_signer",
219 "brotli",
220 "bsdiff",
221 "imgdiff",
222 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000223 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700224 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100225 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800226 "toybox",
227 "unpack_bootimg",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700228 ],
229}
230
231python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700232 name: "releasetools_img_from_target_files",
233 defaults: [
234 "releasetools_library_defaults",
235 "releasetools_img_from_target_files_defaults",
236 ],
237}
238
239python_library_host {
240 name: "releasetools_ota_from_target_files",
241 defaults: [
242 "releasetools_library_defaults",
243 "releasetools_ota_from_target_files_defaults",
244 ],
245}
246
247python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700248 name: "releasetools_verity_utils",
249 defaults: ["releasetools_library_defaults"],
250 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700251 "verity_utils.py",
252 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700253 required: [
254 "append2simg",
255 "build_verity_metadata",
256 "build_verity_tree",
257 "fec",
258 ],
259}
260
Tao Bao3c7b2a62019-08-07 12:24:20 -0700261//
262// Host binaries.
263//
264
Tao Bao2bbb07c2019-05-07 13:12:21 -0700265python_defaults {
266 name: "releasetools_binary_defaults",
267 version: {
268 py2: {
269 enabled: true,
270 embedded_launcher: true,
271 },
272 py3: {
273 enabled: false,
274 embedded_launcher: false,
275 },
276 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900277 // TODO (b/140144201) Build imgdiff from releasetools_common
278 required: [
279 "aapt2",
280 "boot_signer",
281 "brotli",
282 "bsdiff",
283 "imgdiff",
284 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000285 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900286 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000287 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800288 "toybox",
289 "unpack_bootimg",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900290 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700291}
292
293python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700294 name: "add_img_to_target_files",
295 defaults: [
296 "releasetools_binary_defaults",
297 "releasetools_add_img_to_target_files_defaults",
298 ],
299}
300
301python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700302 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700303 defaults: [
304 "releasetools_binary_defaults",
305 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700306 ],
307}
308
309python_binary_host {
310 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700311 defaults: [
312 "releasetools_binary_defaults",
313 "releasetools_build_super_image_defaults",
314 ],
315}
316
317python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000318 name: "check_partition_sizes",
319 srcs: [
320 "check_partition_sizes.py",
321 ],
322 libs: [
323 "releasetools_common",
324 ],
325 defaults: [
326 "releasetools_binary_defaults",
327 ],
328}
329
330python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700331 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700332 defaults: ["releasetools_binary_defaults"],
333 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700334 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700335 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700336 libs: [
337 "releasetools_common",
338 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700339 required: [
340 "delta_generator",
341 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000342 target: {
343 darwin: {
344 // required module "delta_generator" is disabled on darwin
345 enabled: false,
346 },
347 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700348}
349
350python_binary_host {
351 name: "check_target_files_signatures",
352 defaults: ["releasetools_binary_defaults"],
353 srcs: [
354 "check_target_files_signatures.py",
355 ],
356 libs: [
357 "releasetools_common",
358 ],
359 required: [
360 "aapt",
361 ],
362}
363
364python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700365 name: "check_target_files_vintf",
366 defaults: [
367 "releasetools_binary_defaults",
368 "releasetools_check_target_files_vintf_defaults"
369 ],
370}
371
372python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700373 name: "img_from_target_files",
374 defaults: [
375 "releasetools_binary_defaults",
376 "releasetools_img_from_target_files_defaults",
377 ],
Tao Bao30e31142019-04-09 00:12:30 -0700378}
379
Daniel Normanb8d52a22020-10-26 17:55:00 -0700380python_defaults {
381 name: "releasetools_find_shareduid_violation_defaults",
382 srcs: [
383 "find_shareduid_violation.py",
384 ],
385 libs: [
386 "releasetools_common",
387 ],
388}
389
390python_binary_host {
391 name: "find_shareduid_violation",
392 defaults: [
393 "releasetools_binary_defaults",
394 "releasetools_find_shareduid_violation_defaults",
395 ],
396}
397
398python_library_host {
399 name: "releasetools_find_shareduid_violation",
400 defaults: [
401 "releasetools_find_shareduid_violation_defaults",
402 "releasetools_library_defaults",
403 ],
404}
405
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700406python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700407 name: "make_recovery_patch",
408 defaults: ["releasetools_binary_defaults"],
409 srcs: [
410 "make_recovery_patch.py",
411 ],
412 libs: [
413 "releasetools_common",
414 ],
415}
416
417python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700418 name: "merge_builds",
419 defaults: ["releasetools_binary_defaults"],
420 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700421 "merge_builds.py",
422 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700423 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700424 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700425 "releasetools_common",
426 ],
427}
428
Tao Bao8821d642019-08-05 12:05:45 -0700429python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700430 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700431 defaults: ["releasetools_binary_defaults"],
432 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700433 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700434 ],
435 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700436 "releasetools_add_img_to_target_files",
437 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700438 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700439 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700440 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700441 "releasetools_img_from_target_files",
442 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700443 ],
Yifan Hong09298552019-09-04 11:49:01 -0700444 required: [
445 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800446 "host_init_verifier",
Yifan Hong09298552019-09-04 11:49:01 -0700447 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000448 target: {
449 darwin: {
450 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
451 enabled: false,
452 },
453 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700454}
455
456python_binary_host {
457 name: "ota_from_target_files",
458 defaults: [
459 "releasetools_binary_defaults",
460 "releasetools_ota_from_target_files_defaults",
461 ],
462}
463
464python_binary_host {
465 name: "ota_package_parser",
466 defaults: ["releasetools_binary_defaults"],
467 srcs: [
468 "ota_package_parser.py",
469 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700470 ],
471}
472
Tao Baoe11a4602019-08-06 23:21:23 -0700473python_binary_host {
474 name: "sparse_img",
475 defaults: ["releasetools_binary_defaults"],
476 srcs: [
477 "rangelib.py",
478 "sparse_img.py",
479 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700480}
481
Tao Bao3c7b2a62019-08-07 12:24:20 -0700482python_binary_host {
483 name: "sign_apex",
484 defaults: ["releasetools_binary_defaults"],
485 srcs: [
486 "sign_apex.py",
487 ],
488 libs: [
489 "releasetools_apex_utils",
490 "releasetools_common",
491 ],
492}
493
494python_binary_host {
495 name: "sign_target_files_apks",
496 defaults: ["releasetools_binary_defaults"],
497 srcs: [
498 "sign_target_files_apks.py",
499 ],
500 libs: [
501 "releasetools_add_img_to_target_files",
502 "releasetools_apex_utils",
503 "releasetools_common",
504 ],
505}
506
507python_binary_host {
508 name: "validate_target_files",
509 defaults: ["releasetools_binary_defaults"],
510 srcs: [
511 "validate_target_files.py",
512 ],
513 libs: [
514 "releasetools_common",
515 ],
516}
517
518//
519// Tests.
520//
521
Tao Baoca82fc92019-05-01 21:58:03 -0700522python_defaults {
523 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700524 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700525 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000526 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700527 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700528 "make_recovery_patch.py",
529 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700530 "ota_package_parser.py",
531 "sign_apex.py",
532 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700533 "validate_target_files.py",
534
Tao Bao30e31142019-04-09 00:12:30 -0700535 "test_*.py",
536 ],
537 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700538 "releasetools_add_img_to_target_files",
539 "releasetools_apex_utils",
540 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700541 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700542 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700543 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700544 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700545 "releasetools_img_from_target_files",
546 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700547 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700548 ],
549 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700550 "testdata/**/*",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000551 ":com.android.apex.compressed.v1",
552 ":com.android.apex.compressed.v1_original",
Tao Bao30e31142019-04-09 00:12:30 -0700553 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000554 target: {
555 darwin: {
556 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
557 enabled: false,
558 },
559 },
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000560 required: [
561 "deapexer",
562 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700563}
564
565python_test_host {
566 name: "releasetools_test",
567 defaults: ["releasetools_test_defaults"],
568 main: "test_utils.py",
569 version: {
570 py2: {
571 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700572 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
573 // host, because the test executable won't be able to find the needed libs via its
574 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700575 embedded_launcher: false,
576 },
577 py3: {
578 enabled: false,
579 embedded_launcher: false,
580 },
581 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800582 test_options: {
583 unit_test: true,
584 },
Tao Baoca82fc92019-05-01 21:58:03 -0700585}
586
587python_test_host {
588 name: "releasetools_py3_test",
589 defaults: ["releasetools_test_defaults"],
590 main: "test_utils.py",
591 version: {
592 py2: {
593 enabled: false,
594 embedded_launcher: false,
595 },
596 py3: {
597 enabled: true,
598 embedded_launcher: false,
599 },
600 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800601 test_options: {
602 unit_test: true,
603 },
Tao Bao30e31142019-04-09 00:12:30 -0700604}