Commit d6948f2d authored by Matyáš Latner's avatar Matyáš Latner

#1 Git version numbering and package naming

 * automatic version name from git
 * automatic version code from last git commit timestamp
 * gradle packages naming
parent c644a844
......@@ -13,7 +13,53 @@ android {
instrumentTest.setRoot('tests')
}
defaultConfig {
versionName version
versionCode getVersionCodeFromGit()
}
buildTypes {
release {
debuggable false
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def file = output.outputFile
output.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk").replace("android", appName))
}
}
if (project.hasProperty('TABLEXIA_RELEASE_KEYSTORE') && project.hasProperty('TABLEXIA_RELEASE_KEYSTORE_PASSWORD')
&& project.hasProperty('TABLEXIA_RELEASE_KEY_ALIAS') && project.hasProperty('TABLEXIA_RELEASE_KEY_PASSWORD')) {
signingConfigs {
release {
storeFile file(TABLEXIA_RELEASE_KEYSTORE)
storePassword TABLEXIA_RELEASE_KEYSTORE_PASSWORD
keyAlias TABLEXIA_RELEASE_KEY_ALIAS
keyPassword TABLEXIA_RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
}
def getVersionCodeFromGit() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--format=%at'
standardOutput = stdout
}
return stdout.toString().trim().toInteger()
}
// needed to add JNI shared libraries to APK when compiling on CLI
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniFolders = new HashSet<File>()
......
......@@ -14,9 +14,9 @@ allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
version = getVersionNameFromGit()
ext {
appName = 'Tablexia-libGDX'
appName = 'Tablexia'
gdxVersion = '1.5.2'
gdxUtilsVersion = '0.9.1'
mbassadorVersion = '1.2.0'
......@@ -33,6 +33,15 @@ allprojects {
}
}
def getVersionNameFromGit() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
standardOutput = stdout
}
return stdout.toString().trim()
}
project(":desktop") {
apply plugin: "java"
......
......@@ -15,7 +15,7 @@ task run(dependsOn: classes, type: JavaExec) {
}
task debugJar(type: Jar) {
baseName = "debug"
baseName = appName + "-debug"
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
......@@ -24,11 +24,12 @@ task debugJar(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
attributes 'Build-Type': 'debug'
attributes 'Version': version
}
}
task releaseJar(type: Jar) {
baseName = "release"
baseName = appName + "-release"
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
......@@ -37,6 +38,7 @@ task releaseJar(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
attributes 'Build-Type': 'release'
attributes 'Version': version
}
}
......
......@@ -33,6 +33,7 @@
<pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
</forceLinkClasses>
<libs>
<lib>build/libs/ios/libgdx-freetype.a</lib>
<lib>build/libs/ios/libObjectAL.a</lib>
<lib>build/libs/ios/libgdx.a</lib>
</libs>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment