Status Update
Comments
yc...@gmail.com <yc...@gmail.com> #2
Thanks for your detailed post.
However, benchmark build type is under configured: at least isProfileable is not set to true for existing build type, probably there's more.
We should set isProfileable = true
by default when overriding an existing benchmark build type.
This issue is not about some specific configuration flag, but the general approach of dealing with external configuration. As a developer adopting baseline profiles, it seems extremely risky to me using a custom configuration due to how it's applied under the hood and the fact it may break default configuration.
I agree that is not great but this is a little tricky to do. For custom baseline profile build types we override all the properties. For benchmark I left it open to configure but it's mostly about these 2 properties:
isMinifyEnabled
isShrinkResources
I don't have a way to see if the user is setting them before overriding, so for this reason, I'd prefer not to. I agree with you that some other properties could be set by default to make this easier, i.e.:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
The reason why I mentioned the release signing config in the beginning is because I want to use debug signing config.
In the specific of your issue, i.e. using a debug certificate can you override the benchmark and baseline profile setting? You should be able to do something like:
android {
buildTypes {
release { ... }
debug { ... }
benchmarkRelease {
...
signingConfig signingConfigs.debug
}
nonMinifiedRelease {
...
signingConfig signingConfigs.debug
}
}
}
ze...@google.com <ze...@google.com>
ra...@google.com <ra...@google.com>
ma...@google.com <ma...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Albano <
Link:
Added override for debuggable and profileable for benchmark builds in bpgp
Expand for full commit details
Added override for debuggable and profileable for benchmark builds in bpgp
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 369213505
Relnote: "isProfileable is always overridden in benchmark builds,
and isDebuggable is also now always overridden in both benchmark and
nonMinified (baseline profile capture) builds."
Change-Id: I487fa71083921682173f04fcbb477be5baf165f8
Files:
- M
benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPlugin.kt
- M
benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
Hash: 1906bbe52ba7ccb9ca0e1c1d6de33e7c91b5c6f0
Date: Fri Oct 11 10:07:06 2024
yc...@gmail.com <yc...@gmail.com> #4
I've landed a change that will set the following properties also when the benchmark build type already exists:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
As well as the following for agp 8.0:
isDebuggable = false
I'm going ahead and closing this - if you've further questions please answer here and will reopen. Thanks.
yc...@gmail.com <yc...@gmail.com> #5
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.4.0-alpha04
ma...@google.com <ma...@google.com> #6
Since release signing config is used by default instead of debug
is not mentioned in release notes - maybe this is a bug?
Cause the last time I found it mentioned in the release notes was in version 1.1
signingConfig.debug is used as the default signing config (
) b/153583269
So, if the switch to the release one indeed happened - maybe it's an issue?
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