Skip to content

Commit cc61729

Browse files
ted-xiecopybara-github
authored andcommitted
Use singlejar for ZipARTProfiles
... instead of the ijar zipper. NOTE: This change will create some minor APK diffs, since the zip entries for the baseline profiles have slightly different metadata: * Zip spec version (from 0.0 to 2.0) * Filesystem type (from 'unx' to 'FAT') * Baseline profile files no longer executable. PiperOrigin-RevId: 796851818 Change-Id: Ie171348a6b26c6bca571b7bc169df2ccd3b05db3
1 parent aa8f070 commit cc61729

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

rules/android_binary/impl.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ def _process_art_profile(ctx, validation_ctx, bp_ctx, dex_ctx, optimize_ctx, **_
731731
merged_profile = merged_baseline_profile,
732732
proguard_output_map = proguard_output_map,
733733
profgen = get_android_toolchain(ctx).profgen.files_to_run,
734-
zipper = get_android_toolchain(ctx).zipper.files_to_run,
735734
toolchain_type = ANDROID_TOOLCHAIN_TYPE,
736735
)
737736
return ProviderInfo(

rules/baseline_profiles.bzl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
Defines baseline profiles processing methods in Android Rules.
1616
"""
1717

18+
load("//rules:common.bzl", _common = "common")
19+
load("//rules:java.bzl", _java = "java")
1820
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
1921

2022
visibility(PROJECT_VISIBILITY)
@@ -103,7 +105,6 @@ def _process_art_profile(
103105
merged_profile,
104106
proguard_output_map = None,
105107
profgen = None,
106-
zipper = None,
107108
toolchain_type = None):
108109
""" Compiles the merged baseline profile.
109110
@@ -117,7 +118,6 @@ def _process_art_profile(
117118
merged_profile: File. The merged profile from transitive baseline profile files.
118119
proguard_output_map: File. Optional. The proguard output mapping file.
119120
profgen: FilesToRunProvider. The profgen executable for profile compilation.
120-
zipper: FilesToRunProvider. An executable for compressing files to an archive.
121121
toolchain_type: Label or String. Toolchain type of the executable used in actions.
122122
Returns:
123123
Provider info containing BaselineProfileProvider for all merged profiles.
@@ -148,19 +148,17 @@ def _process_art_profile(
148148

149149
# Zip ART profiles
150150
output_profile_zip = _get_profile_artifact(ctx, "art_profile.zip")
151-
zip_args = ctx.actions.args()
152-
zip_args.add("c", output_profile_zip)
153-
zip_args.add(output_profile.path, format = "assets/dexopt/baseline.prof=%s")
154-
zip_args.add(output_profile_meta.path, format = "assets/dexopt/baseline.profm=%s")
155-
ctx.actions.run(
151+
152+
_java.singlejar(
153+
ctx,
154+
compression = False,
155+
inputs = [],
156+
output = output_profile_zip,
156157
mnemonic = "ZipARTProfiles",
157-
executable = zipper,
158158
progress_message = "Zip ART Profiles for %{label}",
159-
arguments = [zip_args],
160-
inputs = [output_profile, output_profile_meta],
161-
outputs = [output_profile_zip],
162-
use_default_shell_env = True,
163-
toolchain = toolchain_type,
159+
resource_paths = [output_profile.path + ":assets/dexopt/baseline.prof", output_profile_meta.path + ":assets/dexopt/baseline.profm"],
160+
resources = [output_profile, output_profile_meta],
161+
java_toolchain = _common.get_java_toolchain(ctx),
164162
)
165163
return output_profile_zip
166164

0 commit comments

Comments
 (0)