Play-/build_android/build.gradle
2016-07-24 21:24:40 -04:00

115 lines
2.7 KiB
Groovy

apply plugin: 'com.android.application'
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
def getNdkBuildPath() {
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
return System.getenv('ANDROID_NDK') + '\\ndk-build.cmd'
} else {
return System.getenv('ANDROID_NDK') + '/ndk-build'
}
}
project.afterEvaluate {
compileDebugNdk.dependsOn 'ndkBuildDebug'
compileReleaseNdk.dependsOn 'ndkBuildRelease'
clean.dependsOn 'ndkCleanDebug'
clean.dependsOn 'ndkCleanRelease'
preBuild.dependsOn 'copyPatchFile'
def propsFile = rootProject.file('keystore.properties')
def configName = 'release'
if(propsFile.exists() && android.signingConfigs.hasProperty(configName)) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
android.signingConfigs[configName].storeFile = file(props['storeFile'])
android.signingConfigs[configName].storePassword = props['storePassword']
android.signingConfigs[configName].keyAlias = props['keyAlias']
android.signingConfigs[configName].keyPassword = props['keyPassword']
}
}
android {
repositories {
mavenCentral()
}
compileSdkVersion 'android-23'
buildToolsVersion '23.0.2'
defaultConfig {
versionCode 30
versionName '0.30'
minSdkVersion 19
targetSdkVersion 23
}
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.5'
}
signingConfigs {
release {
storeFile file('store.keystore')
storePassword ''
keyAlias ''
keyPassword ''
}
}
buildTypes {
debug {
debuggable true
jniDebuggable true
}
release {
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
sourceSets.main {
java.srcDirs = [ '../Source/ui_android/java' ]
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
task copyPatchFile(type: Copy) {
from '../patches.xml'
into 'src/main/assets'
}
task ndkBuildDebug(type: Exec) {
commandLine getNdkBuildPath(), '-C', file('src/main').absolutePath, '-j', Runtime.runtime.availableProcessors(), 'NDK_DEBUG=1'
}
task ndkBuildRelease(type: Exec) {
commandLine getNdkBuildPath(), '-C', file('src/main').absolutePath, '-j', Runtime.runtime.availableProcessors(), 'NDK_DEBUG=0'
}
task ndkCleanDebug(type: Exec) {
commandLine getNdkBuildPath(), '-C', file('src/main').absolutePath, 'clean', 'NDK_DEBUG=1'
}
task ndkCleanRelease(type: Exec) {
commandLine getNdkBuildPath(), '-C', file('src/main').absolutePath, 'clean', 'NDK_DEBUG=0'
}
}