Do not override / crash if baseline.prof already exists in assets/dexopt
- Dominant language
- Java
- Stars
- 4k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
**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
Contributor guide
Assessment
This issue has not been assessed yet.