From 99edfdd5679f36747b1bcf0578e29b68c1896877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Thu, 19 Dec 2024 08:45:39 +0100 Subject: [PATCH] Improve Gradle scripts --- .../PillarboxAndroidApplicationPlugin.kt | 5 +++-- pillarbox-demo/build.gradle.kts | 21 +++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidApplicationPlugin.kt b/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidApplicationPlugin.kt index ae12b0827..83789b1c8 100644 --- a/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidApplicationPlugin.kt +++ b/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidApplicationPlugin.kt @@ -36,6 +36,7 @@ class PillarboxAndroidApplicationPlugin : Plugin { defaultConfig { applicationId = namespace + resourceConfigurations += "en" targetSdk = AppConfig.targetSdk versionCode = VersionConfig().versionCode() versionName = VersionConfig().versionName() @@ -43,7 +44,7 @@ class PillarboxAndroidApplicationPlugin : Plugin { } signingConfigs { - create("release") { + register("release") { val password = System.getenv("DEMO_KEY_PASSWORD") ?: extra.properties["pillarbox.keystore.password"] as String? storeFile = file("./demo.keystore") @@ -60,7 +61,7 @@ class PillarboxAndroidApplicationPlugin : Plugin { } release { - signingConfig = signingConfigs.named("release").get() + signingConfig = signingConfigs.getByName("release") isMinifyEnabled = false isDebuggable = true diff --git a/pillarbox-demo/build.gradle.kts b/pillarbox-demo/build.gradle.kts index e8e4fc7de..02530c172 100644 --- a/pillarbox-demo/build.gradle.kts +++ b/pillarbox-demo/build.gradle.kts @@ -10,14 +10,16 @@ android { val versionDimension = "version" flavorDimensions += versionDimension productFlavors { - create("prod") { + register("prod") { dimension = versionDimension } - create("nightly") { - dimension = versionDimension - applicationIdSuffix = ".nightly" - versionNameSuffix = "-nightly" + if (System.getenv("CI") == "true") { + register("nightly") { + dimension = versionDimension + applicationIdSuffix = ".nightly" + versionNameSuffix = "-nightly" + } } } @@ -30,15 +32,6 @@ android { excludes += "/META-INF/{AL2.0,LGPL2.1}" } } - - // Hide nightly flavors from BuildVariants in AndroidStudio - androidComponents { - beforeVariants { variant -> - val isCI = System.getenv("CI")?.toBooleanStrictOrNull() ?: false - - variant.enable = isCI || variant.flavorName != "nightly" - } - } } dependencies {