From 06841391831d02e73d2cc607c23350421a3940ec Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 3 Feb 2016 20:44:40 -0800 Subject: [PATCH] add ability to build a second variant. Works, but they can't both be installed because of duplicate permissions. --- xwords4/android/XWords4/app/build.gradle | 61 +++++++++++++++--------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/xwords4/android/XWords4/app/build.gradle b/xwords4/android/XWords4/app/build.gradle index 87e878d6c..0cde8aa58 100644 --- a/xwords4/android/XWords4/app/build.gradle +++ b/xwords4/android/XWords4/app/build.gradle @@ -4,6 +4,9 @@ def CHAT_ENABLED = true def THUMBNAIL_ENABLED = true def LIBS_DEBUG = 'libs-debug' def LIBS_RELEASE = 'libs-release' +def VERSION_CODE_BASE = 1 +def VARIANTS = [ "Xw4", "Xw4dbg" ] +def BUILDS = [ "Debug", "Release" ] apply plugin: 'com.android.application' @@ -15,7 +18,6 @@ android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { - applicationId "org.eehouse.android.xw4" minSdkVersion 7 targetSdkVersion 14 } @@ -23,29 +25,40 @@ android { // Rename all output artifacts to include version information // applicationVariants.all { variant -> // renameArtifact(variant) + // variant.buildConfigField "String", "FIELD_NAME", "\"my String\"" // } - // flavorDimensions "variant", "abi" - // productFlavors { - // xw4 { - // dimension "variant" - // } - // xw4dbg { - // dimension "variant" - // } - // armeabiv7a { - // dimension "abi" - // } + flavorDimensions "variant"//, "abi" + productFlavors { + xw4 { + dimension "variant" + applicationId "org.eehouse.android.xw4" + } + xw4dbg { + dimension "variant" + applicationId "org.eehouse.android.xw4dbg" + } - // armeabi { - // dimension "abi" - // } - - // x86 { - // dimension "abi" - // } + // WARNING: "all" breaks things. Seems to be a keyword. Need + // to figure out how to express include-all-abis + // all { + // dimension "abi" + // versionCode 0 + VERSION_CODE_BASE + // } + // armeabi { + // dimension "abi" + // versionCode 1 + VERSION_CODE_BASE + // } + // x86 { + // dimension "abi" + // versionCode 2 + VERSION_CODE_BASE + // } + // armeabiv7a { + // dimension "abi" + // versionCode 3 + VERSION_CODE_BASE + // } - // } + } signingConfigs { release { @@ -154,8 +167,12 @@ task mkXml(type: Exec) { } afterEvaluate { - compileReleaseNdk.dependsOn ndkBuildRelease - compileDebugNdk.dependsOn ndkBuildDebug + VARIANTS.each { VARIANT -> + String compileTask = "compile${VARIANT}ReleaseNdk" + tasks.getByName(compileTask).dependsOn ndkBuildRelease + compileTask = "compile${VARIANT}DebugNdk" + tasks.getByName(compileTask).dependsOn ndkBuildDebug + } } task askForPassword << {