From 4d1fc5ecb08f0906fbb201c3cf417d402e0397bf Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 16 Jul 2018 19:01:34 +0200 Subject: [PATCH] improve gradle build to support nightly builds --- app/build.gradle | 18 +++++++++++++++++- .../res/drawable/ic_launcher_background.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../res/drawable/ic_launcher_background.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin 13 files changed, 17 insertions(+), 1 deletion(-) rename app/src/{release => blue}/res/drawable/ic_launcher_background.xml (100%) rename app/src/{release => blue}/res/mipmap-hdpi/ic_launcher.png (100%) rename app/src/{release => blue}/res/mipmap-mdpi/ic_launcher.png (100%) rename app/src/{release => blue}/res/mipmap-xhdpi/ic_launcher.png (100%) rename app/src/{release => blue}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename app/src/{release => blue}/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename app/src/{debug => green}/res/drawable/ic_launcher_background.xml (100%) rename app/src/{debug => green}/res/mipmap-hdpi/ic_launcher.png (100%) rename app/src/{debug => green}/res/mipmap-mdpi/ic_launcher.png (100%) rename app/src/{debug => green}/res/mipmap-xhdpi/ic_launcher.png (100%) rename app/src/{debug => green}/res/mipmap-xxhdpi/ic_launcher.png (100%) rename app/src/{debug => green}/res/mipmap-xxxhdpi/ic_launcher.png (100%) diff --git a/app/build.gradle b/app/build.gradle index 650647d73..fabc2e82a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,15 @@ apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' +def getGitSha = { -> + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-parse', '--short' , 'HEAD' + standardOutput = stdout + } + return stdout.toString().trim() +} + android { compileSdkVersion 27 buildToolsVersion '27.0.3' @@ -21,8 +30,15 @@ android { shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } - debug { + debug { } + } + + flavorDimensions "color" + productFlavors { + blue { } + green { applicationIdSuffix ".test" + versionNameSuffix "-"+getGitSha() } } diff --git a/app/src/release/res/drawable/ic_launcher_background.xml b/app/src/blue/res/drawable/ic_launcher_background.xml similarity index 100% rename from app/src/release/res/drawable/ic_launcher_background.xml rename to app/src/blue/res/drawable/ic_launcher_background.xml diff --git a/app/src/release/res/mipmap-hdpi/ic_launcher.png b/app/src/blue/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/release/res/mipmap-hdpi/ic_launcher.png rename to app/src/blue/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/release/res/mipmap-mdpi/ic_launcher.png b/app/src/blue/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/release/res/mipmap-mdpi/ic_launcher.png rename to app/src/blue/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/release/res/mipmap-xhdpi/ic_launcher.png b/app/src/blue/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/release/res/mipmap-xhdpi/ic_launcher.png rename to app/src/blue/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/release/res/mipmap-xxhdpi/ic_launcher.png b/app/src/blue/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/release/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/blue/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/release/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/blue/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from app/src/release/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/blue/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/app/src/debug/res/drawable/ic_launcher_background.xml b/app/src/green/res/drawable/ic_launcher_background.xml similarity index 100% rename from app/src/debug/res/drawable/ic_launcher_background.xml rename to app/src/green/res/drawable/ic_launcher_background.xml diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/app/src/green/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from app/src/debug/res/mipmap-hdpi/ic_launcher.png rename to app/src/green/res/mipmap-hdpi/ic_launcher.png diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/app/src/green/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from app/src/debug/res/mipmap-mdpi/ic_launcher.png rename to app/src/green/res/mipmap-mdpi/ic_launcher.png diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/app/src/green/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from app/src/debug/res/mipmap-xhdpi/ic_launcher.png rename to app/src/green/res/mipmap-xhdpi/ic_launcher.png diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/app/src/green/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from app/src/debug/res/mipmap-xxhdpi/ic_launcher.png rename to app/src/green/res/mipmap-xxhdpi/ic_launcher.png diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/green/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png rename to app/src/green/res/mipmap-xxxhdpi/ic_launcher.png