From 940439866ea90334877348f9fcef9b7d547d4a1d Mon Sep 17 00:00:00 2001 From: Fabian Eichinger Date: Wed, 7 Jun 2017 18:43:44 +0200 Subject: [PATCH] CB-8976: Added the `cdvVersionCodeForceAbiDigit` flag to the template build.gradle that appends 0 to the versionCode when `cdvBuildMultipleApks` is not set --- bin/templates/project/build.gradle | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle index ef229719..b87840be 100644 --- a/bin/templates/project/build.gradle +++ b/bin/templates/project/build.gradle @@ -70,6 +70,10 @@ ext { if (!project.hasProperty('cdvBuildMultipleApks')) { cdvBuildMultipleApks = null } + // Whether to append a 0 "abi digit" to versionCode when only a single APK is build + if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) { + cdvVersionCodeForceAbiDigit = null + } // .properties files to use for release signing. if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) { cdvReleaseSigningPropertiesFile = null @@ -111,6 +115,7 @@ if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.propert // Cast to appropriate types. ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean(); +ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean(); ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion) ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode) @@ -138,6 +143,7 @@ task cdvPrintProps << { println('cdvCompileSdkVersion=' + cdvCompileSdkVersion) println('cdvBuildToolsVersion=' + cdvBuildToolsVersion) println('cdvVersionCode=' + cdvVersionCode) + println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit) println('cdvMinSdkVersion=' + cdvMinSdkVersion) println('cdvBuildMultipleApks=' + cdvBuildMultipleApks) println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile) @@ -199,6 +205,11 @@ android { } } } + } else if (Boolean.valueOf(cdvVersionCodeForceAbiDigit)) { + // This provides compatibility to the default logic for versionCode before cordova-android 5.2.0 + defaultConfig { + versionCode defaultConfig.versionCode*10 + } } /*