mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
rename .apks to match the ant ones, including git revision info
This commit is contained in:
parent
dc5b979e8a
commit
b7b664bee6
1 changed files with 28 additions and 14 deletions
|
@ -7,20 +7,6 @@ def LIBS_RELEASE = 'libs-release'
|
|||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
def getVersionName = { ->
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'describe', '--dirty'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
catch (ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile files('../libs/gcm.jar')
|
||||
}
|
||||
|
@ -34,6 +20,11 @@ android {
|
|||
targetSdkVersion 14
|
||||
}
|
||||
|
||||
// Rename all output artifacts to include version information
|
||||
applicationVariants.all { variant ->
|
||||
renameArtifact(variant)
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(System.getenv("HOME") + "/.keystore")
|
||||
|
@ -169,3 +160,26 @@ tasks.whenTaskAdded { theTask ->
|
|||
theTask.dependsOn "askForPassword"
|
||||
}
|
||||
}
|
||||
|
||||
def getVersionName() {
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'describe', '--dirty'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
catch (ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
def renameArtifact(variant) {
|
||||
variant.outputs.each { output ->
|
||||
def name = String.format( "XWords4-%s-%s.apk", variant.name,
|
||||
getVersionName() )
|
||||
output.outputFile = new File( (String)output.outputFile.parent,
|
||||
(String)name )
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue