blob: ace00acca4ac1933a87588d0442251628e1804aa [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",
52 "simg2img",
53 "tune2fs",
54 ],
55}
56
57python_defaults {
58 name: "releasetools_build_super_image_defaults",
59 srcs: [
60 "build_super_image.py",
61 ],
62 libs: [
63 "releasetools_common",
64 ],
65}
66
67python_defaults {
68 name: "releasetools_img_from_target_files_defaults",
69 srcs: [
70 "img_from_target_files.py",
71 ],
72 libs: [
73 "releasetools_build_super_image",
74 "releasetools_common",
75 ],
76}
77
78python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070079 name: "releasetools_check_target_files_vintf_defaults",
80 srcs: [
81 "check_target_files_vintf.py",
82 ],
83 libs: [
84 "releasetools_common",
85 ],
86 required: [
87 "checkvintf",
88 ],
89}
90
91python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -070092 name: "releasetools_ota_from_target_files_defaults",
93 srcs: [
94 "edify_generator.py",
95 "ota_from_target_files.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -040096 "non_ab_ota.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -070097 "target_files_diff.py",
Kelvin Zhangcff4d762020-07-29 16:37:51 -040098 "ota_utils.py",
Tao Bao3c7b2a62019-08-07 12:24:20 -070099 ],
100 libs: [
Yifan Hong9276cf02019-08-21 16:37:04 -0700101 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700102 "releasetools_common",
103 "releasetools_verity_utils",
104 ],
105 required: [
106 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700107 "checkvintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700108 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000109 target: {
110 darwin: {
111 // required module "brillo_update_payload" is disabled on darwin
112 enabled: false,
113 },
114 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700115}
116
117//
118// Host libraries.
119//
120
Tao Bao30e31142019-04-09 00:12:30 -0700121python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700122 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700123 version: {
124 py2: {
125 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700126 },
127 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700128 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700129 },
130 },
131}
132
133python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700134 name: "releasetools_add_img_to_target_files",
135 defaults: [
136 "releasetools_library_defaults",
137 "releasetools_add_img_to_target_files_defaults",
138 ],
139}
140
141python_library_host {
142 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700143 defaults: ["releasetools_library_defaults"],
144 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700145 "apex_utils.py",
146 ],
147 libs: [
148 "releasetools_common",
149 ],
150}
151
152python_library_host {
153 name: "releasetools_build_image",
154 defaults: [
155 "releasetools_library_defaults",
156 "releasetools_build_image_defaults",
157 ],
158}
159
160python_library_host {
161 name: "releasetools_build_super_image",
162 defaults: [
163 "releasetools_library_defaults",
164 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700165 ],
166}
167
168python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700169 name: "releasetools_check_target_files_vintf",
170 defaults: [
171 "releasetools_library_defaults",
172 "releasetools_check_target_files_vintf_defaults",
173 ],
174}
175
176python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700177 name: "releasetools_common",
178 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700179 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700180 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700181 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700182 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700183 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700184 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700185 ],
186 // Only the tools that are referenced directly are listed as required modules. For example,
187 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
188 required: [
changho.shin0f125362019-07-08 10:59:00 +0900189 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700190 "boot_signer",
191 "brotli",
192 "bsdiff",
193 "imgdiff",
194 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000195 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700196 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100197 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700198 ],
199}
200
201python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700202 name: "releasetools_img_from_target_files",
203 defaults: [
204 "releasetools_library_defaults",
205 "releasetools_img_from_target_files_defaults",
206 ],
207}
208
209python_library_host {
210 name: "releasetools_ota_from_target_files",
211 defaults: [
212 "releasetools_library_defaults",
213 "releasetools_ota_from_target_files_defaults",
214 ],
215}
216
217python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700218 name: "releasetools_verity_utils",
219 defaults: ["releasetools_library_defaults"],
220 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700221 "verity_utils.py",
222 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700223 required: [
224 "append2simg",
225 "build_verity_metadata",
226 "build_verity_tree",
227 "fec",
228 ],
229}
230
Tao Bao3c7b2a62019-08-07 12:24:20 -0700231//
232// Host binaries.
233//
234
Tao Bao2bbb07c2019-05-07 13:12:21 -0700235python_defaults {
236 name: "releasetools_binary_defaults",
237 version: {
238 py2: {
239 enabled: true,
240 embedded_launcher: true,
241 },
242 py3: {
243 enabled: false,
244 embedded_launcher: false,
245 },
246 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900247 // TODO (b/140144201) Build imgdiff from releasetools_common
248 required: [
249 "aapt2",
250 "boot_signer",
251 "brotli",
252 "bsdiff",
253 "imgdiff",
254 "minigzip",
255 "mkbootfs",
256 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700257}
258
259python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700260 name: "add_img_to_target_files",
261 defaults: [
262 "releasetools_binary_defaults",
263 "releasetools_add_img_to_target_files_defaults",
264 ],
265}
266
267python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700268 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700269 defaults: [
270 "releasetools_binary_defaults",
271 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700272 ],
273}
274
275python_binary_host {
276 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700277 defaults: [
278 "releasetools_binary_defaults",
279 "releasetools_build_super_image_defaults",
280 ],
281}
282
283python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000284 name: "check_partition_sizes",
285 srcs: [
286 "check_partition_sizes.py",
287 ],
288 libs: [
289 "releasetools_common",
290 ],
291 defaults: [
292 "releasetools_binary_defaults",
293 ],
294}
295
296python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700297 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700298 defaults: ["releasetools_binary_defaults"],
299 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700300 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700301 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700302 libs: [
303 "releasetools_common",
304 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700305 required: [
306 "delta_generator",
307 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000308 target: {
309 darwin: {
310 // required module "delta_generator" is disabled on darwin
311 enabled: false,
312 },
313 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700314}
315
316python_binary_host {
317 name: "check_target_files_signatures",
318 defaults: ["releasetools_binary_defaults"],
319 srcs: [
320 "check_target_files_signatures.py",
321 ],
322 libs: [
323 "releasetools_common",
324 ],
325 required: [
326 "aapt",
327 ],
328}
329
330python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700331 name: "check_target_files_vintf",
332 defaults: [
333 "releasetools_binary_defaults",
334 "releasetools_check_target_files_vintf_defaults"
335 ],
336}
337
338python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700339 name: "img_from_target_files",
340 defaults: [
341 "releasetools_binary_defaults",
342 "releasetools_img_from_target_files_defaults",
343 ],
Tao Bao30e31142019-04-09 00:12:30 -0700344}
345
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700346python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700347 name: "make_recovery_patch",
348 defaults: ["releasetools_binary_defaults"],
349 srcs: [
350 "make_recovery_patch.py",
351 ],
352 libs: [
353 "releasetools_common",
354 ],
355}
356
357python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700358 name: "merge_builds",
359 defaults: ["releasetools_binary_defaults"],
360 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700361 "merge_builds.py",
362 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700363 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700364 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700365 "releasetools_common",
366 ],
367}
368
Tao Bao8821d642019-08-05 12:05:45 -0700369python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700370 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700371 defaults: ["releasetools_binary_defaults"],
372 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700373 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700374 ],
375 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700376 "releasetools_add_img_to_target_files",
377 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700378 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700379 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700380 "releasetools_img_from_target_files",
381 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700382 ],
Yifan Hong09298552019-09-04 11:49:01 -0700383 required: [
384 "checkvintf",
385 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000386 target: {
387 darwin: {
388 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
389 enabled: false,
390 },
391 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700392}
393
394python_binary_host {
395 name: "ota_from_target_files",
396 defaults: [
397 "releasetools_binary_defaults",
398 "releasetools_ota_from_target_files_defaults",
399 ],
400}
401
402python_binary_host {
403 name: "ota_package_parser",
404 defaults: ["releasetools_binary_defaults"],
405 srcs: [
406 "ota_package_parser.py",
407 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700408 ],
409}
410
Tao Baoe11a4602019-08-06 23:21:23 -0700411python_binary_host {
412 name: "sparse_img",
413 defaults: ["releasetools_binary_defaults"],
414 srcs: [
415 "rangelib.py",
416 "sparse_img.py",
417 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700418}
419
Tao Bao3c7b2a62019-08-07 12:24:20 -0700420python_binary_host {
421 name: "sign_apex",
422 defaults: ["releasetools_binary_defaults"],
423 srcs: [
424 "sign_apex.py",
425 ],
426 libs: [
427 "releasetools_apex_utils",
428 "releasetools_common",
429 ],
430}
431
432python_binary_host {
433 name: "sign_target_files_apks",
434 defaults: ["releasetools_binary_defaults"],
435 srcs: [
436 "sign_target_files_apks.py",
437 ],
438 libs: [
439 "releasetools_add_img_to_target_files",
440 "releasetools_apex_utils",
441 "releasetools_common",
442 ],
443}
444
445python_binary_host {
446 name: "validate_target_files",
447 defaults: ["releasetools_binary_defaults"],
448 srcs: [
449 "validate_target_files.py",
450 ],
451 libs: [
452 "releasetools_common",
453 ],
454}
455
456//
457// Tests.
458//
459
Tao Baoca82fc92019-05-01 21:58:03 -0700460python_defaults {
461 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700462 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700463 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000464 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700465 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700466 "make_recovery_patch.py",
467 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700468 "ota_package_parser.py",
469 "sign_apex.py",
470 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700471 "validate_target_files.py",
472
Tao Bao30e31142019-04-09 00:12:30 -0700473 "test_*.py",
474 ],
475 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700476 "releasetools_add_img_to_target_files",
477 "releasetools_apex_utils",
478 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700479 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700480 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700481 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700482 "releasetools_img_from_target_files",
483 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700484 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700485 ],
486 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700487 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700488 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000489 target: {
490 darwin: {
491 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
492 enabled: false,
493 },
494 },
Tao Baoca82fc92019-05-01 21:58:03 -0700495}
496
497python_test_host {
498 name: "releasetools_test",
499 defaults: ["releasetools_test_defaults"],
500 main: "test_utils.py",
501 version: {
502 py2: {
503 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700504 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
505 // host, because the test executable won't be able to find the needed libs via its
506 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700507 embedded_launcher: false,
508 },
509 py3: {
510 enabled: false,
511 embedded_launcher: false,
512 },
513 },
514 test_suites: ["general-tests"],
515}
516
517python_test_host {
518 name: "releasetools_py3_test",
519 defaults: ["releasetools_test_defaults"],
520 main: "test_utils.py",
521 version: {
522 py2: {
523 enabled: false,
524 embedded_launcher: false,
525 },
526 py3: {
527 enabled: true,
528 embedded_launcher: false,
529 },
530 },
Tao Bao30e31142019-04-09 00:12:30 -0700531 test_suites: ["general-tests"],
532}