blob: 60378b88b9ef3711509b6436d8fe68f4a3bb82cc [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",
285 "imgdiff",
286 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000287 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900288 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000289 "signapk",
Yifan Hong14a87122021-01-12 13:26:25 -0800290 "toybox",
291 "unpack_bootimg",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900292 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700293}
294
295python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700296 name: "add_img_to_target_files",
297 defaults: [
298 "releasetools_binary_defaults",
299 "releasetools_add_img_to_target_files_defaults",
300 ],
301}
302
303python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700304 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700305 defaults: [
306 "releasetools_binary_defaults",
307 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700308 ],
309}
310
311python_binary_host {
312 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700313 defaults: [
314 "releasetools_binary_defaults",
315 "releasetools_build_super_image_defaults",
316 ],
317}
318
319python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000320 name: "check_partition_sizes",
321 srcs: [
322 "check_partition_sizes.py",
323 ],
324 libs: [
325 "releasetools_common",
326 ],
327 defaults: [
328 "releasetools_binary_defaults",
329 ],
330}
331
332python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700333 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700334 defaults: ["releasetools_binary_defaults"],
335 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700336 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700337 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700338 libs: [
339 "releasetools_common",
340 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700341 required: [
342 "delta_generator",
343 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000344 target: {
345 darwin: {
346 // required module "delta_generator" is disabled on darwin
347 enabled: false,
348 },
349 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700350}
351
352python_binary_host {
353 name: "check_target_files_signatures",
354 defaults: ["releasetools_binary_defaults"],
355 srcs: [
356 "check_target_files_signatures.py",
357 ],
358 libs: [
359 "releasetools_common",
360 ],
361 required: [
362 "aapt",
363 ],
364}
365
366python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700367 name: "check_target_files_vintf",
368 defaults: [
369 "releasetools_binary_defaults",
370 "releasetools_check_target_files_vintf_defaults"
371 ],
372}
373
374python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700375 name: "img_from_target_files",
376 defaults: [
377 "releasetools_binary_defaults",
378 "releasetools_img_from_target_files_defaults",
379 ],
Tao Bao30e31142019-04-09 00:12:30 -0700380}
381
Daniel Normanb8d52a22020-10-26 17:55:00 -0700382python_defaults {
383 name: "releasetools_find_shareduid_violation_defaults",
384 srcs: [
385 "find_shareduid_violation.py",
386 ],
387 libs: [
388 "releasetools_common",
389 ],
390}
391
392python_binary_host {
393 name: "find_shareduid_violation",
394 defaults: [
395 "releasetools_binary_defaults",
396 "releasetools_find_shareduid_violation_defaults",
397 ],
398}
399
400python_library_host {
401 name: "releasetools_find_shareduid_violation",
402 defaults: [
403 "releasetools_find_shareduid_violation_defaults",
404 "releasetools_library_defaults",
405 ],
406}
407
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700408python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700409 name: "make_recovery_patch",
410 defaults: ["releasetools_binary_defaults"],
411 srcs: [
412 "make_recovery_patch.py",
413 ],
414 libs: [
415 "releasetools_common",
416 ],
417}
418
419python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700420 name: "merge_builds",
421 defaults: ["releasetools_binary_defaults"],
422 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700423 "merge_builds.py",
424 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700425 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700426 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700427 "releasetools_common",
428 ],
429}
430
Tao Bao8821d642019-08-05 12:05:45 -0700431python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700432 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700433 defaults: ["releasetools_binary_defaults"],
434 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700435 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700436 ],
437 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700438 "releasetools_add_img_to_target_files",
439 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700440 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700441 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700442 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700443 "releasetools_img_from_target_files",
444 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700445 ],
Yifan Hong09298552019-09-04 11:49:01 -0700446 required: [
447 "checkvintf",
Daniel Norman21c34f72020-11-11 17:25:50 -0800448 "host_init_verifier",
Yifan Hong09298552019-09-04 11:49:01 -0700449 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000450 target: {
451 darwin: {
452 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
453 enabled: false,
454 },
455 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700456}
457
458python_binary_host {
459 name: "ota_from_target_files",
460 defaults: [
461 "releasetools_binary_defaults",
462 "releasetools_ota_from_target_files_defaults",
463 ],
464}
465
466python_binary_host {
467 name: "ota_package_parser",
468 defaults: ["releasetools_binary_defaults"],
469 srcs: [
470 "ota_package_parser.py",
471 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700472 ],
473}
474
Tao Baoe11a4602019-08-06 23:21:23 -0700475python_binary_host {
476 name: "sparse_img",
477 defaults: ["releasetools_binary_defaults"],
478 srcs: [
479 "rangelib.py",
480 "sparse_img.py",
481 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700482}
483
Tao Bao3c7b2a62019-08-07 12:24:20 -0700484python_binary_host {
485 name: "sign_apex",
486 defaults: ["releasetools_binary_defaults"],
487 srcs: [
488 "sign_apex.py",
489 ],
490 libs: [
491 "releasetools_apex_utils",
492 "releasetools_common",
493 ],
494}
495
496python_binary_host {
497 name: "sign_target_files_apks",
498 defaults: ["releasetools_binary_defaults"],
499 srcs: [
500 "sign_target_files_apks.py",
501 ],
502 libs: [
503 "releasetools_add_img_to_target_files",
504 "releasetools_apex_utils",
505 "releasetools_common",
506 ],
507}
508
509python_binary_host {
510 name: "validate_target_files",
511 defaults: ["releasetools_binary_defaults"],
512 srcs: [
513 "validate_target_files.py",
514 ],
515 libs: [
516 "releasetools_common",
517 ],
518}
519
520//
521// Tests.
522//
523
Tao Baoca82fc92019-05-01 21:58:03 -0700524python_defaults {
525 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700526 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700527 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000528 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700529 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700530 "make_recovery_patch.py",
531 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700532 "ota_package_parser.py",
533 "sign_apex.py",
534 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700535 "validate_target_files.py",
536
Tao Bao30e31142019-04-09 00:12:30 -0700537 "test_*.py",
538 ],
539 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700540 "releasetools_add_img_to_target_files",
541 "releasetools_apex_utils",
542 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700543 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700544 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700545 "releasetools_common",
Daniel Normanb8d52a22020-10-26 17:55:00 -0700546 "releasetools_find_shareduid_violation",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700547 "releasetools_img_from_target_files",
548 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700549 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700550 ],
551 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700552 "testdata/**/*",
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000553 ":com.android.apex.compressed.v1",
554 ":com.android.apex.compressed.v1_original",
Tao Bao30e31142019-04-09 00:12:30 -0700555 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000556 target: {
557 darwin: {
558 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
559 enabled: false,
560 },
561 },
Mohammad Samiul Islam9fd58862021-01-06 13:33:25 +0000562 required: [
563 "deapexer",
564 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700565}
566
567python_test_host {
568 name: "releasetools_test",
569 defaults: ["releasetools_test_defaults"],
570 main: "test_utils.py",
Kelvin Zhang553efca2021-02-01 17:25:41 -0500571 test_suites: ["general-tests"],
Tao Baoca82fc92019-05-01 21:58:03 -0700572 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",
Kelvin Zhang553efca2021-02-01 17:25:41 -0500594 test_suites: ["general-tests"],
Tao Baoca82fc92019-05-01 21:58:03 -0700595 version: {
596 py2: {
597 enabled: false,
598 embedded_launcher: false,
599 },
600 py3: {
601 enabled: true,
602 embedded_launcher: false,
603 },
604 },
Julien Desprez6d9e78f2020-12-21 13:56:05 -0800605 test_options: {
606 unit_test: true,
607 },
Tao Bao30e31142019-04-09 00:12:30 -0700608}