blob: b52da8733c589b72f67fefda5c05cb20398ac69e [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",
187 "mkbootfs",
Luca Stefani3e4b4482020-03-27 14:00:23 +0100188 "signapk",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700189 ],
190}
191
192python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700193 name: "releasetools_img_from_target_files",
194 defaults: [
195 "releasetools_library_defaults",
196 "releasetools_img_from_target_files_defaults",
197 ],
198}
199
200python_library_host {
201 name: "releasetools_ota_from_target_files",
202 defaults: [
203 "releasetools_library_defaults",
204 "releasetools_ota_from_target_files_defaults",
205 ],
206}
207
208python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700209 name: "releasetools_verity_utils",
210 defaults: ["releasetools_library_defaults"],
211 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700212 "verity_utils.py",
213 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700214 required: [
215 "append2simg",
216 "build_verity_metadata",
217 "build_verity_tree",
218 "fec",
219 ],
220}
221
Tao Bao3c7b2a62019-08-07 12:24:20 -0700222//
223// Host binaries.
224//
225
Tao Bao2bbb07c2019-05-07 13:12:21 -0700226python_defaults {
227 name: "releasetools_binary_defaults",
228 version: {
229 py2: {
230 enabled: true,
231 embedded_launcher: true,
232 },
233 py3: {
234 enabled: false,
235 embedded_launcher: false,
236 },
237 },
Kiyoung Kim0a8d2622020-03-24 09:36:03 +0900238 // TODO (b/140144201) Build imgdiff from releasetools_common
239 required: [
240 "aapt2",
241 "boot_signer",
242 "brotli",
243 "bsdiff",
244 "imgdiff",
245 "minigzip",
246 "mkbootfs",
247 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700248}
249
250python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700251 name: "add_img_to_target_files",
252 defaults: [
253 "releasetools_binary_defaults",
254 "releasetools_add_img_to_target_files_defaults",
255 ],
256}
257
258python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700259 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700260 defaults: [
261 "releasetools_binary_defaults",
262 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700263 ],
264}
265
266python_binary_host {
267 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700268 defaults: [
269 "releasetools_binary_defaults",
270 "releasetools_build_super_image_defaults",
271 ],
272}
273
274python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000275 name: "check_partition_sizes",
276 srcs: [
277 "check_partition_sizes.py",
278 ],
279 libs: [
280 "releasetools_common",
281 ],
282 defaults: [
283 "releasetools_binary_defaults",
284 ],
285}
286
287python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700288 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700289 defaults: ["releasetools_binary_defaults"],
290 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700291 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700292 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700293 libs: [
294 "releasetools_common",
295 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700296 required: [
297 "delta_generator",
298 ],
299}
300
301python_binary_host {
302 name: "check_target_files_signatures",
303 defaults: ["releasetools_binary_defaults"],
304 srcs: [
305 "check_target_files_signatures.py",
306 ],
307 libs: [
308 "releasetools_common",
309 ],
310 required: [
311 "aapt",
312 ],
313}
314
315python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700316 name: "check_target_files_vintf",
317 defaults: [
318 "releasetools_binary_defaults",
319 "releasetools_check_target_files_vintf_defaults"
320 ],
321}
322
323python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700324 name: "img_from_target_files",
325 defaults: [
326 "releasetools_binary_defaults",
327 "releasetools_img_from_target_files_defaults",
328 ],
Tao Bao30e31142019-04-09 00:12:30 -0700329}
330
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700331python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700332 name: "make_recovery_patch",
333 defaults: ["releasetools_binary_defaults"],
334 srcs: [
335 "make_recovery_patch.py",
336 ],
337 libs: [
338 "releasetools_common",
339 ],
340}
341
342python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700343 name: "merge_builds",
344 defaults: ["releasetools_binary_defaults"],
345 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700346 "merge_builds.py",
347 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700348 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700349 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700350 "releasetools_common",
351 ],
352}
353
Tao Bao8821d642019-08-05 12:05:45 -0700354python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700355 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700356 defaults: ["releasetools_binary_defaults"],
357 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700358 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700359 ],
360 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700361 "releasetools_add_img_to_target_files",
362 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700363 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700364 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700365 "releasetools_img_from_target_files",
366 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700367 ],
Yifan Hong09298552019-09-04 11:49:01 -0700368 required: [
369 "checkvintf",
370 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700371}
372
373python_binary_host {
374 name: "ota_from_target_files",
375 defaults: [
376 "releasetools_binary_defaults",
377 "releasetools_ota_from_target_files_defaults",
378 ],
379}
380
381python_binary_host {
382 name: "ota_package_parser",
383 defaults: ["releasetools_binary_defaults"],
384 srcs: [
385 "ota_package_parser.py",
386 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700387 ],
388}
389
Tao Baoe11a4602019-08-06 23:21:23 -0700390python_binary_host {
391 name: "sparse_img",
392 defaults: ["releasetools_binary_defaults"],
393 srcs: [
394 "rangelib.py",
395 "sparse_img.py",
396 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700397}
398
Tao Bao3c7b2a62019-08-07 12:24:20 -0700399python_binary_host {
400 name: "sign_apex",
401 defaults: ["releasetools_binary_defaults"],
402 srcs: [
403 "sign_apex.py",
404 ],
405 libs: [
406 "releasetools_apex_utils",
407 "releasetools_common",
408 ],
409}
410
411python_binary_host {
412 name: "sign_target_files_apks",
413 defaults: ["releasetools_binary_defaults"],
414 srcs: [
415 "sign_target_files_apks.py",
416 ],
417 libs: [
418 "releasetools_add_img_to_target_files",
419 "releasetools_apex_utils",
420 "releasetools_common",
421 ],
422}
423
424python_binary_host {
425 name: "validate_target_files",
426 defaults: ["releasetools_binary_defaults"],
427 srcs: [
428 "validate_target_files.py",
429 ],
430 libs: [
431 "releasetools_common",
432 ],
433}
434
435//
436// Tests.
437//
438
Tao Baoca82fc92019-05-01 21:58:03 -0700439python_defaults {
440 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700441 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700442 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000443 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700444 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700445 "make_recovery_patch.py",
446 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700447 "ota_package_parser.py",
448 "sign_apex.py",
449 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700450 "validate_target_files.py",
451
Tao Bao30e31142019-04-09 00:12:30 -0700452 "test_*.py",
453 ],
454 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700455 "releasetools_add_img_to_target_files",
456 "releasetools_apex_utils",
457 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700458 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700459 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700460 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700461 "releasetools_img_from_target_files",
462 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700463 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700464 ],
465 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700466 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700467 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700468}
469
470python_test_host {
471 name: "releasetools_test",
472 defaults: ["releasetools_test_defaults"],
473 main: "test_utils.py",
474 version: {
475 py2: {
476 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700477 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
478 // host, because the test executable won't be able to find the needed libs via its
479 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700480 embedded_launcher: false,
481 },
482 py3: {
483 enabled: false,
484 embedded_launcher: false,
485 },
486 },
487 test_suites: ["general-tests"],
488}
489
490python_test_host {
491 name: "releasetools_py3_test",
492 defaults: ["releasetools_test_defaults"],
493 main: "test_utils.py",
494 version: {
495 py2: {
496 enabled: false,
497 embedded_launcher: false,
498 },
499 py3: {
500 enabled: true,
501 embedded_launcher: false,
502 },
503 },
Tao Bao30e31142019-04-09 00:12:30 -0700504 test_suites: ["general-tests"],
505}