blob: 21134b6e232f8b8dac8ed491fba78b934b8acf8b [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
92python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -070093 name: "releasetools_ota_from_target_files_defaults",
94 srcs: [
95 "edify_generator.py",
96 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -040097 "non_ab_ota.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -070098 "target_files_diff.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -040099 "ota_utils.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700100 ],
101 libs: [
Yifan Hong9276cf02019-08-21 16:37:04 -0700102 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700103 "releasetools_common",
104 "releasetools_verity_utils",
105 ],
106 required: [
107 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700108 "checkvintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700109 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000110 target: {
111 darwin: {
112 // required module "brillo_update_payload" is disabled on darwin
113 enabled: false,
114 },
115 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700116}
117
118//
119// Host libraries.
120//
121
Tao Bao30e31142019-04-09 00:12:30 -0700122python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700123 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700124 version: {
125 py2: {
126 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700127 },
128 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700129 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700130 },
131 },
132}
133
134python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700135 name: "releasetools_add_img_to_target_files",
136 defaults: [
137 "releasetools_library_defaults",
138 "releasetools_add_img_to_target_files_defaults",
139 ],
140}
141
142python_library_host {
143 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700144 defaults: ["releasetools_library_defaults"],
145 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700146 "apex_utils.py",
147 ],
148 libs: [
149 "releasetools_common",
150 ],
151}
152
153python_library_host {
154 name: "releasetools_build_image",
155 defaults: [
156 "releasetools_library_defaults",
157 "releasetools_build_image_defaults",
158 ],
159}
160
161python_library_host {
162 name: "releasetools_build_super_image",
163 defaults: [
164 "releasetools_library_defaults",
165 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700166 ],
167}
168
169python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700170 name: "releasetools_check_target_files_vintf",
171 defaults: [
172 "releasetools_library_defaults",
173 "releasetools_check_target_files_vintf_defaults",
174 ],
175}
176
177python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700178 name: "releasetools_common",
179 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700180 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700181 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700182 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700183 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700184 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700185 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700186 ],
187 // Only the tools that are referenced directly are listed as required modules. For example,
188 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
189 required: [
changho.shin0f125362019-07-08 10:59:00 +0900190 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700191 "boot_signer",
192 "brotli",
193 "bsdiff",
194 "imgdiff",
195 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000196 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700197 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100198 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700199 ],
200}
201
202python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700203 name: "releasetools_img_from_target_files",
204 defaults: [
205 "releasetools_library_defaults",
206 "releasetools_img_from_target_files_defaults",
207 ],
208}
209
210python_library_host {
211 name: "releasetools_ota_from_target_files",
212 defaults: [
213 "releasetools_library_defaults",
214 "releasetools_ota_from_target_files_defaults",
215 ],
216}
217
218python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700219 name: "releasetools_verity_utils",
220 defaults: ["releasetools_library_defaults"],
221 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700222 "verity_utils.py",
223 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700224 required: [
225 "append2simg",
226 "build_verity_metadata",
227 "build_verity_tree",
228 "fec",
229 ],
230}
231
Tao Bao3c7b2a62019-08-07 12:24:20 -0700232//
233// Host binaries.
234//
235
Tao Bao2bbb07c2019-05-07 13:12:21 -0700236python_defaults {
237 name: "releasetools_binary_defaults",
238 version: {
239 py2: {
240 enabled: true,
241 embedded_launcher: true,
242 },
243 py3: {
244 enabled: false,
245 embedded_launcher: false,
246 },
247 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900248 // TODO (b/140144201) Build imgdiff from releasetools_common
249 required: [
250 "aapt2",
251 "boot_signer",
252 "brotli",
253 "bsdiff",
254 "imgdiff",
255 "minigzip",
256 "mkbootfs",
257 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700258}
259
260python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700261 name: "add_img_to_target_files",
262 defaults: [
263 "releasetools_binary_defaults",
264 "releasetools_add_img_to_target_files_defaults",
265 ],
266}
267
268python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700269 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700270 defaults: [
271 "releasetools_binary_defaults",
272 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700273 ],
274}
275
276python_binary_host {
277 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700278 defaults: [
279 "releasetools_binary_defaults",
280 "releasetools_build_super_image_defaults",
281 ],
282}
283
284python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000285 name: "check_partition_sizes",
286 srcs: [
287 "check_partition_sizes.py",
288 ],
289 libs: [
290 "releasetools_common",
291 ],
292 defaults: [
293 "releasetools_binary_defaults",
294 ],
295}
296
297python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700298 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700299 defaults: ["releasetools_binary_defaults"],
300 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700301 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700302 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700303 libs: [
304 "releasetools_common",
305 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700306 required: [
307 "delta_generator",
308 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000309 target: {
310 darwin: {
311 // required module "delta_generator" is disabled on darwin
312 enabled: false,
313 },
314 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700315}
316
317python_binary_host {
318 name: "check_target_files_signatures",
319 defaults: ["releasetools_binary_defaults"],
320 srcs: [
321 "check_target_files_signatures.py",
322 ],
323 libs: [
324 "releasetools_common",
325 ],
326 required: [
327 "aapt",
328 ],
329}
330
331python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700332 name: "check_target_files_vintf",
333 defaults: [
334 "releasetools_binary_defaults",
335 "releasetools_check_target_files_vintf_defaults"
336 ],
337}
338
339python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700340 name: "img_from_target_files",
341 defaults: [
342 "releasetools_binary_defaults",
343 "releasetools_img_from_target_files_defaults",
344 ],
Tao Bao30e31142019-04-09 00:12:30 -0700345}
346
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700347python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700348 name: "make_recovery_patch",
349 defaults: ["releasetools_binary_defaults"],
350 srcs: [
351 "make_recovery_patch.py",
352 ],
353 libs: [
354 "releasetools_common",
355 ],
356}
357
358python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700359 name: "merge_builds",
360 defaults: ["releasetools_binary_defaults"],
361 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700362 "merge_builds.py",
363 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700364 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700365 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700366 "releasetools_common",
367 ],
368}
369
Tao Bao8821d642019-08-05 12:05:45 -0700370python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700371 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700372 defaults: ["releasetools_binary_defaults"],
373 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700374 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700375 ],
376 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700377 "releasetools_add_img_to_target_files",
378 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700379 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700380 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700381 "releasetools_img_from_target_files",
382 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700383 ],
Yifan Hong09298552019-09-04 11:49:01 -0700384 required: [
385 "checkvintf",
386 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000387 target: {
388 darwin: {
389 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
390 enabled: false,
391 },
392 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700393}
394
395python_binary_host {
396 name: "ota_from_target_files",
397 defaults: [
398 "releasetools_binary_defaults",
399 "releasetools_ota_from_target_files_defaults",
400 ],
401}
402
403python_binary_host {
404 name: "ota_package_parser",
405 defaults: ["releasetools_binary_defaults"],
406 srcs: [
407 "ota_package_parser.py",
408 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700409 ],
410}
411
Tao Baoe11a4602019-08-06 23:21:23 -0700412python_binary_host {
413 name: "sparse_img",
414 defaults: ["releasetools_binary_defaults"],
415 srcs: [
416 "rangelib.py",
417 "sparse_img.py",
418 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700419}
420
Tao Bao3c7b2a62019-08-07 12:24:20 -0700421python_binary_host {
422 name: "sign_apex",
423 defaults: ["releasetools_binary_defaults"],
424 srcs: [
425 "sign_apex.py",
426 ],
427 libs: [
428 "releasetools_apex_utils",
429 "releasetools_common",
430 ],
431}
432
433python_binary_host {
434 name: "sign_target_files_apks",
435 defaults: ["releasetools_binary_defaults"],
436 srcs: [
437 "sign_target_files_apks.py",
438 ],
439 libs: [
440 "releasetools_add_img_to_target_files",
441 "releasetools_apex_utils",
442 "releasetools_common",
443 ],
444}
445
446python_binary_host {
447 name: "validate_target_files",
448 defaults: ["releasetools_binary_defaults"],
449 srcs: [
450 "validate_target_files.py",
451 ],
452 libs: [
453 "releasetools_common",
454 ],
455}
456
457//
458// Tests.
459//
460
Tao Baoca82fc92019-05-01 21:58:03 -0700461python_defaults {
462 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700463 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700464 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000465 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700466 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700467 "make_recovery_patch.py",
468 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700469 "ota_package_parser.py",
470 "sign_apex.py",
471 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700472 "validate_target_files.py",
473
Tao Bao30e31142019-04-09 00:12:30 -0700474 "test_*.py",
475 ],
476 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700477 "releasetools_add_img_to_target_files",
478 "releasetools_apex_utils",
479 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700480 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700481 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700482 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700483 "releasetools_img_from_target_files",
484 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700485 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700486 ],
487 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700488 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700489 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000490 target: {
491 darwin: {
492 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
493 enabled: false,
494 },
495 },
Tao Baoca82fc92019-05-01 21:58:03 -0700496}
497
498python_test_host {
499 name: "releasetools_test",
500 defaults: ["releasetools_test_defaults"],
501 main: "test_utils.py",
502 version: {
503 py2: {
504 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700505 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
506 // host, because the test executable won't be able to find the needed libs via its
507 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700508 embedded_launcher: false,
509 },
510 py3: {
511 enabled: false,
512 embedded_launcher: false,
513 },
514 },
515 test_suites: ["general-tests"],
516}
517
518python_test_host {
519 name: "releasetools_py3_test",
520 defaults: ["releasetools_test_defaults"],
521 main: "test_utils.py",
522 version: {
523 py2: {
524 enabled: false,
525 embedded_launcher: false,
526 },
527 py3: {
528 enabled: true,
529 embedded_launcher: false,
530 },
531 },
Tao Bao30e31142019-04-09 00:12:30 -0700532 test_suites: ["general-tests"],
533}