blob: 7f727fb913e1d1f52c745b884d4dac298a54294f [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",
275 "mkbootfs",
276 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700277}
278
279python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700280 name: "add_img_to_target_files",
281 defaults: [
282 "releasetools_binary_defaults",
283 "releasetools_add_img_to_target_files_defaults",
284 ],
285}
286
287python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700288 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700289 defaults: [
290 "releasetools_binary_defaults",
291 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700292 ],
293}
294
295python_binary_host {
296 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700297 defaults: [
298 "releasetools_binary_defaults",
299 "releasetools_build_super_image_defaults",
300 ],
301}
302
303python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000304 name: "check_partition_sizes",
305 srcs: [
306 "check_partition_sizes.py",
307 ],
308 libs: [
309 "releasetools_common",
310 ],
311 defaults: [
312 "releasetools_binary_defaults",
313 ],
314}
315
316python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700317 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700318 defaults: ["releasetools_binary_defaults"],
319 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700320 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700321 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700322 libs: [
323 "releasetools_common",
324 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700325 required: [
326 "delta_generator",
327 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000328 target: {
329 darwin: {
330 // required module "delta_generator" is disabled on darwin
331 enabled: false,
332 },
333 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700334}
335
336python_binary_host {
337 name: "check_target_files_signatures",
338 defaults: ["releasetools_binary_defaults"],
339 srcs: [
340 "check_target_files_signatures.py",
341 ],
342 libs: [
343 "releasetools_common",
344 ],
345 required: [
346 "aapt",
347 ],
348}
349
350python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700351 name: "check_target_files_vintf",
352 defaults: [
353 "releasetools_binary_defaults",
354 "releasetools_check_target_files_vintf_defaults"
355 ],
356}
357
358python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700359 name: "img_from_target_files",
360 defaults: [
361 "releasetools_binary_defaults",
362 "releasetools_img_from_target_files_defaults",
363 ],
Tao Bao30e31142019-04-09 00:12:30 -0700364}
365
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700366python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700367 name: "make_recovery_patch",
368 defaults: ["releasetools_binary_defaults"],
369 srcs: [
370 "make_recovery_patch.py",
371 ],
372 libs: [
373 "releasetools_common",
374 ],
375}
376
377python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700378 name: "merge_builds",
379 defaults: ["releasetools_binary_defaults"],
380 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700381 "merge_builds.py",
382 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700383 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700384 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700385 "releasetools_common",
386 ],
387}
388
Tao Bao8821d642019-08-05 12:05:45 -0700389python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700390 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700391 defaults: ["releasetools_binary_defaults"],
392 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700393 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700394 ],
395 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700396 "releasetools_add_img_to_target_files",
397 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700398 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700399 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700400 "releasetools_img_from_target_files",
401 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700402 ],
Yifan Hong09298552019-09-04 11:49:01 -0700403 required: [
404 "checkvintf",
405 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000406 target: {
407 darwin: {
408 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
409 enabled: false,
410 },
411 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700412}
413
414python_binary_host {
415 name: "ota_from_target_files",
416 defaults: [
417 "releasetools_binary_defaults",
418 "releasetools_ota_from_target_files_defaults",
419 ],
420}
421
422python_binary_host {
423 name: "ota_package_parser",
424 defaults: ["releasetools_binary_defaults"],
425 srcs: [
426 "ota_package_parser.py",
427 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700428 ],
429}
430
Tao Baoe11a4602019-08-06 23:21:23 -0700431python_binary_host {
432 name: "sparse_img",
433 defaults: ["releasetools_binary_defaults"],
434 srcs: [
435 "rangelib.py",
436 "sparse_img.py",
437 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700438}
439
Tao Bao3c7b2a62019-08-07 12:24:20 -0700440python_binary_host {
441 name: "sign_apex",
442 defaults: ["releasetools_binary_defaults"],
443 srcs: [
444 "sign_apex.py",
445 ],
446 libs: [
447 "releasetools_apex_utils",
448 "releasetools_common",
449 ],
450}
451
452python_binary_host {
453 name: "sign_target_files_apks",
454 defaults: ["releasetools_binary_defaults"],
455 srcs: [
456 "sign_target_files_apks.py",
457 ],
458 libs: [
459 "releasetools_add_img_to_target_files",
460 "releasetools_apex_utils",
461 "releasetools_common",
462 ],
463}
464
465python_binary_host {
466 name: "validate_target_files",
467 defaults: ["releasetools_binary_defaults"],
468 srcs: [
469 "validate_target_files.py",
470 ],
471 libs: [
472 "releasetools_common",
473 ],
474}
475
476//
477// Tests.
478//
479
Tao Baoca82fc92019-05-01 21:58:03 -0700480python_defaults {
481 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700482 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700483 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000484 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700485 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700486 "make_recovery_patch.py",
487 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700488 "ota_package_parser.py",
489 "sign_apex.py",
490 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700491 "validate_target_files.py",
492
Tao Bao30e31142019-04-09 00:12:30 -0700493 "test_*.py",
494 ],
495 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700496 "releasetools_add_img_to_target_files",
497 "releasetools_apex_utils",
498 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700499 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700500 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700501 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700502 "releasetools_img_from_target_files",
503 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700504 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700505 ],
506 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700507 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700508 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000509 target: {
510 darwin: {
511 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
512 enabled: false,
513 },
514 },
Tao Baoca82fc92019-05-01 21:58:03 -0700515}
516
517python_test_host {
518 name: "releasetools_test",
519 defaults: ["releasetools_test_defaults"],
520 main: "test_utils.py",
521 version: {
522 py2: {
523 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700524 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
525 // host, because the test executable won't be able to find the needed libs via its
526 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700527 embedded_launcher: false,
528 },
529 py3: {
530 enabled: false,
531 embedded_launcher: false,
532 },
533 },
534 test_suites: ["general-tests"],
535}
536
537python_test_host {
538 name: "releasetools_py3_test",
539 defaults: ["releasetools_test_defaults"],
540 main: "test_utils.py",
541 version: {
542 py2: {
543 enabled: false,
544 embedded_launcher: false,
545 },
546 py3: {
547 enabled: true,
548 embedded_launcher: false,
549 },
550 },
Tao Bao30e31142019-04-09 00:12:30 -0700551 test_suites: ["general-tests"],
552}