From 78a36c46dc3182d2471e285bc52e3c557ec2770e Mon Sep 17 00:00:00 2001 From: houxg Date: Fri, 23 Dec 2016 11:35:35 +0800 Subject: [PATCH] update version name and version code automatically --- app/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2b561a8..95239bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,6 +15,12 @@ apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' def dbflow_version = "4.0.0-beta2" +def ciName = isEmpty(System.getenv("TRAVIS_TAG")) ? "Staging" : System.getenv("TRAVIS_TAG") +def ciCode = isEmpty(System.getenv("TRAVIS_BUILD_NUMBER")) ? 1000 : Integer.valueOf(System.getenv("TRAVIS_BUILD_NUMBER")) + +def isEmpty(String str) { + return str == null || "".equals(str); +} android { signingConfigs { @@ -31,8 +37,8 @@ android { applicationId "org.houxg.leamonax" minSdkVersion 21 targetSdkVersion 23 - versionCode 3 - versionName "1.1.0" + versionCode ciCode + versionName ciName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }