81 lines
2.0 KiB
Groovy
81 lines
2.0 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
//
|
|
// Creates version.xml
|
|
//
|
|
task createVersionXML {
|
|
doLast {
|
|
def versionP = 'git describe --tags --long --dirty=-x --abbrev=8'
|
|
.execute()
|
|
def version = versionP.text.trim()
|
|
if ( versionP.exitValue() )
|
|
throw new GradleException("Couldn't extract version. Git exited unexpectedly.")
|
|
|
|
def githashP = 'git rev-parse HEAD'.execute()
|
|
def githash = githashP.text.trim()
|
|
if ( githashP.exitValue() )
|
|
throw new GradleException("Couldn't extract git_hash. Git exited unexpectedly.")
|
|
|
|
def builddate = new Date()
|
|
|
|
def versionFile = new FileWriter("app/src/main/res/values/version.xml")
|
|
versionFile.println( '<?xml version="1.0" encoding="utf-8"?>' )
|
|
versionFile.println( '<resources>' )
|
|
versionFile.println( '<string name="git_version">' << version << '</string>' )
|
|
versionFile.println( '<string name="git_hash">' << githash << '</string>' )
|
|
versionFile.println( '<string name="builddate">' << builddate << '</string>' )
|
|
versionFile.println( '</resources>' )
|
|
versionFile.close()
|
|
}
|
|
}
|
|
preBuild.dependsOn createVersionXML
|
|
|
|
android {
|
|
compileSdkVersion 10
|
|
buildToolsVersion "21.1.1"
|
|
|
|
defaultConfig {
|
|
applicationId "org.vostan.sokoban"
|
|
minSdkVersion 10
|
|
targetSdkVersion 14
|
|
|
|
//applicationLabel="Banvor Debug"
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
runProguard true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
|
}
|
|
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
/*
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
|
|
renderscript.srcDirs = ['src']
|
|
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
|
|
}
|
|
*/
|
|
androidTest.setRoot('src/tests')
|
|
}
|
|
}
|
|
|
|
//repositories {}
|
|
|
|
dependencies {
|
|
compile 'com.android.support:support-v4:18.0.0'
|
|
}
|