bundletool icon indicating copy to clipboard operation
bundletool copied to clipboard

Do not override / crash if baseline.prof already exists in assets/dexopt

Open benjaminRomano opened this issue 2 years ago • 1 comments

Describe the bug There was a time where AGP + Bundletool did not work correctly when appending baseline profile data into an App Bundle.

Bundletool did not yet support the legacy bundle metadata assets.dexopt which AGP was using. We worked around this by manually inserting our baseline.prof file into the assets/dexopt directory ourselves. Circumventing the non-existent bundletool logic and broken logic in AGP (ref: https://partnerissuetracker.corp.google.com/issues/230361284).

This has been fixed now in newer versions of Bundletool; however, we were still using our same logic to directly insert baseline profiles into assets/dexopt/baseline.prof. This eventually broke when we upgraded to AGP 7.2 which will automatically generate baseline profile into the new com.android.tools.build.profiles metadata path.

Effectively, this default baseline profile metadata has been overriding our actual baseline profiles.

Ask

In BinaryArtProfilesInjector, there should be a check to see if a assets/dexopt/baseline.prof file already exists and either skip or fail as a correctness issue.

In the meantime, we will be fixing our logic to insert the baseline profile into the correct spot.

Bundletool version(s) affected Version: 14.0.0

benjaminRomano avatar Feb 17 '23 00:02 benjaminRomano

We will add validation to ensure assets/dexopt/baseline.prof is not placed in its APK location in one of next bundletool releases.

ymakhno avatar Aug 09 '23 23:08 ymakhno