blob: 90a6485d63d7edf4ae8140798b358e8d270c1efc [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",
190 "mkbootfs",
191 ],
192}
193
194python_library_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700195 name: "releasetools_img_from_target_files",
196 defaults: [
197 "releasetools_library_defaults",
198 "releasetools_img_from_target_files_defaults",
199 ],
200}
201
202python_library_host {
203 name: "releasetools_ota_from_target_files",
204 defaults: [
205 "releasetools_library_defaults",
206 "releasetools_ota_from_target_files_defaults",
207 ],
208}
209
210python_library_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700211 name: "releasetools_verity_utils",
212 defaults: ["releasetools_library_defaults"],
213 srcs: [
Tao Bao30e31142019-04-09 00:12:30 -0700214 "verity_utils.py",
215 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700216 required: [
217 "append2simg",
218 "build_verity_metadata",
219 "build_verity_tree",
220 "fec",
221 ],
222}
223
Tao Bao3c7b2a62019-08-07 12:24:20 -0700224//
225// Host binaries.
226//
227
Tao Bao2bbb07c2019-05-07 13:12:21 -0700228python_defaults {
229 name: "releasetools_binary_defaults",
230 version: {
231 py2: {
232 enabled: true,
233 embedded_launcher: true,
234 },
235 py3: {
236 enabled: false,
237 embedded_launcher: false,
238 },
239 },
240}
241
242python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700243 name: "add_img_to_target_files",
244 defaults: [
245 "releasetools_binary_defaults",
246 "releasetools_add_img_to_target_files_defaults",
247 ],
248}
249
250python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700251 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700252 defaults: [
253 "releasetools_binary_defaults",
254 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700255 ],
256}
257
258python_binary_host {
259 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700260 defaults: [
261 "releasetools_binary_defaults",
262 "releasetools_build_super_image_defaults",
263 ],
264}
265
266python_binary_host {
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000267 name: "check_partition_sizes",
268 srcs: [
269 "check_partition_sizes.py",
270 ],
271 libs: [
272 "releasetools_common",
273 ],
274 defaults: [
275 "releasetools_binary_defaults",
276 ],
277}
278
279python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700280 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700281 defaults: ["releasetools_binary_defaults"],
282 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700283 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700284 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700285 libs: [
286 "releasetools_common",
287 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700288 required: [
289 "delta_generator",
290 ],
291}
292
293python_binary_host {
294 name: "check_target_files_signatures",
295 defaults: ["releasetools_binary_defaults"],
296 srcs: [
297 "check_target_files_signatures.py",
298 ],
299 libs: [
300 "releasetools_common",
301 ],
302 required: [
303 "aapt",
304 ],
305}
306
307python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700308 name: "check_target_files_vintf",
309 defaults: [
310 "releasetools_binary_defaults",
311 "releasetools_check_target_files_vintf_defaults"
312 ],
313}
314
315python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700316 name: "img_from_target_files",
317 defaults: [
318 "releasetools_binary_defaults",
319 "releasetools_img_from_target_files_defaults",
320 ],
Tao Bao30e31142019-04-09 00:12:30 -0700321}
322
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700323python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700324 name: "make_recovery_patch",
325 defaults: ["releasetools_binary_defaults"],
326 srcs: [
327 "make_recovery_patch.py",
328 ],
329 libs: [
330 "releasetools_common",
331 ],
332}
333
334python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700335 name: "merge_builds",
336 defaults: ["releasetools_binary_defaults"],
337 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700338 "merge_builds.py",
339 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700340 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700341 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700342 "releasetools_common",
343 ],
344}
345
Tao Bao8821d642019-08-05 12:05:45 -0700346python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700347 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700348 defaults: ["releasetools_binary_defaults"],
349 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700350 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700351 ],
352 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700353 "releasetools_add_img_to_target_files",
354 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700355 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700356 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700357 "releasetools_img_from_target_files",
358 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700359 ],
Yifan Hong09298552019-09-04 11:49:01 -0700360 required: [
361 "checkvintf",
362 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700363}
364
365python_binary_host {
366 name: "ota_from_target_files",
367 defaults: [
368 "releasetools_binary_defaults",
369 "releasetools_ota_from_target_files_defaults",
370 ],
371}
372
373python_binary_host {
374 name: "ota_package_parser",
375 defaults: ["releasetools_binary_defaults"],
376 srcs: [
377 "ota_package_parser.py",
378 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700379 ],
380}
381
Tao Baoe11a4602019-08-06 23:21:23 -0700382python_binary_host {
383 name: "sparse_img",
384 defaults: ["releasetools_binary_defaults"],
385 srcs: [
386 "rangelib.py",
387 "sparse_img.py",
388 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700389}
390
Tao Bao3c7b2a62019-08-07 12:24:20 -0700391python_binary_host {
392 name: "sign_apex",
393 defaults: ["releasetools_binary_defaults"],
394 srcs: [
395 "sign_apex.py",
396 ],
397 libs: [
398 "releasetools_apex_utils",
399 "releasetools_common",
400 ],
401}
402
403python_binary_host {
404 name: "sign_target_files_apks",
405 defaults: ["releasetools_binary_defaults"],
406 srcs: [
407 "sign_target_files_apks.py",
408 ],
409 libs: [
410 "releasetools_add_img_to_target_files",
411 "releasetools_apex_utils",
412 "releasetools_common",
413 ],
414}
415
416python_binary_host {
417 name: "validate_target_files",
418 defaults: ["releasetools_binary_defaults"],
419 srcs: [
420 "validate_target_files.py",
421 ],
422 libs: [
423 "releasetools_common",
424 ],
425}
426
427//
428// Tests.
429//
430
Tao Baoca82fc92019-05-01 21:58:03 -0700431python_defaults {
432 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700433 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700434 "check_ota_package_signature.py",
Yifan Hong3a7c2ef2019-11-01 18:23:19 +0000435 "check_partition_sizes.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700436 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700437 "make_recovery_patch.py",
438 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700439 "ota_package_parser.py",
440 "sign_apex.py",
441 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700442 "validate_target_files.py",
443
Tao Bao30e31142019-04-09 00:12:30 -0700444 "test_*.py",
445 ],
446 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700447 "releasetools_add_img_to_target_files",
448 "releasetools_apex_utils",
449 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700450 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700451 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700452 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700453 "releasetools_img_from_target_files",
454 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700455 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700456 ],
457 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700458 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700459 ],
460 required: [
461 "otatools",
462 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700463}
464
465python_test_host {
466 name: "releasetools_test",
467 defaults: ["releasetools_test_defaults"],
468 main: "test_utils.py",
469 version: {
470 py2: {
471 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700472 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
473 // host, because the test executable won't be able to find the needed libs via its
474 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700475 embedded_launcher: false,
476 },
477 py3: {
478 enabled: false,
479 embedded_launcher: false,
480 },
481 },
482 test_suites: ["general-tests"],
483}
484
485python_test_host {
486 name: "releasetools_py3_test",
487 defaults: ["releasetools_test_defaults"],
488 main: "test_utils.py",
489 version: {
490 py2: {
491 enabled: false,
492 embedded_launcher: false,
493 },
494 py3: {
495 enabled: true,
496 embedded_launcher: false,
497 },
498 },
Tao Bao30e31142019-04-09 00:12:30 -0700499 test_suites: ["general-tests"],
500}