blob: d26678d56ee9851c1120c0c728ece3c8086df64b [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",
96 "target_files_diff.py",
97 ],
98 libs: [
Yifan Hong9276cf02019-08-21 16:37:04 -070099 "releasetools_check_target_files_vintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700100 "releasetools_common",
101 "releasetools_verity_utils",
102 ],
103 required: [
104 "brillo_update_payload",
Yifan Hong09298552019-09-04 11:49:01 -0700105 "checkvintf",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700106 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000107 target: {
108 darwin: {
109 // required module "brillo_update_payload" is disabled on darwin
110 enabled: false,
111 },
112 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700113}
114
115//
116// Host libraries.
117//
118
Tao Bao30e31142019-04-09 00:12:30 -0700119python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700120 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700121 version: {
122 py2: {
123 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700124 },
125 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700126 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700127 },
128 },
129}
130
131python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700132 name: "releasetools_add_img_to_target_files",
133 defaults: [
134 "releasetools_library_defaults",
135 "releasetools_add_img_to_target_files_defaults",
136 ],
137}
138
139python_library_host {
140 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700141 defaults: ["releasetools_library_defaults"],
142 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700143 "apex_utils.py",
144 ],
145 libs: [
146 "releasetools_common",
147 ],
148}
149
150python_library_host {
151 name: "releasetools_build_image",
152 defaults: [
153 "releasetools_library_defaults",
154 "releasetools_build_image_defaults",
155 ],
156}
157
158python_library_host {
159 name: "releasetools_build_super_image",
160 defaults: [
161 "releasetools_library_defaults",
162 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700163 ],
164}
165
166python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700167 name: "releasetools_check_target_files_vintf",
168 defaults: [
169 "releasetools_library_defaults",
170 "releasetools_check_target_files_vintf_defaults",
171 ],
172}
173
174python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700175 name: "releasetools_common",
176 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700177 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700178 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700179 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700180 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700181 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700182 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700183 ],
184 // Only the tools that are referenced directly are listed as required modules. For example,
185 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
186 required: [
changho.shin0f125362019-07-08 10:59:00 +0900187 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700188 "boot_signer",
189 "brotli",
190 "bsdiff",
191 "imgdiff",
192 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000193 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700194 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100195 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700196 ],
197}
198
199python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700200 name: "releasetools_img_from_target_files",
201 defaults: [
202 "releasetools_library_defaults",
203 "releasetools_img_from_target_files_defaults",
204 ],
205}
206
207python_library_host {
208 name: "releasetools_ota_from_target_files",
209 defaults: [
210 "releasetools_library_defaults",
211 "releasetools_ota_from_target_files_defaults",
212 ],
213}
214
215python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700216 name: "releasetools_verity_utils",
217 defaults: ["releasetools_library_defaults"],
218 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700219 "verity_utils.py",
220 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700221 required: [
222 "append2simg",
223 "build_verity_metadata",
224 "build_verity_tree",
225 "fec",
226 ],
227}
228
Tao Bao3c7b2a62019-08-07 12:24:20 -0700229//
230// Host binaries.
231//
232
Tao Bao2bbb07c2019-05-07 13:12:21 -0700233python_defaults {
234 name: "releasetools_binary_defaults",
235 version: {
236 py2: {
237 enabled: true,
238 embedded_launcher: true,
239 },
240 py3: {
241 enabled: false,
242 embedded_launcher: false,
243 },
244 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900245 // TODO (b/140144201) Build imgdiff from releasetools_common
246 required: [
247 "aapt2",
248 "boot_signer",
249 "brotli",
250 "bsdiff",
251 "imgdiff",
252 "minigzip",
253 "mkbootfs",
254 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700255}
256
257python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700258 name: "add_img_to_target_files",
259 defaults: [
260 "releasetools_binary_defaults",
261 "releasetools_add_img_to_target_files_defaults",
262 ],
263}
264
265python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700266 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700267 defaults: [
268 "releasetools_binary_defaults",
269 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700270 ],
271}
272
273python_binary_host {
274 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700275 defaults: [
276 "releasetools_binary_defaults",
277 "releasetools_build_super_image_defaults",
278 ],
279}
280
281python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000282 name: "check_partition_sizes",
283 srcs: [
284 "check_partition_sizes.py",
285 ],
286 libs: [
287 "releasetools_common",
288 ],
289 defaults: [
290 "releasetools_binary_defaults",
291 ],
292}
293
294python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700295 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700296 defaults: ["releasetools_binary_defaults"],
297 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700298 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700299 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700300 libs: [
301 "releasetools_common",
302 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700303 required: [
304 "delta_generator",
305 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000306 target: {
307 darwin: {
308 // required module "delta_generator" is disabled on darwin
309 enabled: false,
310 },
311 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700312}
313
314python_binary_host {
315 name: "check_target_files_signatures",
316 defaults: ["releasetools_binary_defaults"],
317 srcs: [
318 "check_target_files_signatures.py",
319 ],
320 libs: [
321 "releasetools_common",
322 ],
323 required: [
324 "aapt",
325 ],
326}
327
328python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700329 name: "check_target_files_vintf",
330 defaults: [
331 "releasetools_binary_defaults",
332 "releasetools_check_target_files_vintf_defaults"
333 ],
334}
335
336python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700337 name: "img_from_target_files",
338 defaults: [
339 "releasetools_binary_defaults",
340 "releasetools_img_from_target_files_defaults",
341 ],
Tao Bao30e31142019-04-09 00:12:30 -0700342}
343
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700344python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700345 name: "make_recovery_patch",
346 defaults: ["releasetools_binary_defaults"],
347 srcs: [
348 "make_recovery_patch.py",
349 ],
350 libs: [
351 "releasetools_common",
352 ],
353}
354
355python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700356 name: "merge_builds",
357 defaults: ["releasetools_binary_defaults"],
358 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700359 "merge_builds.py",
360 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700361 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700362 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700363 "releasetools_common",
364 ],
365}
366
Tao Bao8821d642019-08-05 12:05:45 -0700367python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700368 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700369 defaults: ["releasetools_binary_defaults"],
370 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700371 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700372 ],
373 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700374 "releasetools_add_img_to_target_files",
375 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700376 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700377 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700378 "releasetools_img_from_target_files",
379 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700380 ],
Yifan Hong09298552019-09-04 11:49:01 -0700381 required: [
382 "checkvintf",
383 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000384 target: {
385 darwin: {
386 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
387 enabled: false,
388 },
389 },
Tao Bao3c7b2a62019-08-07 12:24:20 -0700390}
391
392python_binary_host {
393 name: "ota_from_target_files",
394 defaults: [
395 "releasetools_binary_defaults",
396 "releasetools_ota_from_target_files_defaults",
397 ],
398}
399
400python_binary_host {
401 name: "ota_package_parser",
402 defaults: ["releasetools_binary_defaults"],
403 srcs: [
404 "ota_package_parser.py",
405 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700406 ],
407}
408
Tao Baoe11a4602019-08-06 23:21:23 -0700409python_binary_host {
410 name: "sparse_img",
411 defaults: ["releasetools_binary_defaults"],
412 srcs: [
413 "rangelib.py",
414 "sparse_img.py",
415 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700416}
417
Tao Bao3c7b2a62019-08-07 12:24:20 -0700418python_binary_host {
419 name: "sign_apex",
420 defaults: ["releasetools_binary_defaults"],
421 srcs: [
422 "sign_apex.py",
423 ],
424 libs: [
425 "releasetools_apex_utils",
426 "releasetools_common",
427 ],
428}
429
430python_binary_host {
431 name: "sign_target_files_apks",
432 defaults: ["releasetools_binary_defaults"],
433 srcs: [
434 "sign_target_files_apks.py",
435 ],
436 libs: [
437 "releasetools_add_img_to_target_files",
438 "releasetools_apex_utils",
439 "releasetools_common",
440 ],
441}
442
443python_binary_host {
444 name: "validate_target_files",
445 defaults: ["releasetools_binary_defaults"],
446 srcs: [
447 "validate_target_files.py",
448 ],
449 libs: [
450 "releasetools_common",
451 ],
452}
453
454//
455// Tests.
456//
457
Tao Baoca82fc92019-05-01 21:58:03 -0700458python_defaults {
459 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700460 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700461 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000462 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700463 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700464 "make_recovery_patch.py",
465 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700466 "ota_package_parser.py",
467 "sign_apex.py",
468 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700469 "validate_target_files.py",
470
Tao Bao30e31142019-04-09 00:12:30 -0700471 "test_*.py",
472 ],
473 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700474 "releasetools_add_img_to_target_files",
475 "releasetools_apex_utils",
476 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700477 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700478 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700479 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700480 "releasetools_img_from_target_files",
481 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700482 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700483 ],
484 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700485 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700486 ],
Yo Chiang096c5152020-08-07 04:22:18 +0000487 target: {
488 darwin: {
489 // libs dep "releasetools_ota_from_target_files" is disabled on darwin
490 enabled: false,
491 },
492 },
Tao Baoca82fc92019-05-01 21:58:03 -0700493}
494
495python_test_host {
496 name: "releasetools_test",
497 defaults: ["releasetools_test_defaults"],
498 main: "test_utils.py",
499 version: {
500 py2: {
501 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700502 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
503 // host, because the test executable won't be able to find the needed libs via its
504 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700505 embedded_launcher: false,
506 },
507 py3: {
508 enabled: false,
509 embedded_launcher: false,
510 },
511 },
512 test_suites: ["general-tests"],
513}
514
515python_test_host {
516 name: "releasetools_py3_test",
517 defaults: ["releasetools_test_defaults"],
518 main: "test_utils.py",
519 version: {
520 py2: {
521 enabled: false,
522 embedded_launcher: false,
523 },
524 py3: {
525 enabled: true,
526 embedded_launcher: false,
527 },
528 },
Tao Bao30e31142019-04-09 00:12:30 -0700529 test_suites: ["general-tests"],
530}