blob: 0ca2b3791c8f28655d606cda90e2e68956459d5e [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 ],
109}
110
111//
112// Host libraries.
113//
114
Tao Bao30e31142019-04-09 00:12:30 -0700115python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700116 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700117 version: {
118 py2: {
119 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700120 },
121 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700122 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700123 },
124 },
125}
126
127python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700128 name: "releasetools_add_img_to_target_files",
129 defaults: [
130 "releasetools_library_defaults",
131 "releasetools_add_img_to_target_files_defaults",
132 ],
133}
134
135python_library_host {
136 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700137 defaults: ["releasetools_library_defaults"],
138 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700139 "apex_utils.py",
140 ],
141 libs: [
142 "releasetools_common",
143 ],
144}
145
146python_library_host {
147 name: "releasetools_build_image",
148 defaults: [
149 "releasetools_library_defaults",
150 "releasetools_build_image_defaults",
151 ],
152}
153
154python_library_host {
155 name: "releasetools_build_super_image",
156 defaults: [
157 "releasetools_library_defaults",
158 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700159 ],
160}
161
162python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700163 name: "releasetools_check_target_files_vintf",
164 defaults: [
165 "releasetools_library_defaults",
166 "releasetools_check_target_files_vintf_defaults",
167 ],
168}
169
170python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700171 name: "releasetools_common",
172 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700173 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700174 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700175 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700176 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700177 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700178 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700179 ],
180 // Only the tools that are referenced directly are listed as required modules. For example,
181 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
182 required: [
changho.shin0f125362019-07-08 10:59:00 +0900183 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700184 "boot_signer",
185 "brotli",
186 "bsdiff",
187 "imgdiff",
188 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000189 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700190 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100191 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700192 ],
193}
194
195python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700196 name: "releasetools_img_from_target_files",
197 defaults: [
198 "releasetools_library_defaults",
199 "releasetools_img_from_target_files_defaults",
200 ],
201}
202
203python_library_host {
204 name: "releasetools_ota_from_target_files",
205 defaults: [
206 "releasetools_library_defaults",
207 "releasetools_ota_from_target_files_defaults",
208 ],
209}
210
211python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700212 name: "releasetools_verity_utils",
213 defaults: ["releasetools_library_defaults"],
214 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700215 "verity_utils.py",
216 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700217 required: [
218 "append2simg",
219 "build_verity_metadata",
220 "build_verity_tree",
221 "fec",
222 ],
223}
224
Tao Bao3c7b2a62019-08-07 12:24:20 -0700225//
226// Host binaries.
227//
228
Tao Bao2bbb07c2019-05-07 13:12:21 -0700229python_defaults {
230 name: "releasetools_binary_defaults",
231 version: {
232 py2: {
233 enabled: true,
234 embedded_launcher: true,
235 },
236 py3: {
237 enabled: false,
238 embedded_launcher: false,
239 },
240 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900241 // TODO (b/140144201) Build imgdiff from releasetools_common
242 required: [
243 "aapt2",
244 "boot_signer",
245 "brotli",
246 "bsdiff",
247 "imgdiff",
248 "minigzip",
249 "mkbootfs",
250 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700251}
252
253python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700254 name: "add_img_to_target_files",
255 defaults: [
256 "releasetools_binary_defaults",
257 "releasetools_add_img_to_target_files_defaults",
258 ],
259}
260
261python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700262 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700263 defaults: [
264 "releasetools_binary_defaults",
265 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700266 ],
267}
268
269python_binary_host {
270 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700271 defaults: [
272 "releasetools_binary_defaults",
273 "releasetools_build_super_image_defaults",
274 ],
275}
276
277python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000278 name: "check_partition_sizes",
279 srcs: [
280 "check_partition_sizes.py",
281 ],
282 libs: [
283 "releasetools_common",
284 ],
285 defaults: [
286 "releasetools_binary_defaults",
287 ],
288}
289
290python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700291 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700292 defaults: ["releasetools_binary_defaults"],
293 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700294 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700295 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700296 libs: [
297 "releasetools_common",
298 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700299 required: [
300 "delta_generator",
301 ],
302}
303
304python_binary_host {
305 name: "check_target_files_signatures",
306 defaults: ["releasetools_binary_defaults"],
307 srcs: [
308 "check_target_files_signatures.py",
309 ],
310 libs: [
311 "releasetools_common",
312 ],
313 required: [
314 "aapt",
315 ],
316}
317
318python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700319 name: "check_target_files_vintf",
320 defaults: [
321 "releasetools_binary_defaults",
322 "releasetools_check_target_files_vintf_defaults"
323 ],
324}
325
326python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700327 name: "img_from_target_files",
328 defaults: [
329 "releasetools_binary_defaults",
330 "releasetools_img_from_target_files_defaults",
331 ],
Tao Bao30e31142019-04-09 00:12:30 -0700332}
333
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700334python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700335 name: "make_recovery_patch",
336 defaults: ["releasetools_binary_defaults"],
337 srcs: [
338 "make_recovery_patch.py",
339 ],
340 libs: [
341 "releasetools_common",
342 ],
343}
344
345python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700346 name: "merge_builds",
347 defaults: ["releasetools_binary_defaults"],
348 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700349 "merge_builds.py",
350 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700351 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700352 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700353 "releasetools_common",
354 ],
355}
356
Tao Bao8821d642019-08-05 12:05:45 -0700357python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700358 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700359 defaults: ["releasetools_binary_defaults"],
360 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700361 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700362 ],
363 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700364 "releasetools_add_img_to_target_files",
365 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700366 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700367 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700368 "releasetools_img_from_target_files",
369 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700370 ],
Yifan Hong09298552019-09-04 11:49:01 -0700371 required: [
372 "checkvintf",
373 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700374}
375
376python_binary_host {
377 name: "ota_from_target_files",
378 defaults: [
379 "releasetools_binary_defaults",
380 "releasetools_ota_from_target_files_defaults",
381 ],
382}
383
384python_binary_host {
385 name: "ota_package_parser",
386 defaults: ["releasetools_binary_defaults"],
387 srcs: [
388 "ota_package_parser.py",
389 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700390 ],
391}
392
Tao Baoe11a4602019-08-06 23:21:23 -0700393python_binary_host {
394 name: "sparse_img",
395 defaults: ["releasetools_binary_defaults"],
396 srcs: [
397 "rangelib.py",
398 "sparse_img.py",
399 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700400}
401
Tao Bao3c7b2a62019-08-07 12:24:20 -0700402python_binary_host {
403 name: "sign_apex",
404 defaults: ["releasetools_binary_defaults"],
405 srcs: [
406 "sign_apex.py",
407 ],
408 libs: [
409 "releasetools_apex_utils",
410 "releasetools_common",
411 ],
412}
413
414python_binary_host {
415 name: "sign_target_files_apks",
416 defaults: ["releasetools_binary_defaults"],
417 srcs: [
418 "sign_target_files_apks.py",
419 ],
420 libs: [
421 "releasetools_add_img_to_target_files",
422 "releasetools_apex_utils",
423 "releasetools_common",
424 ],
425}
426
427python_binary_host {
428 name: "validate_target_files",
429 defaults: ["releasetools_binary_defaults"],
430 srcs: [
431 "validate_target_files.py",
432 ],
433 libs: [
434 "releasetools_common",
435 ],
436}
437
438//
439// Tests.
440//
441
Tao Baoca82fc92019-05-01 21:58:03 -0700442python_defaults {
443 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700444 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700445 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000446 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700447 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700448 "make_recovery_patch.py",
449 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700450 "ota_package_parser.py",
451 "sign_apex.py",
452 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700453 "validate_target_files.py",
454
Tao Bao30e31142019-04-09 00:12:30 -0700455 "test_*.py",
456 ],
457 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700458 "releasetools_add_img_to_target_files",
459 "releasetools_apex_utils",
460 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700461 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700462 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700463 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700464 "releasetools_img_from_target_files",
465 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700466 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700467 ],
468 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700469 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700470 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700471}
472
473python_test_host {
474 name: "releasetools_test",
475 defaults: ["releasetools_test_defaults"],
476 main: "test_utils.py",
477 version: {
478 py2: {
479 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700480 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
481 // host, because the test executable won't be able to find the needed libs via its
482 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700483 embedded_launcher: false,
484 },
485 py3: {
486 enabled: false,
487 embedded_launcher: false,
488 },
489 },
490 test_suites: ["general-tests"],
491}
492
493python_test_host {
494 name: "releasetools_py3_test",
495 defaults: ["releasetools_test_defaults"],
496 main: "test_utils.py",
497 version: {
498 py2: {
499 enabled: false,
500 embedded_launcher: false,
501 },
502 py3: {
503 enabled: true,
504 embedded_launcher: false,
505 },
506 },
Tao Bao30e31142019-04-09 00:12:30 -0700507 test_suites: ["general-tests"],
508}