xwords/xwords4/android/XWords4/build.gradle

137 lines
3.5 KiB
Groovy
Raw Normal View History

def VARIANT_NAME = 'xw4'
def INITIAL_CLIENT_VERS = 6
def CHAT_ENABLED = true
def THUMBNAIL_ENABLED = true
def BUILD_TARGET = 'debug'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'android'
repositories {
jcenter()
}
dependencies {
compile files('libs/gcm.jar')
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 14
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
assets.srcDirs = ['assets']
res.srcDirs = ['res']
jniLibs.srcDir 'libs' // use the jni .so compiled from the manual ndk-build command
jni.srcDirs = [] // disable automatic ndk-build call
}
// androidTest.setRoot('tests')
// androidTest.java.srcDirs = ['tests/src']
}
lintOptions {
abortOnError false
}
signingConfigs {
release {
String password = System.getenv("KEYSTORE_PASSWORD")
if (null == password || ''.equals(password)) {
password = new String(System.console().readPassword("\n\$ Enter keystore password: "))
}
storePassword password
keyPassword password
storeFile "${System.properties['user.home']}${File.separator}.keystore" as File
keyAlias 'mykey'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
task genVers(type: Exec) {
workingDir './'
commandLine '../scripts/genvers.sh', VARIANT_NAME,
INITIAL_CLIENT_VERS, CHAT_ENABLED, THUMBNAIL_ENABLED
}
task mkImages(type: Exec) {
workingDir './'
commandLine '../scripts/mkimages.sh'
}
task copyStrings(type: Exec) {
workingDir './'
commandLine '../scripts/copy-strings.py'
}
task ndkSetup(type: Exec) {
commandLine "../scripts/ndksetup.sh"
}
task genGcmid(type: Exec) {
commandLine '../scripts/gen_gcmid.sh',
'-o', "src/org/eehouse/android/$VARIANT_NAME/GCMConsts.java",
'-v', "$VARIANT_NAME"
}
task myPreBuild(dependsOn: ['genVers', 'ndkSetup', 'mkImages', 'copyStrings', 'mkXml', 'genGcmid']) {
}
task ndkBuild(type: Exec) {
commandLine '../scripts/ndkbuild.sh', '-j3', "CHAT_ENABLED=$CHAT_ENABLED",
"THUMBNAIL_ENABLED=$THUMBNAIL_ENABLED", "BUILD_TARGET=$BUILD_TARGET",
"INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", "VARIANT=$VARIANT_NAME", 'V=1'
}
task mkXml(type: Exec) {
commandLine '../scripts/mk_xml.py', '-o',
"src/org/eehouse/android/$VARIANT_NAME/loc/LocIDsData.java",
'-t', "debug", '-v', "$VARIANT_NAME"
}
preBuild.dependsOn myPreBuild
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}