blob: 3308f3d5708ae9d7896202c47a0293b7b000ef1e [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",
108 ],
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: [
183 "aapt",
184 "boot_signer",
185 "brotli",
186 "bsdiff",
187 "imgdiff",
188 "minigzip",
189 "mkbootfs",
190 ],
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 },
239}
240
241python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700242 name: "add_img_to_target_files",
243 defaults: [
244 "releasetools_binary_defaults",
245 "releasetools_add_img_to_target_files_defaults",
246 ],
247}
248
249python_binary_host {
Tao Bao2bbb07c2019-05-07 13:12:21 -0700250 name: "build_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700251 defaults: [
252 "releasetools_binary_defaults",
253 "releasetools_build_image_defaults",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700254 ],
255}
256
257python_binary_host {
258 name: "build_super_image",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700259 defaults: [
260 "releasetools_binary_defaults",
261 "releasetools_build_super_image_defaults",
262 ],
263}
264
265python_binary_host {
266 name: "check_ota_package_signature",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700267 defaults: ["releasetools_binary_defaults"],
268 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700269 "check_ota_package_signature.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700270 ],
Tao Bao2bbb07c2019-05-07 13:12:21 -0700271 libs: [
272 "releasetools_common",
273 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700274 required: [
275 "delta_generator",
276 ],
277}
278
279python_binary_host {
280 name: "check_target_files_signatures",
281 defaults: ["releasetools_binary_defaults"],
282 srcs: [
283 "check_target_files_signatures.py",
284 ],
285 libs: [
286 "releasetools_common",
287 ],
288 required: [
289 "aapt",
290 ],
291}
292
293python_binary_host {
Yifan Honge3ba82c2019-08-21 13:29:30 -0700294 name: "check_target_files_vintf",
295 defaults: [
296 "releasetools_binary_defaults",
297 "releasetools_check_target_files_vintf_defaults"
298 ],
299}
300
301python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700302 name: "img_from_target_files",
303 defaults: [
304 "releasetools_binary_defaults",
305 "releasetools_img_from_target_files_defaults",
306 ],
Tao Bao30e31142019-04-09 00:12:30 -0700307}
308
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700309python_binary_host {
Tao Baoe11a4602019-08-06 23:21:23 -0700310 name: "make_recovery_patch",
311 defaults: ["releasetools_binary_defaults"],
312 srcs: [
313 "make_recovery_patch.py",
314 ],
315 libs: [
316 "releasetools_common",
317 ],
318}
319
320python_binary_host {
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700321 name: "merge_builds",
322 defaults: ["releasetools_binary_defaults"],
323 srcs: [
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700324 "merge_builds.py",
325 ],
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700326 libs: [
Tao Bao005305a2019-08-05 13:00:44 -0700327 "releasetools_build_super_image",
Daniel Normanbfc51ef2019-07-24 14:34:54 -0700328 "releasetools_common",
329 ],
330}
331
Tao Bao8821d642019-08-05 12:05:45 -0700332python_binary_host {
Tao Bao3c7b2a62019-08-07 12:24:20 -0700333 name: "merge_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700334 defaults: ["releasetools_binary_defaults"],
335 srcs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700336 "merge_target_files.py",
Tao Bao8821d642019-08-05 12:05:45 -0700337 ],
338 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700339 "releasetools_add_img_to_target_files",
340 "releasetools_build_super_image",
Yifan Hongade0d3f2019-08-21 16:37:11 -0700341 "releasetools_check_target_files_vintf",
Tao Bao8821d642019-08-05 12:05:45 -0700342 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700343 "releasetools_img_from_target_files",
344 "releasetools_ota_from_target_files",
Tao Bao8821d642019-08-05 12:05:45 -0700345 ],
Tao Bao3c7b2a62019-08-07 12:24:20 -0700346}
347
348python_binary_host {
349 name: "ota_from_target_files",
350 defaults: [
351 "releasetools_binary_defaults",
352 "releasetools_ota_from_target_files_defaults",
353 ],
354}
355
356python_binary_host {
357 name: "ota_package_parser",
358 defaults: ["releasetools_binary_defaults"],
359 srcs: [
360 "ota_package_parser.py",
361 "rangelib.py",
Tao Bao8821d642019-08-05 12:05:45 -0700362 ],
363}
364
Tao Baoe11a4602019-08-06 23:21:23 -0700365python_binary_host {
366 name: "sparse_img",
367 defaults: ["releasetools_binary_defaults"],
368 srcs: [
369 "rangelib.py",
370 "sparse_img.py",
371 ],
Tao Baoe11a4602019-08-06 23:21:23 -0700372}
373
Tao Bao3c7b2a62019-08-07 12:24:20 -0700374python_binary_host {
375 name: "sign_apex",
376 defaults: ["releasetools_binary_defaults"],
377 srcs: [
378 "sign_apex.py",
379 ],
380 libs: [
381 "releasetools_apex_utils",
382 "releasetools_common",
383 ],
384}
385
386python_binary_host {
387 name: "sign_target_files_apks",
388 defaults: ["releasetools_binary_defaults"],
389 srcs: [
390 "sign_target_files_apks.py",
391 ],
392 libs: [
393 "releasetools_add_img_to_target_files",
394 "releasetools_apex_utils",
395 "releasetools_common",
396 ],
397}
398
399python_binary_host {
400 name: "validate_target_files",
401 defaults: ["releasetools_binary_defaults"],
402 srcs: [
403 "validate_target_files.py",
404 ],
405 libs: [
406 "releasetools_common",
407 ],
408}
409
410//
411// Tests.
412//
413
Tao Baoca82fc92019-05-01 21:58:03 -0700414python_defaults {
415 name: "releasetools_test_defaults",
Tao Bao30e31142019-04-09 00:12:30 -0700416 srcs: [
Tao Bao2bbb07c2019-05-07 13:12:21 -0700417 "check_ota_package_signature.py",
418 "check_target_files_signatures.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700419 "make_recovery_patch.py",
420 "merge_target_files.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700421 "ota_package_parser.py",
422 "sign_apex.py",
423 "sign_target_files_apks.py",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700424 "validate_target_files.py",
425
Tao Bao30e31142019-04-09 00:12:30 -0700426 "test_*.py",
427 ],
428 libs: [
Tao Bao3c7b2a62019-08-07 12:24:20 -0700429 "releasetools_add_img_to_target_files",
430 "releasetools_apex_utils",
431 "releasetools_build_image",
Tao Bao005305a2019-08-05 13:00:44 -0700432 "releasetools_build_super_image",
Yifan Hongccb86fe2019-08-22 15:52:26 -0700433 "releasetools_check_target_files_vintf",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700434 "releasetools_common",
Tao Bao3c7b2a62019-08-07 12:24:20 -0700435 "releasetools_img_from_target_files",
436 "releasetools_ota_from_target_files",
Tao Bao2bbb07c2019-05-07 13:12:21 -0700437 "releasetools_verity_utils",
Tao Bao30e31142019-04-09 00:12:30 -0700438 ],
439 data: [
Yifan Hongccb86fe2019-08-22 15:52:26 -0700440 "testdata/**/*",
Tao Bao30e31142019-04-09 00:12:30 -0700441 ],
442 required: [
443 "otatools",
444 ],
Tao Baoca82fc92019-05-01 21:58:03 -0700445}
446
447python_test_host {
448 name: "releasetools_test",
449 defaults: ["releasetools_test_defaults"],
450 main: "test_utils.py",
451 version: {
452 py2: {
453 enabled: true,
Tao Bao2bbb07c2019-05-07 13:12:21 -0700454 // When using embedded launcher, atest will try (but may fail) to load libc++.so from
455 // host, because the test executable won't be able to find the needed libs via its
456 // runpath.
Tao Baoca82fc92019-05-01 21:58:03 -0700457 embedded_launcher: false,
458 },
459 py3: {
460 enabled: false,
461 embedded_launcher: false,
462 },
463 },
464 test_suites: ["general-tests"],
465}
466
467python_test_host {
468 name: "releasetools_py3_test",
469 defaults: ["releasetools_test_defaults"],
470 main: "test_utils.py",
471 version: {
472 py2: {
473 enabled: false,
474 embedded_launcher: false,
475 },
476 py3: {
477 enabled: true,
478 embedded_launcher: false,
479 },
480 },
Tao Bao30e31142019-04-09 00:12:30 -0700481 test_suites: ["general-tests"],
482}