From db2af80d1a08781e77c4c700e8540d349bc6a65a Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 13 Jul 2019 17:54:31 +0200 Subject: fix gradle build script for Beta releases regarding the app name --- app/build.gradle | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e2a8d926..b76c426f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,6 @@ import java.util.regex.Matcher import java.util.regex.Pattern apply plugin: 'com.android.application' -def appName = 'Bitmask' android { compileSdkVersion 28 @@ -20,7 +19,6 @@ android { versionName "1.0.0RC1" minSdkVersion 16 targetSdkVersion 27 - resValue "string", "app_name", appName vectorDrawables.useSupportLibrary = true buildConfigField 'boolean', 'openvpn3', 'false' @@ -61,6 +59,9 @@ android { flavorDimensions "branding", "implementation" productFlavors { + productFlavors.all { + ext.appName = null; + } production { dimension "implementation" } @@ -69,6 +70,7 @@ android { } normal { dimension "branding" + appName = "Bitmask" } @@ -83,7 +85,6 @@ android { applicationId "se.leap.riseupvpn" //Set app name here appName = "Riseup VPN" - resValue "string", "app_name", appName //Provider base url, e.g. '"https://example.com"' def customProviderUrl = '"https://riseup.net"' buildConfigField "String", "customProviderUrl", customProviderUrl @@ -113,6 +114,9 @@ android { } buildTypes { + buildTypes.all { + ext.appSuffix = "" + } release { //runProguard true if(signingConfigs.contains(release)) @@ -121,7 +125,7 @@ android { beta { initWith release applicationIdSuffix ".beta" - resValue "string", "app_name", appName + " Beta" + appSuffix = " Beta" } debug { testCoverageEnabled = true @@ -195,6 +199,15 @@ dependencies { implementation 'com.android.support:cardview-v7:28.0.0' } +android.applicationVariants.all { variant -> + def flavors = variant.productFlavors + // flavorDimensions "branding" -> 0, "implementation" -> 1 + def branding = flavors[0] + def buildType = variant.buildType + variant.resValue "string", "app_name", "\"${branding.appName}${buildType.appSuffix}\"" +} + + // Ensure the no-op dependency is always used in JVM tests. configurations.all { config -> if (config.name.contains('UnitTest')) { -- cgit v1.2.3