aboutsummaryrefslogtreecommitdiff
path: root/rules/apex/bundle.bzl
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2023-03-03 09:22:56 +0000
committerJingwen Chen <jingwen@google.com>2023-03-07 04:54:39 +0000
commitbc51c4d1416cd3e7957a41e1c51bf7d6d92f88b9 (patch)
treedf8383a9763a961975425e6f21e7b84cf6b9d5e6 /rules/apex/bundle.bzl
parentdf88977c50b821b8b1b74e3e955e357843ef43cc (diff)
downloadbazel-bc51c4d1416cd3e7957a41e1c51bf7d6d92f88b9.tar.gz
Add arm64only and x86_64only transitions to aab builds.
Also add support to producing apex bundle base zips with the right names for 64+32 packages. Verified all of these with filelist diff tests. For example: $ zipinfo -1 bazel-bin/build/bazel/vendor/google/build.bazel.examples.apex.minimal/build.bazel.examples.apex.minimal.aab BundleConfig.pb base/apex/armeabi-v7a.img base/apex/armeabi-v7a.build_info.pb base/root/apex_manifest.pb base/assets/NOTICE.html.gz base/apex/arm64-v8a.armeabi-v7a.img base/apex/arm64-v8a.armeabi-v7a.build_info.pb base/apex/arm64-v8a.img base/apex/arm64-v8a.build_info.pb base/apex/x86.img base/apex/x86.build_info.pb base/apex/x86_64.x86.img base/apex/x86_64.x86.build_info.pb base/apex/x86_64.img base/apex/x86_64.build_info.pb base/manifest/AndroidManifest.xml base/assets.pb base/apex.pb Also remove tests that are doing binary diffing - we're excluding everything, which makes the test not useful at all. Plus we don't have a goal of keeping everything bit for bit identical, as long as we understand where the differences lie. Also remove shell-based apex_aab_test for filelist diffing. The BUILD diff_test is much easier to maintain and debug. Test: new filelist diff tests Bug: 268335710 Fixes: 271424450 Fixes: 271421585 Change-Id: I43e3297952817e5df32ba2ccf926a98ee8ecc973
Diffstat (limited to 'rules/apex/bundle.bzl')
-rw-r--r--rules/apex/bundle.bzl12
1 files changed, 7 insertions, 5 deletions
diff --git a/rules/apex/bundle.bzl b/rules/apex/bundle.bzl
index 38429403..b4e57777 100644
--- a/rules/apex/bundle.bzl
+++ b/rules/apex/bundle.bzl
@@ -22,7 +22,7 @@ _arch_abi_map = {
"x86": "x86",
}
-def _proto_convert(actions, name, aapt2, arch, apex_file):
+def _proto_convert(actions, name, aapt2, apex_file):
"""Run 'aapt2 convert' to convert resource files to protobuf format. """
root, ext = paths.split_extension(apex_file.basename)
@@ -47,7 +47,7 @@ def _proto_convert(actions, name, aapt2, arch, apex_file):
)
return output_file
-def _base_file(actions, name, zip2zip, arch, apex_proto_file):
+def _base_file(actions, name, zip2zip, arch, secondary_arch, apex_proto_file):
"""Run zip2zip to transform the apex file the expected directory structure
with all files that will be included in the base module of aab file."""
@@ -58,6 +58,8 @@ def _base_file(actions, name, zip2zip, arch, apex_proto_file):
args.add("-i", apex_proto_file)
args.add("-o", output_file)
abi = _arch_abi_map[arch]
+ if secondary_arch:
+ abi += "." + _arch_abi_map[secondary_arch]
args.add_all([
"apex_payload.img:apex/%s.img" % abi,
"apex_build_info.pb:apex/%s.build_info.pb" % abi,
@@ -130,7 +132,7 @@ def _merge_apex_zip_with_config(actions, name, soong_zip, merge_zips, apex_zip,
)
return merged_zip
-def apex_zip_files(actions, name, tools, apex_file, arch):
+def apex_zip_files(actions, name, tools, apex_file, arch, secondary_arch):
"""Create apex zip files used to create an APEX bundle.
Args:
@@ -140,8 +142,8 @@ def apex_zip_files(actions, name, tools, apex_file, arch):
apex_file: File, APEX file
arch: string, the arch of the target configuration of the target requesting the action
"""
- apex_proto = _proto_convert(actions, name, tools.aapt2, arch, apex_file)
- apex_zip = _base_file(actions, name, tools.zip2zip, arch, apex_proto)
+ apex_proto = _proto_convert(actions, name, tools.aapt2, apex_file)
+ apex_zip = _base_file(actions, name, tools.zip2zip, arch, secondary_arch, apex_proto)
merged_zip = _merge_apex_zip_with_config(actions, name, tools.soong_zip, tools.merge_zips, apex_zip, apex_file)
return struct(