platform_build/tools/releasetools/Android.bp

623 lines
13 KiB
Text
Raw Normal View History

// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Module-specific defaults.
//
// For module X, if we need to build it both as a library and an executable:
// - A default rule `releasetools_X_defaults` is created, which lists `srcs`, `libs` and
// `required` properties.
// - `python_library_host` and `python_binary_host` are created by listing
// `releasetools_X_defaults` in their defaults.
//
[LSC] Add LOCAL_LICENSE_KINDS to build/make Added SPDX-license-identifier-Apache-2.0 to: target/product/sysconfig/Android.bp tools/apicheck/Android.bp tools/product_config/Android.bp tools/releasetools/Android.bp tools/signapk/Android.bp tools/signtos/Android.bp tools/zipalign/Android.bp tools/ziptime/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL SPDX-license-identifier-MIT legacy_not_a_contribution legacy_restricted to: Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-CC-BY SPDX-license-identifier-GPL SPDX-license-identifier-MIT to: tools/Android.bp tools/droiddoc/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL SPDX-license-identifier-MIT to: core/base_rules.mk core/dex_preopt_libart.mk core/package_internal.mk Added SPDX-license-identifier-Apache-2.0 legacy_not_a_contribution to: target/board/Android.mk Added legacy_restricted to: core/tasks/tools/package-modules.mk target/product/gsi/Android.bp target/product/gsi/Android.mk target/product/security/Android.bp target/product/security/Android.mk tools/acp/Android.bp tools/atree/Android.bp tools/fs_config/Android.bp tools/fs_config/Android.mk tools/fs_get_stats/Android.bp tools/libhost/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Id67a4eb1312940f999643b2ae57f45f34f120724
2021-02-13 06:42:54 +01:00
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
python_defaults {
name: "releasetools_add_img_to_target_files_defaults",
srcs: [
"add_img_to_target_files.py",
],
libs: [
"ota_metadata_proto",
"releasetools_apex_utils",
"releasetools_build_image",
"releasetools_build_super_image",
"releasetools_common",
"libavbtool",
],
required: [
"care_map_generator",
],
}
python_defaults {
name: "releasetools_build_image_defaults",
srcs: [
"build_image.py",
],
libs: [
"releasetools_common",
"releasetools_fsverity_metadata_generator",
"releasetools_verity_utils",
],
required: [
"blk_alloc_to_base_fs",
"e2fsck",
"fsck.erofs",
"img2simg",
"mkfs.erofs",
"mkuserimg_mke2fs",
"simg2img",
"tune2fs",
"mkf2fsuserimg",
"fsck.f2fs",
],
}
python_defaults {
name: "releasetools_build_super_image_defaults",
srcs: [
"build_super_image.py",
],
libs: [
"releasetools_common",
],
}
python_defaults {
name: "releasetools_img_from_target_files_defaults",
srcs: [
"img_from_target_files.py",
],
libs: [
"releasetools_build_super_image",
"releasetools_common",
],
}
python_defaults {
name: "releasetools_check_target_files_vintf_defaults",
srcs: [
"check_target_files_vintf.py",
],
libs: [
"releasetools_common",
],
required: [
"checkvintf",
"deapexer",
"dump_apex_info",
],
}
python_library_host {
name: "ota_metadata_proto",
srcs: [
"ota_metadata.proto",
],
proto: {
canonical_path_from_root: false,
},
}
cc_library_static {
name: "ota_metadata_proto_cc",
srcs: [
"ota_metadata.proto",
],
host_supported: true,
recovery_available: true,
proto: {
canonical_path_from_root: false,
type: "lite",
export_proto_headers: true,
},
}
java_library_static {
name: "ota_metadata_proto_java",
host_supported: true,
proto: {
type: "nano",
},
srcs: ["ota_metadata.proto"],
sdk_version: "9",
target: {
android: {
jarjar_rules: "jarjar-rules.txt",
},
host: {
static_libs: ["libprotobuf-java-nano"],
},
},
visibility: ["//frameworks/base:__subpackages__"]
}
python_defaults {
name: "releasetools_ota_from_target_files_defaults",
srcs: [
"edify_generator.py",
"non_ab_ota.py",
"ota_from_target_files.py",
"target_files_diff.py",
],
libs: [
"ota_metadata_proto",
"releasetools_check_target_files_vintf",
"releasetools_common",
"releasetools_verity_utils",
"apex_manifest",
"care_map_proto_py",
"ota_utils_lib",
],
required: [
"brillo_update_payload",
"checkvintf",
"generate_gki_certificate",
"minigzip",
"lz4",
"toybox",
"unpack_bootimg",
"deapexer",
],
target: {
darwin: {
// required module "brillo_update_payload" is disabled on darwin
enabled: false,
},
},
}
//
// Host libraries.
//
python_library_host {
name: "releasetools_add_img_to_target_files",
defaults: [
"releasetools_add_img_to_target_files_defaults",
],
}
python_library_host {
name: "releasetools_apex_utils",
srcs: [
"apex_utils.py",
],
libs: [
"apex_manifest",
"ota_metadata_proto",
"releasetools_common",
],
}
python_library_host {
name: "releasetools_build_image",
defaults: [
"releasetools_build_image_defaults",
],
}
python_library_host {
name: "releasetools_build_super_image",
defaults: [
"releasetools_build_super_image_defaults",
],
}
python_library_host {
name: "releasetools_check_target_files_vintf",
defaults: [
"releasetools_check_target_files_vintf_defaults",
],
}
python_library_host {
name: "releasetools_common",
srcs: [
"blockimgdiff.py",
"common.py",
"images.py",
"rangelib.py",
"sparse_img.py",
],
// Only the tools that are referenced directly are listed as required modules. For example,
// `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
required: [
"aapt2",
"boot_signer",
"brotli",
"bsdiff",
"generate_gki_certificate",
"imgdiff",
"minigzip",
"lz4",
"mkbootfs",
"signapk",
"toybox",
"unpack_bootimg",
],
}
python_library_host {
name: "releasetools_img_from_target_files",
defaults: [
"releasetools_img_from_target_files_defaults",
],
}
python_library_host {
name: "releasetools_ota_from_target_files",
defaults: [
"releasetools_ota_from_target_files_defaults",
],
}
python_library_host {
name: "releasetools_fsverity_metadata_generator",
srcs: [
"fsverity_metadata_generator.py",
],
libs: [
"fsverity_digests_proto_python",
],
}
python_library_host {
name: "releasetools_verity_utils",
srcs: [
"verity_utils.py",
],
required: [
"append2simg",
"build_verity_metadata",
"build_verity_tree",
"fec",
],
}
//
// Host binaries.
//
python_defaults {
name: "releasetools_binary_defaults",
version: {
py3: {
Use python 3 for release tools The release tools have already been updated in prior cls to support python 3. To test this, I added code to print the script name to a temp file at the beginning of every script, and then ran various builds, ensuring that the scripts were run afterwards. The builds run: m brillo_update_payload checkvintf minigzip lz4 toybox unpack_bootimg deapexer (needed for releasetools_test) m (as both sdk_phone_x86_64 and beagle_x15) m target-files-package (as both sdk_phone_x86_64 and beagle_x15) m releasetools_test && out/host/linux-x86/nativetest64/releasetools_test/releasetools_test (25 errors with and without python3) m check_target_files_signatures apksigner target-files-package && out/host/linux-x86/bin/check_target_files_signatures out/target/product/emulator_x86_64/obj/PACKAGING/target_files_intermediates/sdk_phone_x86_64-target_files-eng.colefaust.zip m dist As aosp_cf_x86_64_phone: m dist && sign_target_files_apks out/dist/aosp_cf_x86_64_phone-target_files-eng.$USER.zip /tmp/signed_target_files.zip && validate_target_files /tmp/signed_target_files.zip This hit all the scripts except for make_recovery_patch, merge_builds, and ota_package_parser. I couldn't find anything that uses merge_builds, so it must only be run manually. make_recovery_patch and ota_package_parser are only run if TARGET_OTA_ALLOW_NON_AB is true (among other things), which is not the case for any product in aosp. Test: Described in commit message + presubmits Change-Id: I1a29eafa7ff1a69973b27055e311de77f7ee628b
2021-11-05 00:59:39 +01:00
embedded_launcher: true,
},
},
// TODO (b/140144201) Build imgdiff from releasetools_common
required: [
"aapt2",
"boot_signer",
"brotli",
"bsdiff",
"deapexer",
"generate_gki_certificate",
"imgdiff",
"minigzip",
"lz4",
"mkbootfs",
"signapk",
"toybox",
"unpack_bootimg",
],
}
python_binary_host {
name: "add_img_to_target_files",
defaults: [
"releasetools_binary_defaults",
"releasetools_add_img_to_target_files_defaults",
],
}
python_library_host {
name: "ota_utils_lib",
srcs: [
"ota_utils.py",
"payload_signer.py",
],
}
python_binary_host {
name: "merge_ota",
version: {
py3: {
embedded_launcher: true,
},
},
srcs: [
"merge_ota.py",
],
libs: [
"ota_metadata_proto",
"update_payload",
"care_map_proto_py",
"releasetools_common",
"ota_utils_lib",
],
}
python_binary_host {
name: "build_image",
defaults: [
"releasetools_binary_defaults",
"releasetools_build_image_defaults",
],
}
python_binary_host {
name: "build_super_image",
defaults: [
"releasetools_binary_defaults",
"releasetools_build_super_image_defaults",
],
}
python_binary_host {
name: "check_partition_sizes",
srcs: [
"check_partition_sizes.py",
],
libs: [
"releasetools_common",
],
defaults: [
"releasetools_binary_defaults",
],
}
python_binary_host {
name: "check_ota_package_signature",
defaults: ["releasetools_binary_defaults"],
srcs: [
"check_ota_package_signature.py",
],
libs: [
"releasetools_common",
],
required: [
"delta_generator",
],
target: {
darwin: {
// required module "delta_generator" is disabled on darwin
enabled: false,
},
},
}
python_binary_host {
name: "check_target_files_signatures",
defaults: ["releasetools_binary_defaults"],
srcs: [
"check_target_files_signatures.py",
],
libs: [
"releasetools_common",
],
required: [
"aapt2",
],
}
python_binary_host {
name: "check_target_files_vintf",
defaults: [
"releasetools_binary_defaults",
"releasetools_check_target_files_vintf_defaults"
],
}
python_binary_host {
name: "img_from_target_files",
defaults: [
"releasetools_binary_defaults",
"releasetools_img_from_target_files_defaults",
],
}
python_defaults {
name: "releasetools_find_shareduid_violation_defaults",
srcs: [
"find_shareduid_violation.py",
],
libs: [
"releasetools_common",
],
}
python_binary_host {
name: "find_shareduid_violation",
defaults: [
"releasetools_binary_defaults",
"releasetools_find_shareduid_violation_defaults",
],
}
python_library_host {
name: "releasetools_find_shareduid_violation",
defaults: [
"releasetools_find_shareduid_violation_defaults",
],
}
python_binary_host {
name: "make_recovery_patch",
defaults: ["releasetools_binary_defaults"],
srcs: [
"make_recovery_patch.py",
],
libs: [
"releasetools_common",
],
}
python_binary_host {
name: "ota_from_target_files",
defaults: [
"releasetools_binary_defaults",
"releasetools_ota_from_target_files_defaults",
],
}
python_binary_host {
name: "ota_package_parser",
defaults: ["releasetools_binary_defaults"],
srcs: [
"ota_package_parser.py",
"rangelib.py",
],
}
python_binary_host {
name: "sparse_img",
defaults: ["releasetools_binary_defaults"],
srcs: [
"rangelib.py",
"sparse_img.py",
],
}
python_binary_host {
name: "sign_apex",
defaults: ["releasetools_binary_defaults"],
srcs: [
"sign_apex.py",
],
libs: [
"releasetools_apex_utils",
"releasetools_common",
],
}
python_binary_host {
name: "sign_target_files_apks",
defaults: ["releasetools_binary_defaults"],
srcs: [
"sign_target_files_apks.py",
],
libs: [
"releasetools_add_img_to_target_files",
"releasetools_apex_utils",
"releasetools_common",
],
}
python_binary_host {
name: "validate_target_files",
defaults: ["releasetools_binary_defaults"],
srcs: [
"validate_target_files.py",
],
libs: [
"releasetools_common",
],
}
python_binary_host {
name: "verity_utils",
defaults: ["releasetools_binary_defaults"],
srcs: [
"verity_utils.py",
],
libs: [
"releasetools_common",
],
required: [
"append2simg",
"build_verity_metadata",
"build_verity_tree",
"fec",
],
}
python_binary_host {
name: "fsverity_metadata_generator",
defaults: ["releasetools_binary_defaults"],
srcs: [
"fsverity_metadata_generator.py",
],
required: [
"fsverity",
],
}
//
// Tests.
//
python_defaults {
name: "releasetools_test_defaults",
srcs: [
"check_ota_package_signature.py",
"check_partition_sizes.py",
"check_target_files_signatures.py",
"make_recovery_patch.py",
"ota_package_parser.py",
"sign_apex.py",
"sign_target_files_apks.py",
"validate_target_files.py",
"merge_ota.py",
":releasetools_merge_sources",
":releasetools_merge_tests",
"test_*.py",
],
libs: [
"releasetools_add_img_to_target_files",
"releasetools_apex_utils",
"releasetools_build_image",
"releasetools_build_super_image",
"releasetools_check_target_files_vintf",
"releasetools_common",
"releasetools_find_shareduid_violation",
"releasetools_img_from_target_files",
"releasetools_ota_from_target_files",
"releasetools_verity_utils",
"update_payload",
],
data: [
"testdata/**/*",
":com.android.apex.compressed.v1",
":com.android.apex.compressed.v1_original",
],
target: {
darwin: {
// libs dep "releasetools_ota_from_target_files" is disabled on darwin
enabled: false,
},
},
required: [
"deapexer",
],
}
python_test_host {
name: "releasetools_test",
defaults: ["releasetools_test_defaults"],
main: "test_utils.py",
Use python 3 for release tools The release tools have already been updated in prior cls to support python 3. To test this, I added code to print the script name to a temp file at the beginning of every script, and then ran various builds, ensuring that the scripts were run afterwards. The builds run: m brillo_update_payload checkvintf minigzip lz4 toybox unpack_bootimg deapexer (needed for releasetools_test) m (as both sdk_phone_x86_64 and beagle_x15) m target-files-package (as both sdk_phone_x86_64 and beagle_x15) m releasetools_test && out/host/linux-x86/nativetest64/releasetools_test/releasetools_test (25 errors with and without python3) m check_target_files_signatures apksigner target-files-package && out/host/linux-x86/bin/check_target_files_signatures out/target/product/emulator_x86_64/obj/PACKAGING/target_files_intermediates/sdk_phone_x86_64-target_files-eng.colefaust.zip m dist As aosp_cf_x86_64_phone: m dist && sign_target_files_apks out/dist/aosp_cf_x86_64_phone-target_files-eng.$USER.zip /tmp/signed_target_files.zip && validate_target_files /tmp/signed_target_files.zip This hit all the scripts except for make_recovery_patch, merge_builds, and ota_package_parser. I couldn't find anything that uses merge_builds, so it must only be run manually. make_recovery_patch and ota_package_parser are only run if TARGET_OTA_ALLOW_NON_AB is true (among other things), which is not the case for any product in aosp. Test: Described in commit message + presubmits Change-Id: I1a29eafa7ff1a69973b27055e311de77f7ee628b
2021-11-05 00:59:39 +01:00
// Don't use embedded_launcher, atest will try (but may fail) to load libc++.so from
// host, because the test executable won't be able to find the needed libs via its
// runpath.
test_options: {
unit_test: true,
},
}