blob: 45e05142be256ec7ebd29634f93f34cbd457890f [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",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700128 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000129 target: {
130 darwin: {
131 // required module "brillo_update_payload" is disabled on darwin
132 enabled: false,
133 },
134 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700135}
136
137//
138// Host libraries.
139//
140
Tao Bao30e31142019-04-09 00:12:30 -0700141python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700142 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700143 version: {
144 py2: {
145 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700146 },
147 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700148 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700149 },
150 },
151}
152
153python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700154 name: "releasetools_add_img_to_target_files",
155 defaults: [
156 "releasetools_library_defaults",
157 "releasetools_add_img_to_target_files_defaults",
158 ],
159}
160
161python_library_host {
162 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700163 defaults: ["releasetools_library_defaults"],
164 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700165 "apex_utils.py",
166 ],
167 libs: [
168 "releasetools_common",
169 ],
170}
171
172python_library_host {
173 name: "releasetools_build_image",
174 defaults: [
175 "releasetools_library_defaults",
176 "releasetools_build_image_defaults",
177 ],
178}
179
180python_library_host {
181 name: "releasetools_build_super_image",
182 defaults: [
183 "releasetools_library_defaults",
184 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700185 ],
186}
187
188python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700189 name: "releasetools_check_target_files_vintf",
190 defaults: [
191 "releasetools_library_defaults",
192 "releasetools_check_target_files_vintf_defaults",
193 ],
194}
195
196python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700197 name: "releasetools_common",
198 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700199 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700200 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700201 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700202 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700203 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700204 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700205 ],
206 // Only the tools that are referenced directly are listed as required modules. For example,
207 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
208 required: [
changho.shin0f125362019-07-08 10:59:00 +0900209 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700210 "boot_signer",
211 "brotli",
212 "bsdiff",
213 "imgdiff",
214 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000215 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700216 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100217 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700218 ],
219}
220
221python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700222 name: "releasetools_img_from_target_files",
223 defaults: [
224 "releasetools_library_defaults",
225 "releasetools_img_from_target_files_defaults",
226 ],
227}
228
229python_library_host {
230 name: "releasetools_ota_from_target_files",
231 defaults: [
232 "releasetools_library_defaults",
233 "releasetools_ota_from_target_files_defaults",
234 ],
235}
236
237python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700238 name: "releasetools_verity_utils",
239 defaults: ["releasetools_library_defaults"],
240 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700241 "verity_utils.py",
242 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700243 required: [
244 "append2simg",
245 "build_verity_metadata",
246 "build_verity_tree",
247 "fec",
248 ],
249}
250
Tao Bao3c7b2a62019-08-07 12:24:20 -0700251//
252// Host binaries.
253//
254
Tao Bao2bbb07c2019-05-07 13:12:21 -0700255python_defaults {
256 name: "releasetools_binary_defaults",
257 version: {
258 py2: {
259 enabled: true,
260 embedded_launcher: true,
261 },
262 py3: {
263 enabled: false,
264 embedded_launcher: false,
265 },
266 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900267 // TODO (b/140144201) Build imgdiff from releasetools_common
268 required: [
269 "aapt2",
270 "boot_signer",
271 "brotli",
272 "bsdiff",
273 "imgdiff",
274 "minigzip",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000275 "lz4",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900276 "mkbootfs",
Luca Stefanie0fc4ca2020-09-12 06:08:16 +0000277 "signapk",
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900278 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700279}
280
281python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700282 name: "add_img_to_target_files",
283 defaults: [
284 "releasetools_binary_defaults",
285 "releasetools_add_img_to_target_files_defaults",
286 ],
287}
288
289python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700290 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700291 defaults: [
292 "releasetools_binary_defaults",
293 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700294 ],
295}
296
297python_binary_host {
298 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700299 defaults: [
300 "releasetools_binary_defaults",
301 "releasetools_build_super_image_defaults",
302 ],
303}
304
305python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000306 name: "check_partition_sizes",
307 srcs: [
308 "check_partition_sizes.py",
309 ],
310 libs: [
311 "releasetools_common",
312 ],
313 defaults: [
314 "releasetools_binary_defaults",
315 ],
316}
317
318python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700319 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700320 defaults: ["releasetools_binary_defaults"],
321 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700322 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700323 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700324 libs: [
325 "releasetools_common",
326 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700327 required: [
328 "delta_generator",
329 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000330 target: {
331 darwin: {
332 // required module "delta_generator" is disabled on darwin
333 enabled: false,
334 },
335 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700336}
337
338python_binary_host {
339 name: "check_target_files_signatures",
340 defaults: ["releasetools_binary_defaults"],
341 srcs: [
342 "check_target_files_signatures.py",
343 ],
344 libs: [
345 "releasetools_common",
346 ],
347 required: [
348 "aapt",
349 ],
350}
351
352python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700353 name: "check_target_files_vintf",
354 defaults: [
355 "releasetools_binary_defaults",
356 "releasetools_check_target_files_vintf_defaults"
357 ],
358}
359
360python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700361 name: "img_from_target_files",
362 defaults: [
363 "releasetools_binary_defaults",
364 "releasetools_img_from_target_files_defaults",
365 ],
Tao Bao30e31142019-04-09 00:12:30 -0700366}
367
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700368python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700369 name: "make_recovery_patch",
370 defaults: ["releasetools_binary_defaults"],
371 srcs: [
372 "make_recovery_patch.py",
373 ],
374 libs: [
375 "releasetools_common",
376 ],
377}
378
379python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700380 name: "merge_builds",
381 defaults: ["releasetools_binary_defaults"],
382 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700383 "merge_builds.py",
384 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700385 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700386 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700387 "releasetools_common",
388 ],
389}
390
Tao Bao8821d642019-08-05 12:05:45 -0700391python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700392 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700393 defaults: ["releasetools_binary_defaults"],
394 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700395 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700396 ],
397 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700398 "releasetools_add_img_to_target_files",
399 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700400 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700401 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700402 "releasetools_img_from_target_files",
403 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700404 ],
Yifan Hong09298552019-09-04 11:49:01 -0700405 required: [
406 "checkvintf",
407 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000408 target: {
409 darwin: {
410 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
411 enabled: false,
412 },
413 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700414}
415
416python_binary_host {
417 name: "ota_from_target_files",
418 defaults: [
419 "releasetools_binary_defaults",
420 "releasetools_ota_from_target_files_defaults",
421 ],
422}
423
424python_binary_host {
425 name: "ota_package_parser",
426 defaults: ["releasetools_binary_defaults"],
427 srcs: [
428 "ota_package_parser.py",
429 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700430 ],
431}
432
Tao Baoe11a4602019-08-06 23:21:23 -0700433python_binary_host {
434 name: "sparse_img",
435 defaults: ["releasetools_binary_defaults"],
436 srcs: [
437 "rangelib.py",
438 "sparse_img.py",
439 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700440}
441
Tao Bao3c7b2a62019-08-07 12:24:20 -0700442python_binary_host {
443 name: "sign_apex",
444 defaults: ["releasetools_binary_defaults"],
445 srcs: [
446 "sign_apex.py",
447 ],
448 libs: [
449 "releasetools_apex_utils",
450 "releasetools_common",
451 ],
452}
453
454python_binary_host {
455 name: "sign_target_files_apks",
456 defaults: ["releasetools_binary_defaults"],
457 srcs: [
458 "sign_target_files_apks.py",
459 ],
460 libs: [
461 "releasetools_add_img_to_target_files",
462 "releasetools_apex_utils",
463 "releasetools_common",
464 ],
465}
466
467python_binary_host {
468 name: "validate_target_files",
469 defaults: ["releasetools_binary_defaults"],
470 srcs: [
471 "validate_target_files.py",
472 ],
473 libs: [
474 "releasetools_common",
475 ],
476}
477
478//
479// Tests.
480//
481
Tao Baoca82fc92019-05-01 21:58:03 -0700482python_defaults {
483 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700484 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700485 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000486 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700487 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700488 "make_recovery_patch.py",
489 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700490 "ota_package_parser.py",
491 "sign_apex.py",
492 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700493 "validate_target_files.py",
494
Tao Bao30e31142019-04-09 00:12:30 -0700495 "test_*.py",
496 ],
497 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700498 "releasetools_add_img_to_target_files",
499 "releasetools_apex_utils",
500 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700501 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700502 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700503 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700504 "releasetools_img_from_target_files",
505 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700506 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700507 ],
508 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700509 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700510 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000511 target: {
512 darwin: {
513 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
514 enabled: false,
515 },
516 },
Tao Baoca82fc92019-05-01 21:58:03 -0700517}
518
519python_test_host {
520 name: "releasetools_test",
521 defaults: ["releasetools_test_defaults"],
522 main: "test_utils.py",
523 version: {
524 py2: {
525 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700526 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
527 // host, because the test executable won't be able to find the needed libs via its
528 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700529 embedded_launcher: false,
530 },
531 py3: {
532 enabled: false,
533 embedded_launcher: false,
534 },
535 },
536 test_suites: ["general-tests"],
537}
538
539python_test_host {
540 name: "releasetools_py3_test",
541 defaults: ["releasetools_test_defaults"],
542 main: "test_utils.py",
543 version: {
544 py2: {
545 enabled: false,
546 embedded_launcher: false,
547 },
548 py3: {
549 enabled: true,
550 embedded_launcher: false,
551 },
552 },
Tao Bao30e31142019-04-09 00:12:30 -0700553 test_suites: ["general-tests"],
554}