Status Update
Comments
yc...@gmail.com <yc...@gmail.com> #2
This also seems to apply to baseline-prof.txt
ze...@google.com <ze...@google.com>
ra...@google.com <ra...@google.com>
ma...@google.com <ma...@google.com> #3
We had this bug that was fixed in 8.3.0. I tested with AGP 8.4.0 and seems working fine.
I wasn't able to make your project work but I noticed
baselineProfile {
mergeIntoMain = true
baselineProfileOutputDir = "baselineProfiles" <---
}
Here you're changing the folder from src/<variant>/generated/baselineProfiles
to src/<variant>/baselineProfiles
(<variant>
here is main
since you enabled mergeIntoMain
).
As a result you need to either regenerate your profile or copy the old startup profile in the folder.
Also src/main/baselineProfiles
is the default for baseline profiles and always added to the baseline profiles src set, i.e. it's always evaluated.
Could you please try again that line? You should have your new startup profile generated in src/<variant>/generated/baselineProfiles/startup-prof.txt
. If you try to put a foo
line in it, you should have the error you mention.
I'm going ahead and marking as not reproducible but will re-open is you're still having issues.
yc...@gmail.com <yc...@gmail.com> #4
Note that I don't have baselineProfileOutputDir = "baselineProfiles"
in the branch I linked to reproduce this issue:
Adding baselineProfileOutputDir = "baselineProfiles"
(i.e. moving the profiles into src/main/baselineProfiles
like step 6 mentioned above) was my workaround to this issue, with this change AGP is able to pick up startup-prof.txt
.
yc...@gmail.com <yc...@gmail.com> #5
Sorry I think I made a mistake in step 4 and 7 (was confusing with
The original <flavor>Release
build (assembleProdRelease
) does pickup both profiles if they're placed under src/<variant>/generated/baselineProfiles
.
The <flavor>BenchmarkRelease
task generated by the baseline profile plugin however can't seem to be able to pickup files in src/<variant>/generated/baselineProfiles
, but src/<variant>/baselineProfiles
works.
So to reproduce it you can run ./gradlew assembleDevBenchmarkRelease
with the profiles in src/<variant>/generated/baselineProfiles
VS src/<variant>/baselineProfiles
, and compare app/build/intermediates
folder:
intermediates/merged_startup_profile/
is produced if the startup profile lives insrc/<variant>/baselineProfiles
- no
merged_startup_profile
folder is produced if the startup profile lives insrc/<variant>/generated/baselineProfiles
What this effectively means is without changing baselineProfileOutputDir
to point to src/<variant>/baselineProfiles
, the app being benchmarked won't include the profiles provided by the app which is how I found this issue (see
ma...@google.com <ma...@google.com> #6
Thank you for spending the time to reexplain this.
I went through it and found the bug.
I'm going to create a patch for the plugin.
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 72443347a8fa1ad4c1a54af7d1a93e5296418ab8
Author: Marcello Albano <maralb@google.com>
Date: Wed Apr 10 14:54:23 2024
Add baseline profile srcset to benchmark variants
Due to a bug the baseline profile srcset for a release variant is not
being added to the ones for a benchmark variant. This PR fixes that.
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 333024280
Relnote: "Fix to ensure benchmarks use generated baseline profiles when
`automaticGenerationDuringBuild` is off"
Change-Id: Ic144f394c09ec666d4892a4168a2197dc5031039
M benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPlugin.kt
M benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt
M benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
ma...@google.com <ma...@google.com> #8
The patch should be in baseline profile gradle plugin 1.2.4 and 1.3.0-alpha03
na...@google.com <na...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-baseline-profile-gradle-plugin:1.2.4
androidx.benchmark:benchmark-baseline-profile-gradle-plugin:1.3.0-alpha03
yc...@gmail.com <yc...@gmail.com> #10
I can still reproduce this in 1.3.0-alpha03. I've pushed a
- run
./gradlew assembleDevBenchmarkRelease
- the
android/app/build/intermediates/merged_startup_profile/devBenchmarkRelease/mergeDevBenchmarkReleaseStartupProfile/
folder is still empty - the
android/app/build/intermediates/merged_art_profile/devBenchmarkRelease/mergeDevBenchmarkReleaseArtProfile/baseline-prof.txt
only has profiles from libraries - the build completes even when the
baseline-prof.txt
andstartup-prof.txt
insrc/main/generated/baselineProfiles
have unparsable contentfoo
andbar
.
ma...@google.com <ma...@google.com> #11
Was looking at the project and I think the issue is here:
beforeVariants {
it.enable = it.name in listOf(
"devDebug",
"demoDebug",
"mockDebug",
"prodRelease",
"devNonMinifiedRelease",
"devBenchmarkRelease",
"prodBenchmarkRelease",
)
}
In this beforeVariants
block, the variant devRelease
is disabled, so the onVariants
callback for that variant won't run. The set up work for devBenchmarkRelease
is done in that callback.
Unfortunately this code is a bit tricky because it's not possible to access a variant from another variant, using the variant api. So the baseline profile plugin processes the base variant and then schedules some work for when the benchmark variant is processed, in order to add the baseline profile src sets.
The (non-optimal) "fix" here would be to re-enable devRelease
.
yc...@gmail.com <yc...@gmail.com> #12
Thanks, enabling devRelease
does work. For now I've worked around this by enabling benchmark related variants only when running benchmarks by checking gradle.startParameter
.
Description
Using the baseline profile gradle plugin, the
startup-prof.txt
is copied intosrc/sourceSet/generated/baselineProfiles
by default.The file is not being picked up by AGP when compiling the release build
STEPS TO REPRODUCE:
android/app/src/main/generated/baselineProfiles/startup-prof.txt
foo
./gradlew assembleProdRelease
startup-prof.txt
toandroid/app/src/main/baselineProfiles
./gradlew assembleProdRelease
ERROR: /path/android/app/build/intermediates/merged_startup_profile/prodRelease/mergeProdReleaseStartupProfile/startup-prof.txt: R8: Unable to parse rule at line 1 from ART profile: foo
Studio Build: Android Studio Koala 2024.1.1 Canary 3
Version of Gradle Plugin: 8.5.0-alpha03
Version of Gradle: 8.7
Version of androidx.baselineprofile: 1.3.0-alpha02
Version of Java: 21
OS: macOS