Status Update
Comments
ma...@google.com <ma...@google.com> #2
What's the use case for this? The only advantage I can see is to prevent overwriting the apk of a previously installed release build.
If there is no other use case, would it work if we were to statically add baselineprofile
and benchmark
as application id suffix?
In any case, as I mentioned on the ASG conversation, it is already possible to customize the benchmark and baseline profile build type simply creating it before the plugin does.
For example, to customize the baseline profile and benchmark build types for release
, you can just create nonMinifiedRelease
and benchmarkRelease
:
android {
buildTypes {
nonMinifiedRelease { ... }
benchmarkRelease { ... }
}
}
I think there are some legitimate use cases to customize the build type beside the application id suffix, for example to change signingConfig
, but I'm wondering if we can tackle that separately rather than a generic system to configure the new build types.
(reassigning for visibility)
ma...@google.com <ma...@google.com> #3
With aosp/3032806 even though it's still possible to customize the benchmark and baseline profile build types, some properties will be overridden.
This is for example to avoid customizing the baseline profile build type properties that would break the baseline profile generation. We should document this.
ml...@google.com <ml...@google.com> #4
For now, I don't know other use case for overriding it, but people use build system in various forms and the API generally allows you to customize it. The applicationIdSuffix
was a real example in NowInAndroid, which we had to remove.
I wasn't aware you can customize it when you define the two buildTypes! I think this is fine.
I think your change in
Out of curiosity, can we warn if a parameter is overriden? I assume not, but just checking.
Over to Ben for documenting it :)
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 9c2a871ca8804f5dcf680a7f772f7050198408df
Author: Marcello Albano <maralb@google.com>
Date: Mon Apr 08 16:35:50 2024
Override build type props when build types already exist
It's currently possible to customize release build types creating
benchmark and nonMinified build types. For example to customize
`release` it's possible to create `benchmarkRelease` and
`nonMinifiedRelease`. This PR makes sure that even when they're
customized, properties that would break baseline profile generation are
overridden. This PR also makes sure that the signing config is copied
from the release build type to the extended ones.
Relnote: "when customizing a nonMinified or benchmark build type,
ensure that properties that are needed to make baseline profile
generation and benchmark working are overridden."
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 324837887
Change-Id: Ib8f0555001ff719f4b82c35cf50c13b4a3fa308d
M benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPlugin.kt
M benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPlugin.kt
M benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/BuildTypes.kt
M benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
ma...@google.com <ma...@google.com> #6
This is a summary of how build type configuration works:
buildTypes {
release {
...
}
benchmarkRelease {
// Properties for benchmark release can be overridden here.
// It's also possible to specify a different signing config.
}
nonMinifiedRelease {
// Properties for nonMinifiedRelease can be specified here.
//
// From 1.2.5 and 1.3.0-alpha04, the following properties are always overridden to avoid breaking baseline profile generation:
//
// isJniDebuggable = false
// isDebuggable = false
// isMinifyEnabled = false
// isShrinkResources = false
// isProfileable = true
// enableAndroidTestCoverage = false
// enableUnitTestCoverage = false
//
// It's still possible to specify a different signing config.
}
}
Description
Baseline Profile Gradle Plugin (BPGP) creates custom build types that are properly set up to generate optimal baseline profiles.
There's no way though to tweak the configuration to app's specific needs and prevent creating duplicate confusing build types.
Consider the example from Now in Android where each build type added
applicationIdSuffix
.Either the application has duplicate build types
benchmarkBenchmark
, or there's no way to defineapplicationIdSuffix
inbenchmark
build type generated by BPGP.I think we should allow developers telling BPGP to either: a) define their own
benchmark
build type b) allowing customization of thebenchmark
build type created by BPGP.