blob: 6cde77e8535de3a094cfd26386d514e9c22859d7 [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 {
267 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700268 defaults: ["releasetools_binary_defaults"],
269 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700270 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700271 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700272 libs: [
273 "releasetools_common",
274 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700275 required: [
276 "delta_generator",
277 ],
278}
279
280python_binary_host {
281 name: "check_target_files_signatures",
282 defaults: ["releasetools_binary_defaults"],
283 srcs: [
284 "check_target_files_signatures.py",
285 ],
286 libs: [
287 "releasetools_common",
288 ],
289 required: [
290 "aapt",
291 ],
292}
293
294python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700295 name: "check_target_files_vintf",
296 defaults: [
297 "releasetools_binary_defaults",
298 "releasetools_check_target_files_vintf_defaults"
299 ],
300}
301
302python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700303 name: "img_from_target_files",
304 defaults: [
305 "releasetools_binary_defaults",
306 "releasetools_img_from_target_files_defaults",
307 ],
Tao Bao30e31142019-04-09 00:12:30 -0700308}
309
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700310python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700311 name: "make_recovery_patch",
312 defaults: ["releasetools_binary_defaults"],
313 srcs: [
314 "make_recovery_patch.py",
315 ],
316 libs: [
317 "releasetools_common",
318 ],
319}
320
321python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700322 name: "merge_builds",
323 defaults: ["releasetools_binary_defaults"],
324 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700325 "merge_builds.py",
326 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700327 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700328 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700329 "releasetools_common",
330 ],
331}
332
Tao Bao8821d642019-08-05 12:05:45 -0700333python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700334 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700335 defaults: ["releasetools_binary_defaults"],
336 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700337 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700338 ],
339 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700340 "releasetools_add_img_to_target_files",
341 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700342 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700343 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700344 "releasetools_img_from_target_files",
345 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700346 ],
Yifan Hong09298552019-09-04 11:49:01 -0700347 required: [
348 "checkvintf",
349 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700350}
351
352python_binary_host {
353 name: "ota_from_target_files",
354 defaults: [
355 "releasetools_binary_defaults",
356 "releasetools_ota_from_target_files_defaults",
357 ],
358}
359
360python_binary_host {
361 name: "ota_package_parser",
362 defaults: ["releasetools_binary_defaults"],
363 srcs: [
364 "ota_package_parser.py",
365 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700366 ],
367}
368
Tao Baoe11a4602019-08-06 23:21:23 -0700369python_binary_host {
370 name: "sparse_img",
371 defaults: ["releasetools_binary_defaults"],
372 srcs: [
373 "rangelib.py",
374 "sparse_img.py",
375 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700376}
377
Tao Bao3c7b2a62019-08-07 12:24:20 -0700378python_binary_host {
379 name: "sign_apex",
380 defaults: ["releasetools_binary_defaults"],
381 srcs: [
382 "sign_apex.py",
383 ],
384 libs: [
385 "releasetools_apex_utils",
386 "releasetools_common",
387 ],
388}
389
390python_binary_host {
391 name: "sign_target_files_apks",
392 defaults: ["releasetools_binary_defaults"],
393 srcs: [
394 "sign_target_files_apks.py",
395 ],
396 libs: [
397 "releasetools_add_img_to_target_files",
398 "releasetools_apex_utils",
399 "releasetools_common",
400 ],
401}
402
403python_binary_host {
404 name: "validate_target_files",
405 defaults: ["releasetools_binary_defaults"],
406 srcs: [
407 "validate_target_files.py",
408 ],
409 libs: [
410 "releasetools_common",
411 ],
412}
413
414//
415// Tests.
416//
417
Tao Baoca82fc92019-05-01 21:58:03 -0700418python_defaults {
419 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700420 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700421 "check_ota_package_signature.py",
422 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700423 "make_recovery_patch.py",
424 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700425 "ota_package_parser.py",
426 "sign_apex.py",
427 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700428 "validate_target_files.py",
429
Tao Bao30e31142019-04-09 00:12:30 -0700430 "test_*.py",
431 ],
432 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700433 "releasetools_add_img_to_target_files",
434 "releasetools_apex_utils",
435 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700436 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700437 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700438 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700439 "releasetools_img_from_target_files",
440 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700441 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700442 ],
443 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700444 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700445 ],
446 required: [
447 "otatools",
448 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700449}
450
451python_test_host {
452 name: "releasetools_test",
453 defaults: ["releasetools_test_defaults"],
454 main: "test_utils.py",
455 version: {
456 py2: {
457 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700458 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
459 // host, because the test executable won't be able to find the needed libs via its
460 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700461 embedded_launcher: false,
462 },
463 py3: {
464 enabled: false,
465 embedded_launcher: false,
466 },
467 },
468 test_suites: ["general-tests"],
469}
470
471python_test_host {
472 name: "releasetools_py3_test",
473 defaults: ["releasetools_test_defaults"],
474 main: "test_utils.py",
475 version: {
476 py2: {
477 enabled: false,
478 embedded_launcher: false,
479 },
480 py3: {
481 enabled: true,
482 embedded_launcher: false,
483 },
484 },
Tao Bao30e31142019-04-09 00:12:30 -0700485 test_suites: ["general-tests"],
486}