blob: 91dfa898784902b3e6392e50eb5b34923b993663 [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 ],
Tao Bao57f8ed62019-08-14 23:08:18 -070076 required: [
77 "zip2zip",
78 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -070079}
80
81python_defaults {
Yifan Honge3ba82c2019-08-21 13:29:30 -070082 name: "releasetools_check_target_files_vintf_defaults",
83 srcs: [
84 "check_target_files_vintf.py",
85 ],
86 libs: [
87 "releasetools_common",
88 ],
89 required: [
90 "checkvintf",
91 ],
92}
93
94python_defaults {
Tao Bao3c7b2a62019-08-07 12:24:20 -070095 name: "releasetools_ota_from_target_files_defaults",
96 srcs: [
97 "edify_generator.py",
98 "ota_from_target_files.py",
99 "target_files_diff.py",
100 ],
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 ],
110}
111
112//
113// Host libraries.
114//
115
Tao Bao30e31142019-04-09 00:12:30 -0700116python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700117 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700118 version: {
119 py2: {
120 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700121 },
122 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700123 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700124 },
125 },
126}
127
128python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700129 name: "releasetools_add_img_to_target_files",
130 defaults: [
131 "releasetools_library_defaults",
132 "releasetools_add_img_to_target_files_defaults",
133 ],
134}
135
136python_library_host {
137 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700138 defaults: ["releasetools_library_defaults"],
139 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700140 "apex_utils.py",
141 ],
142 libs: [
143 "releasetools_common",
144 ],
145}
146
147python_library_host {
148 name: "releasetools_build_image",
149 defaults: [
150 "releasetools_library_defaults",
151 "releasetools_build_image_defaults",
152 ],
153}
154
155python_library_host {
156 name: "releasetools_build_super_image",
157 defaults: [
158 "releasetools_library_defaults",
159 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700160 ],
161}
162
163python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700164 name: "releasetools_check_target_files_vintf",
165 defaults: [
166 "releasetools_library_defaults",
167 "releasetools_check_target_files_vintf_defaults",
168 ],
169}
170
171python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700172 name: "releasetools_common",
173 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700174 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700175 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700176 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700177 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700178 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700179 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700180 ],
181 // Only the tools that are referenced directly are listed as required modules. For example,
182 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
183 required: [
changho.shin0f125362019-07-08 10:59:00 +0900184 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700185 "boot_signer",
186 "brotli",
187 "bsdiff",
188 "imgdiff",
189 "minigzip",
J. Avilad30b75182020-06-10 20:09:10 +0000190 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700191 "mkbootfs",
Luca Stefani972a64e2020-03-27 14:00:23 +0100192 "signapk",
Kshitij Guptaa5d5f5a2020-12-23 18:32:39 +0000193 "zipalign",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700194 ],
195}
196
197python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700198 name: "releasetools_img_from_target_files",
199 defaults: [
200 "releasetools_library_defaults",
201 "releasetools_img_from_target_files_defaults",
202 ],
203}
204
205python_library_host {
206 name: "releasetools_ota_from_target_files",
207 defaults: [
208 "releasetools_library_defaults",
209 "releasetools_ota_from_target_files_defaults",
210 ],
211}
212
213python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700214 name: "releasetools_verity_utils",
215 defaults: ["releasetools_library_defaults"],
216 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700217 "verity_utils.py",
218 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700219 required: [
220 "append2simg",
221 "build_verity_metadata",
222 "build_verity_tree",
223 "fec",
224 ],
225}
226
Tao Bao3c7b2a62019-08-07 12:24:20 -0700227//
228// Host binaries.
229//
230
Tao Bao2bbb07c2019-05-07 13:12:21 -0700231python_defaults {
232 name: "releasetools_binary_defaults",
233 version: {
234 py2: {
235 enabled: true,
236 embedded_launcher: true,
237 },
238 py3: {
239 enabled: false,
240 embedded_launcher: false,
241 },
242 },
Kiyoung Kim0dc94c12020-03-24 09:36:03 +0900243 // TODO (b/140144201) Build imgdiff from releasetools_common
244 required: [
245 "aapt2",
Kshitij Guptaee63a3a2020-09-20 11:01:39 +0000246 "apexer",
Kiyoung Kim0dc94c12020-03-24 09:36:03 +0900247 "boot_signer",
248 "brotli",
249 "bsdiff",
Kshitij Guptaee63a3a2020-09-20 11:01:39 +0000250 "deapexer",
251 "debugfs-host",
Kiyoung Kim0dc94c12020-03-24 09:36:03 +0900252 "imgdiff",
Luca Stefani1261d002020-09-12 06:08:16 +0000253 "lz4",
Kshitij Guptaee63a3a2020-09-20 11:01:39 +0000254 "minigzip",
Kiyoung Kim0dc94c12020-03-24 09:36:03 +0900255 "mkbootfs",
Luca Stefani1261d002020-09-12 06:08:16 +0000256 "signapk",
Kshitij Guptaee63a3a2020-09-20 11:01:39 +0000257 "zipalign",
Kiyoung Kim0dc94c12020-03-24 09:36:03 +0900258 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700259}
260
261python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700262 name: "add_img_to_target_files",
263 defaults: [
264 "releasetools_binary_defaults",
265 "releasetools_add_img_to_target_files_defaults",
266 ],
267}
268
269python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700270 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700271 defaults: [
272 "releasetools_binary_defaults",
273 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700274 ],
275}
276
277python_binary_host {
278 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700279 defaults: [
280 "releasetools_binary_defaults",
281 "releasetools_build_super_image_defaults",
282 ],
283}
284
285python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000286 name: "check_partition_sizes",
287 srcs: [
288 "check_partition_sizes.py",
289 ],
290 libs: [
291 "releasetools_common",
292 ],
293 defaults: [
294 "releasetools_binary_defaults",
295 ],
296}
297
298python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700299 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700300 defaults: ["releasetools_binary_defaults"],
301 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700302 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700303 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700304 libs: [
305 "releasetools_common",
306 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700307 required: [
308 "delta_generator",
309 ],
310}
311
312python_binary_host {
313 name: "check_target_files_signatures",
314 defaults: ["releasetools_binary_defaults"],
315 srcs: [
316 "check_target_files_signatures.py",
317 ],
318 libs: [
319 "releasetools_common",
320 ],
321 required: [
322 "aapt",
323 ],
324}
325
326python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700327 name: "check_target_files_vintf",
328 defaults: [
329 "releasetools_binary_defaults",
330 "releasetools_check_target_files_vintf_defaults"
331 ],
332}
333
334python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700335 name: "img_from_target_files",
336 defaults: [
337 "releasetools_binary_defaults",
338 "releasetools_img_from_target_files_defaults",
339 ],
Tao Bao30e31142019-04-09 00:12:30 -0700340}
341
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700342python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700343 name: "make_recovery_patch",
344 defaults: ["releasetools_binary_defaults"],
345 srcs: [
346 "make_recovery_patch.py",
347 ],
348 libs: [
349 "releasetools_common",
350 ],
351}
352
353python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700354 name: "merge_builds",
355 defaults: ["releasetools_binary_defaults"],
356 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700357 "merge_builds.py",
358 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700359 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700360 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700361 "releasetools_common",
362 ],
363}
364
Tao Bao8821d642019-08-05 12:05:45 -0700365python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700366 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700367 defaults: ["releasetools_binary_defaults"],
368 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700369 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700370 ],
371 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700372 "releasetools_add_img_to_target_files",
373 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700374 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700375 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700376 "releasetools_img_from_target_files",
377 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700378 ],
Yifan Hong09298552019-09-04 11:49:01 -0700379 required: [
380 "checkvintf",
381 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700382}
383
384python_binary_host {
385 name: "ota_from_target_files",
386 defaults: [
387 "releasetools_binary_defaults",
388 "releasetools_ota_from_target_files_defaults",
389 ],
390}
391
392python_binary_host {
393 name: "ota_package_parser",
394 defaults: ["releasetools_binary_defaults"],
395 srcs: [
396 "ota_package_parser.py",
397 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700398 ],
399}
400
Tao Baoe11a4602019-08-06 23:21:23 -0700401python_binary_host {
402 name: "sparse_img",
403 defaults: ["releasetools_binary_defaults"],
404 srcs: [
405 "rangelib.py",
406 "sparse_img.py",
407 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700408}
409
Tao Bao3c7b2a62019-08-07 12:24:20 -0700410python_binary_host {
411 name: "sign_apex",
412 defaults: ["releasetools_binary_defaults"],
413 srcs: [
414 "sign_apex.py",
415 ],
416 libs: [
417 "releasetools_apex_utils",
418 "releasetools_common",
419 ],
420}
421
422python_binary_host {
423 name: "sign_target_files_apks",
424 defaults: ["releasetools_binary_defaults"],
425 srcs: [
426 "sign_target_files_apks.py",
427 ],
428 libs: [
429 "releasetools_add_img_to_target_files",
430 "releasetools_apex_utils",
431 "releasetools_common",
432 ],
433}
434
435python_binary_host {
436 name: "validate_target_files",
437 defaults: ["releasetools_binary_defaults"],
438 srcs: [
439 "validate_target_files.py",
440 ],
441 libs: [
442 "releasetools_common",
443 ],
444}
445
446//
447// Tests.
448//
449
Tao Baoca82fc92019-05-01 21:58:03 -0700450python_defaults {
451 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700452 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700453 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000454 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700455 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700456 "make_recovery_patch.py",
457 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700458 "ota_package_parser.py",
459 "sign_apex.py",
460 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700461 "validate_target_files.py",
462
Tao Bao30e31142019-04-09 00:12:30 -0700463 "test_*.py",
464 ],
465 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700466 "releasetools_add_img_to_target_files",
467 "releasetools_apex_utils",
468 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700469 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700470 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700471 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700472 "releasetools_img_from_target_files",
473 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700474 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700475 ],
476 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700477 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700478 ],
479 required: [
480 "otatools",
481 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700482}
483
484python_test_host {
485 name: "releasetools_test",
486 defaults: ["releasetools_test_defaults"],
487 main: "test_utils.py",
488 version: {
489 py2: {
490 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700491 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
492 // host, because the test executable won't be able to find the needed libs via its
493 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700494 embedded_launcher: false,
495 },
496 py3: {
497 enabled: false,
498 embedded_launcher: false,
499 },
500 },
501 test_suites: ["general-tests"],
502}
503
504python_test_host {
505 name: "releasetools_py3_test",
506 defaults: ["releasetools_test_defaults"],
507 main: "test_utils.py",
508 version: {
509 py2: {
510 enabled: false,
511 embedded_launcher: false,
512 },
513 py3: {
514 enabled: true,
515 embedded_launcher: false,
516 },
517 },
Tao Bao30e31142019-04-09 00:12:30 -0700518 test_suites: ["general-tests"],
519}