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