From 1de771384c0afd2cb83b58b45fe7c193d9ee9a10 Mon Sep 17 00:00:00 2001 From: Ben Weiss Date: Wed, 29 Nov 2023 12:32:07 +0100 Subject: [PATCH] Configure baseline profiles in the baselineProfile lambda This is the correct and easiest way to set up baseline profiles correctly. See b/313428246 for more context. Change-Id: Iea68ba5bcdbf62f377cae146ff56603448458726 --- app/build.gradle.kts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index afd37736f..3dead8cfb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -52,9 +52,7 @@ android { // To publish on the Play store a private signing key is required, but to allow anyone // who clones the code to sign and run the release variant, use the debug signing key. // TODO: Abstract the signing configuration to a separate file to avoid hardcoding this. - signingConfig = signingConfigs.named("debug").get() - // Ensure Baseline Profile is fresh for release builds. - baselineProfile.automaticGenerationDuringBuild = true + signingConfig = signingConfigs.getByName("debug").get() } } @@ -71,6 +69,20 @@ android { namespace = "com.google.samples.apps.nowinandroid" } +baselineProfile { + saveInSrc = false + // Don't build on every iteration of a full assemble. + // Instead enable generation directly for the release build variant. + automaticGenerationDuringBuild = false + mergeIntoMain = true + variants { + create("release") { + // Ensure Baseline Profile is fresh for release builds. + automaticGenerationDuringBuild = true + } + } +} + dependencies { implementation(projects.feature.interests) implementation(projects.feature.foryou)