Simpler (kind of) way to have multiple builds a day)

This commit is contained in:
Amine Bou 2018-01-12 05:15:28 +01:00
parent 1a4bc1b301
commit 96f8663b8f

View File

@ -12,6 +12,8 @@ ext {
configuration = [ configuration = [
buildDate: new Date() buildDate: new Date()
] ]
// This will make me able to build multiple times a day. May break thinks. I may forget it.
todaysBuilds = "1"
} }
def gitVersion() { def gitVersion() {
@ -20,14 +22,15 @@ def gitVersion() {
} }
def versionCodeFromGit() { def versionCodeFromGit() {
def dayInYear = ext.configuration.buildDate.format("D").padLeft(3, '0') def dayInYear = ext.configuration.buildDate.format("D").padLeft(2, '0')
def versionCode = gitVersion() + (ext.configuration.buildDate.format("yyMM") + dayInYear).toInteger() def versionCode = gitVersion() + (ext.configuration.buildDate.format("yyMM") + ext.todaysBuilds + dayInYear).toInteger()
println "version code " + versionCode println "version code " + versionCode
return versionCode.toInteger() return versionCode.toInteger()
} }
def versionNameFromGit() { def versionNameFromGit() {
def versionName = gitVersion() + ext.configuration.buildDate.format('yyyyMMddHHmm') def dayInYear = ext.configuration.buildDate.format("D").padLeft(2, '0')
def versionName = gitVersion() + ext.configuration.buildDate.format('yyMM') + ext.todaysBuilds + dayInYear
println "version name " + versionName println "version name " + versionName
return versionName return versionName
} }
@ -95,7 +98,8 @@ android {
buildConfigField "boolean", "GITHUB_VERSION", "true" buildConfigField "boolean", "GITHUB_VERSION", "true"
} }
storeConfig { storeConfig {
versionNameSuffix '-store' // As jenkins publishes to alpha first, this is the default suffix now.
versionNameSuffix '-alpha'
dimension "build" dimension "build"
buildConfigField "boolean", "GITHUB_VERSION", "false" buildConfigField "boolean", "GITHUB_VERSION", "false"
} }