• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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
15//
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
25package {
26    default_applicable_licenses: ["Android-Apache-2.0"],
27}
28
29python_defaults {
30    name: "releasetools_add_img_to_target_files_defaults",
31    srcs: [
32        "add_img_to_target_files.py",
33    ],
34    libs: [
35        "ota_metadata_proto",
36        "releasetools_apex_utils",
37        "releasetools_build_image",
38        "releasetools_build_super_image",
39        "releasetools_common",
40    ],
41    required: [
42        "care_map_generator",
43    ],
44}
45
46python_defaults {
47    name: "releasetools_build_image_defaults",
48    srcs: [
49        "build_image.py",
50    ],
51    libs: [
52        "releasetools_common",
53        "releasetools_verity_utils",
54    ],
55    required: [
56        "blk_alloc_to_base_fs",
57        "e2fsck",
58        "mkerofsimage.sh",
59        "mkuserimg_mke2fs",
60        "simg2img",
61        "tune2fs",
62        "mkf2fsuserimg.sh",
63        "fsck.f2fs",
64    ],
65}
66
67python_defaults {
68    name: "releasetools_build_super_image_defaults",
69    srcs: [
70        "build_super_image.py",
71    ],
72    libs: [
73        "releasetools_common",
74    ],
75}
76
77python_defaults {
78    name: "releasetools_img_from_target_files_defaults",
79    srcs: [
80        "img_from_target_files.py",
81    ],
82    libs: [
83        "releasetools_build_super_image",
84        "releasetools_common",
85    ],
86}
87
88python_defaults {
89    name: "releasetools_check_target_files_vintf_defaults",
90    srcs: [
91        "check_target_files_vintf.py",
92    ],
93    libs: [
94        "releasetools_common",
95    ],
96    required: [
97        "checkvintf",
98    ],
99}
100
101python_library_host {
102    name: "ota_metadata_proto",
103    version: {
104        py2: {
105            enabled: true,
106        },
107        py3: {
108            enabled: true,
109        },
110    },
111    srcs: [
112       "ota_metadata.proto",
113    ],
114    proto: {
115        canonical_path_from_root: false,
116    },
117}
118
119cc_library_static {
120    name: "ota_metadata_proto_cc",
121    srcs: [
122       "ota_metadata.proto",
123    ],
124    host_supported: true,
125    recovery_available: true,
126    proto: {
127        canonical_path_from_root: false,
128        type: "lite",
129        export_proto_headers: true,
130    },
131}
132
133java_library_static {
134    name: "ota_metadata_proto_java",
135    host_supported: true,
136    proto: {
137        type: "nano",
138    },
139    srcs: ["ota_metadata.proto"],
140    sdk_version: "9",
141    target: {
142        android: {
143            jarjar_rules: "jarjar-rules.txt",
144        },
145        host: {
146            static_libs: ["libprotobuf-java-nano"],
147        },
148    },
149    visibility: ["//frameworks/base:__subpackages__"]
150}
151
152python_defaults {
153    name: "releasetools_ota_from_target_files_defaults",
154    srcs: [
155        "edify_generator.py",
156        "non_ab_ota.py",
157        "ota_from_target_files.py",
158        "ota_utils.py",
159        "target_files_diff.py",
160    ],
161    libs: [
162        "ota_metadata_proto",
163        "releasetools_check_target_files_vintf",
164        "releasetools_common",
165        "releasetools_verity_utils",
166        "apex_manifest",
167    ],
168    required: [
169        "brillo_update_payload",
170        "checkvintf",
171        "minigzip",
172        "lz4",
173        "toybox",
174        "unpack_bootimg",
175        "deapexer",
176    ],
177    target: {
178        darwin: {
179            // required module "brillo_update_payload" is disabled on darwin
180            enabled: false,
181        },
182    },
183}
184
185//
186// Host libraries.
187//
188
189python_defaults {
190    name: "releasetools_library_defaults",
191    version: {
192        py2: {
193            enabled: true,
194        },
195        py3: {
196            enabled: true,
197        },
198    },
199}
200
201python_library_host {
202    name: "releasetools_add_img_to_target_files",
203    defaults: [
204        "releasetools_library_defaults",
205        "releasetools_add_img_to_target_files_defaults",
206    ],
207}
208
209python_library_host {
210    name: "releasetools_apex_utils",
211    defaults: ["releasetools_library_defaults"],
212    srcs: [
213        "apex_utils.py",
214    ],
215    libs: [
216        "apex_manifest",
217        "ota_metadata_proto",
218        "releasetools_common",
219    ],
220}
221
222python_library_host {
223    name: "releasetools_build_image",
224    defaults: [
225        "releasetools_library_defaults",
226        "releasetools_build_image_defaults",
227    ],
228}
229
230python_library_host {
231    name: "releasetools_build_super_image",
232    defaults: [
233        "releasetools_library_defaults",
234        "releasetools_build_super_image_defaults",
235    ],
236}
237
238python_library_host {
239    name: "releasetools_check_target_files_vintf",
240    defaults: [
241        "releasetools_library_defaults",
242        "releasetools_check_target_files_vintf_defaults",
243    ],
244}
245
246python_library_host {
247    name: "releasetools_common",
248    defaults: ["releasetools_library_defaults"],
249    srcs: [
250        "blockimgdiff.py",
251        "common.py",
252        "images.py",
253        "rangelib.py",
254        "sparse_img.py",
255    ],
256    // Only the tools that are referenced directly are listed as required modules. For example,
257    // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
258    required: [
259        "aapt2",
260        "boot_signer",
261        "brotli",
262        "bsdiff",
263        "imgdiff",
264        "minigzip",
265        "lz4",
266        "mkbootfs",
267        "signapk",
268        "toybox",
269        "unpack_bootimg",
270    ],
271}
272
273python_library_host {
274    name: "releasetools_img_from_target_files",
275    defaults: [
276        "releasetools_library_defaults",
277        "releasetools_img_from_target_files_defaults",
278    ],
279}
280
281python_library_host {
282    name: "releasetools_ota_from_target_files",
283    defaults: [
284        "releasetools_library_defaults",
285        "releasetools_ota_from_target_files_defaults",
286    ],
287}
288
289python_library_host {
290    name: "releasetools_verity_utils",
291    defaults: ["releasetools_library_defaults"],
292    srcs: [
293        "verity_utils.py",
294    ],
295    required: [
296        "append2simg",
297        "build_verity_metadata",
298        "build_verity_tree",
299        "fec",
300    ],
301}
302
303//
304// Host binaries.
305//
306
307python_defaults {
308    name: "releasetools_binary_defaults",
309    version: {
310        py2: {
311            enabled: true,
312            embedded_launcher: true,
313        },
314        py3: {
315            enabled: false,
316            embedded_launcher: false,
317        },
318    },
319    // TODO (b/140144201) Build imgdiff from releasetools_common
320    required: [
321        "aapt2",
322        "boot_signer",
323        "brotli",
324        "bsdiff",
325        "deapexer",
326        "imgdiff",
327        "minigzip",
328        "lz4",
329        "mkbootfs",
330        "signapk",
331        "toybox",
332        "unpack_bootimg",
333    ],
334}
335
336python_binary_host {
337    name: "add_img_to_target_files",
338    defaults: [
339        "releasetools_binary_defaults",
340        "releasetools_add_img_to_target_files_defaults",
341    ],
342}
343
344python_binary_host {
345    name: "build_image",
346    defaults: [
347        "releasetools_binary_defaults",
348        "releasetools_build_image_defaults",
349    ],
350}
351
352python_binary_host {
353    name: "build_super_image",
354    defaults: [
355        "releasetools_binary_defaults",
356        "releasetools_build_super_image_defaults",
357    ],
358}
359
360python_binary_host {
361    name: "check_partition_sizes",
362    srcs: [
363        "check_partition_sizes.py",
364    ],
365    libs: [
366        "releasetools_common",
367    ],
368    defaults: [
369        "releasetools_binary_defaults",
370    ],
371}
372
373python_binary_host {
374    name: "check_ota_package_signature",
375    defaults: ["releasetools_binary_defaults"],
376    srcs: [
377        "check_ota_package_signature.py",
378    ],
379    libs: [
380        "releasetools_common",
381    ],
382    required: [
383        "delta_generator",
384    ],
385    target: {
386        darwin: {
387            // required module "delta_generator" is disabled on darwin
388            enabled: false,
389        },
390    },
391}
392
393python_binary_host {
394    name: "check_target_files_signatures",
395    defaults: ["releasetools_binary_defaults"],
396    srcs: [
397        "check_target_files_signatures.py",
398    ],
399    libs: [
400        "releasetools_common",
401    ],
402    required: [
403        "aapt",
404    ],
405}
406
407python_binary_host {
408    name: "check_target_files_vintf",
409    defaults: [
410        "releasetools_binary_defaults",
411        "releasetools_check_target_files_vintf_defaults"
412    ],
413}
414
415python_binary_host {
416    name: "img_from_target_files",
417    defaults: [
418        "releasetools_binary_defaults",
419        "releasetools_img_from_target_files_defaults",
420    ],
421}
422
423python_defaults {
424    name: "releasetools_find_shareduid_violation_defaults",
425    srcs: [
426        "find_shareduid_violation.py",
427    ],
428    libs: [
429        "releasetools_common",
430    ],
431}
432
433python_binary_host {
434    name: "find_shareduid_violation",
435    defaults: [
436        "releasetools_binary_defaults",
437        "releasetools_find_shareduid_violation_defaults",
438    ],
439}
440
441python_library_host {
442    name: "releasetools_find_shareduid_violation",
443    defaults: [
444        "releasetools_find_shareduid_violation_defaults",
445        "releasetools_library_defaults",
446    ],
447}
448
449python_binary_host {
450    name: "make_recovery_patch",
451    defaults: ["releasetools_binary_defaults"],
452    srcs: [
453        "make_recovery_patch.py",
454    ],
455    libs: [
456        "releasetools_common",
457    ],
458}
459
460python_binary_host {
461    name: "merge_builds",
462    defaults: ["releasetools_binary_defaults"],
463    srcs: [
464        "merge_builds.py",
465    ],
466    libs: [
467        "releasetools_build_super_image",
468        "releasetools_common",
469    ],
470}
471
472python_binary_host {
473    name: "merge_target_files",
474    defaults: ["releasetools_binary_defaults"],
475    srcs: [
476        "merge_target_files.py",
477    ],
478    libs: [
479        "releasetools_add_img_to_target_files",
480        "releasetools_build_super_image",
481        "releasetools_check_target_files_vintf",
482        "releasetools_common",
483        "releasetools_find_shareduid_violation",
484        "releasetools_img_from_target_files",
485        "releasetools_ota_from_target_files",
486    ],
487    required: [
488        "checkvintf",
489        "host_init_verifier",
490        "secilc",
491    ],
492    target: {
493        darwin: {
494            // libs dep "releasetools_ota_from_target_files" is disabled on darwin
495            enabled: false,
496        },
497    },
498}
499
500python_binary_host {
501    name: "ota_from_target_files",
502    defaults: [
503        "releasetools_binary_defaults",
504        "releasetools_ota_from_target_files_defaults",
505    ],
506}
507
508python_binary_host {
509    name: "ota_package_parser",
510    defaults: ["releasetools_binary_defaults"],
511    srcs: [
512        "ota_package_parser.py",
513        "rangelib.py",
514    ],
515}
516
517python_binary_host {
518    name: "sparse_img",
519    defaults: ["releasetools_binary_defaults"],
520    srcs: [
521        "rangelib.py",
522        "sparse_img.py",
523    ],
524}
525
526python_binary_host {
527    name: "sign_apex",
528    defaults: ["releasetools_binary_defaults"],
529    srcs: [
530        "sign_apex.py",
531    ],
532    libs: [
533        "releasetools_apex_utils",
534        "releasetools_common",
535    ],
536}
537
538python_binary_host {
539    name: "sign_target_files_apks",
540    defaults: ["releasetools_binary_defaults"],
541    srcs: [
542        "sign_target_files_apks.py",
543    ],
544    libs: [
545        "releasetools_add_img_to_target_files",
546        "releasetools_apex_utils",
547        "releasetools_common",
548    ],
549}
550
551python_binary_host {
552    name: "validate_target_files",
553    defaults: ["releasetools_binary_defaults"],
554    srcs: [
555        "validate_target_files.py",
556    ],
557    libs: [
558        "releasetools_common",
559    ],
560}
561
562python_binary_host {
563    name: "verity_utils",
564    defaults: ["releasetools_binary_defaults"],
565    srcs: [
566        "verity_utils.py",
567    ],
568    libs: [
569        "releasetools_common",
570    ],
571    required: [
572        "append2simg",
573        "build_verity_metadata",
574        "build_verity_tree",
575        "fec",
576    ],
577}
578
579//
580// Tests.
581//
582
583python_defaults {
584    name: "releasetools_test_defaults",
585    srcs: [
586        "check_ota_package_signature.py",
587        "check_partition_sizes.py",
588        "check_target_files_signatures.py",
589        "make_recovery_patch.py",
590        "merge_target_files.py",
591        "ota_package_parser.py",
592        "sign_apex.py",
593        "sign_target_files_apks.py",
594        "validate_target_files.py",
595
596        "test_*.py",
597    ],
598    libs: [
599        "releasetools_add_img_to_target_files",
600        "releasetools_apex_utils",
601        "releasetools_build_image",
602        "releasetools_build_super_image",
603        "releasetools_check_target_files_vintf",
604        "releasetools_common",
605        "releasetools_find_shareduid_violation",
606        "releasetools_img_from_target_files",
607        "releasetools_ota_from_target_files",
608        "releasetools_verity_utils",
609    ],
610    data: [
611        "testdata/**/*",
612        ":com.android.apex.compressed.v1",
613        ":com.android.apex.compressed.v1_original",
614    ],
615    target: {
616        darwin: {
617            // libs dep "releasetools_ota_from_target_files" is disabled on darwin
618            enabled: false,
619        },
620    },
621    required: [
622        "deapexer",
623    ],
624}
625
626python_test_host {
627    name: "releasetools_test",
628    defaults: ["releasetools_test_defaults"],
629    main: "test_utils.py",
630    version: {
631        py2: {
632            enabled: true,
633            // When using embedded launcher, atest will try (but may fail) to load libc++.so from
634            // host, because the test executable won't be able to find the needed libs via its
635            // runpath.
636            embedded_launcher: false,
637        },
638        py3: {
639            enabled: false,
640            embedded_launcher: false,
641        },
642    },
643    test_options: {
644        unit_test: true,
645    },
646}
647
648python_test_host {
649    name: "releasetools_py3_test",
650    defaults: ["releasetools_test_defaults"],
651    main: "test_utils.py",
652    test_suites: ["general-tests"],
653    version: {
654        py2: {
655            enabled: false,
656            embedded_launcher: false,
657        },
658        py3: {
659            enabled: true,
660            embedded_launcher: false,
661        },
662    },
663    test_options: {
664        unit_test: true,
665    },
666}
667