blob: 11f92abb174f0b97f7f54dea764252b01ac6a49a [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 ],
107}
108
109//
110// Host libraries.
111//
112
Tao Bao30e31142019-04-09 00:12:30 -0700113python_defaults {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700114 name: "releasetools_library_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700115 version: {
116 py2: {
117 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700118 },
119 py3: {
Tao Baoca82fc92019-05-01 21:58:03 -0700120 enabled: true,
Tao Bao30e31142019-04-09 00:12:30 -0700121 },
122 },
123}
124
125python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700126 name: "releasetools_add_img_to_target_files",
127 defaults: [
128 "releasetools_library_defaults",
129 "releasetools_add_img_to_target_files_defaults",
130 ],
131}
132
133python_library_host {
134 name: "releasetools_apex_utils",
Tao Bao005305a2019-08-05 13:00:44 -0700135 defaults: ["releasetools_library_defaults"],
136 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700137 "apex_utils.py",
138 ],
139 libs: [
140 "releasetools_common",
141 ],
142}
143
144python_library_host {
145 name: "releasetools_build_image",
146 defaults: [
147 "releasetools_library_defaults",
148 "releasetools_build_image_defaults",
149 ],
150}
151
152python_library_host {
153 name: "releasetools_build_super_image",
154 defaults: [
155 "releasetools_library_defaults",
156 "releasetools_build_super_image_defaults",
Tao Bao005305a2019-08-05 13:00:44 -0700157 ],
158}
159
160python_library_host {
Yifan Hongccb86fe2019-08-22 15:52:26 -0700161 name: "releasetools_check_target_files_vintf",
162 defaults: [
163 "releasetools_library_defaults",
164 "releasetools_check_target_files_vintf_defaults",
165 ],
166}
167
168python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700169 name: "releasetools_common",
170 defaults: ["releasetools_library_defaults"],
Tao Bao30e31142019-04-09 00:12:30 -0700171 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700172 "blockimgdiff.py",
Tao Bao30e31142019-04-09 00:12:30 -0700173 "common.py",
Tianjie Xu41976c72019-07-03 13:57:01 -0700174 "images.py",
Tao Bao30e31142019-04-09 00:12:30 -0700175 "rangelib.py",
Tao Bao30e31142019-04-09 00:12:30 -0700176 "sparse_img.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700177 ],
178 // Only the tools that are referenced directly are listed as required modules. For example,
179 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
180 required: [
changho.shin0f125362019-07-08 10:59:00 +0900181 "aapt2",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700182 "boot_signer",
183 "brotli",
184 "bsdiff",
185 "imgdiff",
186 "minigzip",
J. Avila98cd4cc2020-06-10 20:09:10 +0000187 "lz4",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700188 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100189 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700190 ],
191}
192
193python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700194 name: "releasetools_img_from_target_files",
195 defaults: [
196 "releasetools_library_defaults",
197 "releasetools_img_from_target_files_defaults",
198 ],
199}
200
201python_library_host {
202 name: "releasetools_ota_from_target_files",
203 defaults: [
204 "releasetools_library_defaults",
205 "releasetools_ota_from_target_files_defaults",
206 ],
207}
208
209python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700210 name: "releasetools_verity_utils",
211 defaults: ["releasetools_library_defaults"],
212 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700213 "verity_utils.py",
214 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700215 required: [
216 "append2simg",
217 "build_verity_metadata",
218 "build_verity_tree",
219 "fec",
220 ],
221}
222
Tao Bao3c7b2a62019-08-07 12:24:20 -0700223//
224// Host binaries.
225//
226
Tao Bao2bbb07c2019-05-07 13:12:21 -0700227python_defaults {
228 name: "releasetools_binary_defaults",
229 version: {
230 py2: {
231 enabled: true,
232 embedded_launcher: true,
233 },
234 py3: {
235 enabled: false,
236 embedded_launcher: false,
237 },
238 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900239 // TODO (b/140144201) Build imgdiff from releasetools_common
240 required: [
241 "aapt2",
242 "boot_signer",
243 "brotli",
244 "bsdiff",
245 "imgdiff",
246 "minigzip",
247 "mkbootfs",
248 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700249}
250
251python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700252 name: "add_img_to_target_files",
253 defaults: [
254 "releasetools_binary_defaults",
255 "releasetools_add_img_to_target_files_defaults",
256 ],
257}
258
259python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700260 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700261 defaults: [
262 "releasetools_binary_defaults",
263 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700264 ],
265}
266
267python_binary_host {
268 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700269 defaults: [
270 "releasetools_binary_defaults",
271 "releasetools_build_super_image_defaults",
272 ],
273}
274
275python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000276 name: "check_partition_sizes",
277 srcs: [
278 "check_partition_sizes.py",
279 ],
280 libs: [
281 "releasetools_common",
282 ],
283 defaults: [
284 "releasetools_binary_defaults",
285 ],
286}
287
288python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700289 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700290 defaults: ["releasetools_binary_defaults"],
291 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700292 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700293 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700294 libs: [
295 "releasetools_common",
296 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700297 required: [
298 "delta_generator",
299 ],
300}
301
302python_binary_host {
303 name: "check_target_files_signatures",
304 defaults: ["releasetools_binary_defaults"],
305 srcs: [
306 "check_target_files_signatures.py",
307 ],
308 libs: [
309 "releasetools_common",
310 ],
311 required: [
312 "aapt",
313 ],
314}
315
316python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700317 name: "check_target_files_vintf",
318 defaults: [
319 "releasetools_binary_defaults",
320 "releasetools_check_target_files_vintf_defaults"
321 ],
322}
323
324python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700325 name: "img_from_target_files",
326 defaults: [
327 "releasetools_binary_defaults",
328 "releasetools_img_from_target_files_defaults",
329 ],
Tao Bao30e31142019-04-09 00:12:30 -0700330}
331
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700332python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700333 name: "make_recovery_patch",
334 defaults: ["releasetools_binary_defaults"],
335 srcs: [
336 "make_recovery_patch.py",
337 ],
338 libs: [
339 "releasetools_common",
340 ],
341}
342
343python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700344 name: "merge_builds",
345 defaults: ["releasetools_binary_defaults"],
346 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700347 "merge_builds.py",
348 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700349 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700350 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700351 "releasetools_common",
352 ],
353}
354
Tao Bao8821d642019-08-05 12:05:45 -0700355python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700356 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700357 defaults: ["releasetools_binary_defaults"],
358 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700359 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700360 ],
361 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700362 "releasetools_add_img_to_target_files",
363 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700364 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700365 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700366 "releasetools_img_from_target_files",
367 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700368 ],
Yifan Hong09298552019-09-04 11:49:01 -0700369 required: [
370 "checkvintf",
371 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700372}
373
374python_binary_host {
375 name: "ota_from_target_files",
376 defaults: [
377 "releasetools_binary_defaults",
378 "releasetools_ota_from_target_files_defaults",
379 ],
380}
381
382python_binary_host {
383 name: "ota_package_parser",
384 defaults: ["releasetools_binary_defaults"],
385 srcs: [
386 "ota_package_parser.py",
387 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700388 ],
389}
390
Tao Baoe11a4602019-08-06 23:21:23 -0700391python_binary_host {
392 name: "sparse_img",
393 defaults: ["releasetools_binary_defaults"],
394 srcs: [
395 "rangelib.py",
396 "sparse_img.py",
397 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700398}
399
Tao Bao3c7b2a62019-08-07 12:24:20 -0700400python_binary_host {
401 name: "sign_apex",
402 defaults: ["releasetools_binary_defaults"],
403 srcs: [
404 "sign_apex.py",
405 ],
406 libs: [
407 "releasetools_apex_utils",
408 "releasetools_common",
409 ],
410}
411
412python_binary_host {
413 name: "sign_target_files_apks",
414 defaults: ["releasetools_binary_defaults"],
415 srcs: [
416 "sign_target_files_apks.py",
417 ],
418 libs: [
419 "releasetools_add_img_to_target_files",
420 "releasetools_apex_utils",
421 "releasetools_common",
422 ],
423}
424
425python_binary_host {
426 name: "validate_target_files",
427 defaults: ["releasetools_binary_defaults"],
428 srcs: [
429 "validate_target_files.py",
430 ],
431 libs: [
432 "releasetools_common",
433 ],
434}
435
436//
437// Tests.
438//
439
Tao Baoca82fc92019-05-01 21:58:03 -0700440python_defaults {
441 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700442 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700443 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000444 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700445 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700446 "make_recovery_patch.py",
447 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700448 "ota_package_parser.py",
449 "sign_apex.py",
450 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700451 "validate_target_files.py",
452
Tao Bao30e31142019-04-09 00:12:30 -0700453 "test_*.py",
454 ],
455 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700456 "releasetools_add_img_to_target_files",
457 "releasetools_apex_utils",
458 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700459 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700460 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700461 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700462 "releasetools_img_from_target_files",
463 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700464 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700465 ],
466 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700467 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700468 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700469}
470
471python_test_host {
472 name: "releasetools_test",
473 defaults: ["releasetools_test_defaults"],
474 main: "test_utils.py",
475 version: {
476 py2: {
477 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700478 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
479 // host, because the test executable won't be able to find the needed libs via its
480 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700481 embedded_launcher: false,
482 },
483 py3: {
484 enabled: false,
485 embedded_launcher: false,
486 },
487 },
488 test_suites: ["general-tests"],
489}
490
491python_test_host {
492 name: "releasetools_py3_test",
493 defaults: ["releasetools_test_defaults"],
494 main: "test_utils.py",
495 version: {
496 py2: {
497 enabled: false,
498 embedded_launcher: false,
499 },
500 py3: {
501 enabled: true,
502 embedded_launcher: false,
503 },
504 },
Tao Bao30e31142019-04-09 00:12:30 -0700505 test_suites: ["general-tests"],
506}