blob: e1543e7d14e08c7791dbd51910b45090e14caf5b [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",
Yifan Hong77023452020-08-25 16:15:16 -070052 "mkuserimg_mke2fs",
Tao Bao3c7b2a62019-08-07 12:24:20 -070053 "simg2img",
54 "tune2fs",
55 ],
56}
57
58python_defaults {
59 name: "releasetools_build_super_image_defaults",
60 srcs: [
61 "build_super_image.py",
62 ],
63 libs: [
64 "releasetools_common",
65 ],
66}
67
68python_defaults {
69 name: "releasetools_img_from_target_files_defaults",
70 srcs: [
71 "img_from_target_files.py",
72 ],
73 libs: [
74 "releasetools_build_super_image",
75 "releasetools_common",
76 ],
77}
78
79python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070080 name: "releasetools_check_target_files_vintf_defaults",
81 srcs: [
82 "check_target_files_vintf.py",
83 ],
84 libs: [
85 "releasetools_common",
86 ],
87 required: [
88 "checkvintf",
89 ],
90}
91
Tianjiea2076132020-08-19 17:25:32 -070092python_library_host {
93 name: "ota_metadata_proto",
94 version: {
95 py2: {
96 enabled: true,
97 },
98 py3: {
99 enabled: true,
100 },
101 },
102 srcs: [
103 "ota_metadata.proto",
104 ],
105 proto: {
106 canonical_path_from_root: false,
107 },
108}
109
Yifan Honge3ba82c2019-08-21 13:29:30 -0700110python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700111 name: "releasetools_ota_from_target_files_defaults",
112 srcs: [
113 "edify_generator.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400114 "non_ab_ota.py",
Tianjiea2076132020-08-19 17:25:32 -0700115 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -0400116 "ota_utils.py",
Tianjiea2076132020-08-19 17:25:32 -0700117 "target_files_diff.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700118 ],
119 libs: [
Tianjiea2076132020-08-19 17:25:32 -0700120 "ota_metadata_proto",
Yifan Hong9276cf02019-08-21 16:37:04 -0700121 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700122 "releasetools_common",
123 "releasetools_verity_utils",
124 ],
125 required: [
126 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700127 "checkvintf",
Yifan Hong125d0b62020-09-24 17:07:03 -0700128 "lz4",
129 "toybox",
130 "unpack_bootimg"
Tao Bao3c7b2a62019-08-07 12:24:20 -0700131 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000132 target: {
133 darwin: {
134 // required module "brillo_update_payload" is disabled on darwin
135 enabled: false,
136 },
137 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700138}
139
140//
141// Host libraries.
142//
143
Tao Bao30e31142019-04-09 00:12:30 -0700144python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700145 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700146 version: {
147 py2: {
148 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700149 },
150 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700151 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700152 },
153 },
154}
155
156python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700157 name: "releasetools_add_img_to_target_files",
158 defaults: [
159 "releasetools_library_defaults",
160 "releasetools_add_img_to_target_files_defaults",
161 ],
162}
163
164python_library_host {
165 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700166 defaults: ["releasetools_library_defaults"],
167 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700168 "apex_utils.py",
169 ],
170 libs: [
171 "releasetools_common",
172 ],
173}
174
175python_library_host {
176 name: "releasetools_build_image",
177 defaults: [
178 "releasetools_library_defaults",
179 "releasetools_build_image_defaults",
180 ],
181}
182
183python_library_host {
184 name: "releasetools_build_super_image",
185 defaults: [
186 "releasetools_library_defaults",
187 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700188 ],
189}
190
191python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700192 name: "releasetools_check_target_files_vintf",
193 defaults: [
194 "releasetools_library_defaults",
195 "releasetools_check_target_files_vintf_defaults",
196 ],
197}
198
199python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700200 name: "releasetools_common",
201 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700202 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700203 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700204 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700205 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700206 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700207 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700208 ],
209 // Only the tools that are referenced directly are listed as required modules. For example,
210 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
211 required: [
changho.shin0f125362019-07-08 10:59:00 +0900212 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700213 "boot_signer",
214 "brotli",
215 "bsdiff",
216 "imgdiff",
217 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000218 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700219 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100220 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700221 ],
222}
223
224python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700225 name: "releasetools_img_from_target_files",
226 defaults: [
227 "releasetools_library_defaults",
228 "releasetools_img_from_target_files_defaults",
229 ],
230}
231
232python_library_host {
233 name: "releasetools_ota_from_target_files",
234 defaults: [
235 "releasetools_library_defaults",
236 "releasetools_ota_from_target_files_defaults",
237 ],
238}
239
240python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700241 name: "releasetools_verity_utils",
242 defaults: ["releasetools_library_defaults"],
243 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700244 "verity_utils.py",
245 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700246 required: [
247 "append2simg",
248 "build_verity_metadata",
249 "build_verity_tree",
250 "fec",
251 ],
252}
253
Tao Bao3c7b2a62019-08-07 12:24:20 -0700254//
255// Host binaries.
256//
257
Tao Bao2bbb07c2019-05-07 13:12:21 -0700258python_defaults {
259 name: "releasetools_binary_defaults",
260 version: {
261 py2: {
262 enabled: true,
263 embedded_launcher: true,
264 },
265 py3: {
266 enabled: false,
267 embedded_launcher: false,
268 },
269 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900270 // TODO (b/140144201) Build imgdiff from releasetools_common
271 required: [
272 "aapt2",
273 "boot_signer",
274 "brotli",
275 "bsdiff",
276 "imgdiff",
277 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000278 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900279 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000280 "signapk",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900281 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700282}
283
284python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700285 name: "add_img_to_target_files",
286 defaults: [
287 "releasetools_binary_defaults",
288 "releasetools_add_img_to_target_files_defaults",
289 ],
290}
291
292python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700293 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700294 defaults: [
295 "releasetools_binary_defaults",
296 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700297 ],
298}
299
300python_binary_host {
301 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700302 defaults: [
303 "releasetools_binary_defaults",
304 "releasetools_build_super_image_defaults",
305 ],
306}
307
308python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000309 name: "check_partition_sizes",
310 srcs: [
311 "check_partition_sizes.py",
312 ],
313 libs: [
314 "releasetools_common",
315 ],
316 defaults: [
317 "releasetools_binary_defaults",
318 ],
319}
320
321python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700322 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700323 defaults: ["releasetools_binary_defaults"],
324 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700325 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700326 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700327 libs: [
328 "releasetools_common",
329 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700330 required: [
331 "delta_generator",
332 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000333 target: {
334 darwin: {
335 // required module "delta_generator" is disabled on darwin
336 enabled: false,
337 },
338 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700339}
340
341python_binary_host {
342 name: "check_target_files_signatures",
343 defaults: ["releasetools_binary_defaults"],
344 srcs: [
345 "check_target_files_signatures.py",
346 ],
347 libs: [
348 "releasetools_common",
349 ],
350 required: [
351 "aapt",
352 ],
353}
354
355python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700356 name: "check_target_files_vintf",
357 defaults: [
358 "releasetools_binary_defaults",
359 "releasetools_check_target_files_vintf_defaults"
360 ],
361}
362
363python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700364 name: "img_from_target_files",
365 defaults: [
366 "releasetools_binary_defaults",
367 "releasetools_img_from_target_files_defaults",
368 ],
Tao Bao30e31142019-04-09 00:12:30 -0700369}
370
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700371python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700372 name: "make_recovery_patch",
373 defaults: ["releasetools_binary_defaults"],
374 srcs: [
375 "make_recovery_patch.py",
376 ],
377 libs: [
378 "releasetools_common",
379 ],
380}
381
382python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700383 name: "merge_builds",
384 defaults: ["releasetools_binary_defaults"],
385 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700386 "merge_builds.py",
387 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700388 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700389 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700390 "releasetools_common",
391 ],
392}
393
Tao Bao8821d642019-08-05 12:05:45 -0700394python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700395 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700396 defaults: ["releasetools_binary_defaults"],
397 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700398 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700399 ],
400 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700401 "releasetools_add_img_to_target_files",
402 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700403 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700404 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700405 "releasetools_img_from_target_files",
406 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700407 ],
Yifan Hong09298552019-09-04 11:49:01 -0700408 required: [
409 "checkvintf",
410 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000411 target: {
412 darwin: {
413 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
414 enabled: false,
415 },
416 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700417}
418
419python_binary_host {
420 name: "ota_from_target_files",
421 defaults: [
422 "releasetools_binary_defaults",
423 "releasetools_ota_from_target_files_defaults",
424 ],
425}
426
427python_binary_host {
428 name: "ota_package_parser",
429 defaults: ["releasetools_binary_defaults"],
430 srcs: [
431 "ota_package_parser.py",
432 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700433 ],
434}
435
Tao Baoe11a4602019-08-06 23:21:23 -0700436python_binary_host {
437 name: "sparse_img",
438 defaults: ["releasetools_binary_defaults"],
439 srcs: [
440 "rangelib.py",
441 "sparse_img.py",
442 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700443}
444
Tao Bao3c7b2a62019-08-07 12:24:20 -0700445python_binary_host {
446 name: "sign_apex",
447 defaults: ["releasetools_binary_defaults"],
448 srcs: [
449 "sign_apex.py",
450 ],
451 libs: [
452 "releasetools_apex_utils",
453 "releasetools_common",
454 ],
455}
456
457python_binary_host {
458 name: "sign_target_files_apks",
459 defaults: ["releasetools_binary_defaults"],
460 srcs: [
461 "sign_target_files_apks.py",
462 ],
463 libs: [
464 "releasetools_add_img_to_target_files",
465 "releasetools_apex_utils",
466 "releasetools_common",
467 ],
468}
469
470python_binary_host {
471 name: "validate_target_files",
472 defaults: ["releasetools_binary_defaults"],
473 srcs: [
474 "validate_target_files.py",
475 ],
476 libs: [
477 "releasetools_common",
478 ],
479}
480
481//
482// Tests.
483//
484
Tao Baoca82fc92019-05-01 21:58:03 -0700485python_defaults {
486 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700487 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700488 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000489 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700490 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700491 "make_recovery_patch.py",
492 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700493 "ota_package_parser.py",
494 "sign_apex.py",
495 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700496 "validate_target_files.py",
497
Tao Bao30e31142019-04-09 00:12:30 -0700498 "test_*.py",
499 ],
500 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700501 "releasetools_add_img_to_target_files",
502 "releasetools_apex_utils",
503 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700504 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700505 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700506 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700507 "releasetools_img_from_target_files",
508 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700509 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700510 ],
511 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700512 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700513 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000514 target: {
515 darwin: {
516 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
517 enabled: false,
518 },
519 },
Tao Baoca82fc92019-05-01 21:58:03 -0700520}
521
522python_test_host {
523 name: "releasetools_test",
524 defaults: ["releasetools_test_defaults"],
525 main: "test_utils.py",
526 version: {
527 py2: {
528 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700529 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
530 // host, because the test executable won't be able to find the needed libs via its
531 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700532 embedded_launcher: false,
533 },
534 py3: {
535 enabled: false,
536 embedded_launcher: false,
537 },
538 },
539 test_suites: ["general-tests"],
540}
541
542python_test_host {
543 name: "releasetools_py3_test",
544 defaults: ["releasetools_test_defaults"],
545 main: "test_utils.py",
546 version: {
547 py2: {
548 enabled: false,
549 embedded_launcher: false,
550 },
551 py3: {
552 enabled: true,
553 embedded_launcher: false,
554 },
555 },
Tao Bao30e31142019-04-09 00:12:30 -0700556 test_suites: ["general-tests"],
557}