102 lines
3.3 KiB
Groovy
102 lines
3.3 KiB
Groovy
apply plugin: 'com.android.application'
|
|
apply plugin: 'com.github.dcendents.android-maven'
|
|
|
|
dependencies {
|
|
compile project(':vtm-gdx')
|
|
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
|
compile 'com.caverock:androidsvg:1.2.2-beta-1'
|
|
compile 'com.noveogroup.android:android-logger:1.3.6'
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion androidCompileSdk()
|
|
buildToolsVersion "$androidBuildVersionTools"
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
}
|
|
|
|
defaultConfig {
|
|
versionCode versionCode()
|
|
versionName versionName()
|
|
minSdkVersion androidMinSdk()
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src', 'assets']
|
|
aidl.srcDirs = ['src', 'assets']
|
|
renderscript.srcDirs = ['src', 'assets']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
file('natives').eachDir() { dir ->
|
|
jniLibs.srcDirs += "${dir.path}/lib"
|
|
jniLibs.srcDirs += "${rootDir}/vtm-android/natives/${dir.name}/lib"
|
|
}
|
|
}
|
|
debug.setRoot('build-types/debug')
|
|
release.setRoot('build-types/release')
|
|
}
|
|
|
|
lintOptions { abortOnError false }
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
def name = variant.buildType.name
|
|
if (name.equals("debug")) {
|
|
print "Skipping debug jar"
|
|
return; // Skip debug builds.
|
|
}
|
|
|
|
def jar = project.tasks.create "jar${name.capitalize()}", Jar
|
|
jar.dependsOn variant.javaCompile
|
|
jar.from variant.javaCompile.destinationDir
|
|
jar.exclude 'android-logger.properties'
|
|
artifacts.add('archives', jar);
|
|
|
|
file('natives').eachDir() { dir ->
|
|
def nativesJar = project.tasks.create "nativesJar${name.capitalize()}-${dir.name}", Jar
|
|
nativesJar.classifier = "natives-${dir.name}"
|
|
nativesJar.from(dir.path)
|
|
artifacts.add('archives', nativesJar);
|
|
}
|
|
|
|
def fatJar = project.tasks.create "fatJar${name.capitalize()}", Jar
|
|
fatJar.classifier = 'jar-with-dependencies'
|
|
fatJar.dependsOn variant.javaCompile
|
|
fatJar.from variant.javaCompile.destinationDir
|
|
fatJar.from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
file('natives').eachDir() { dir ->
|
|
fatJar.from(dir.path)
|
|
fatJar.from("${rootProject.projectDir}/vtm-android/natives/${dir.name}")
|
|
}
|
|
fatJar.exclude 'android-logger.properties'
|
|
artifacts.add('archives', fatJar);
|
|
}
|
|
|
|
afterEvaluate {
|
|
configurations.archives.artifacts.removeAll { it.file =~ 'apk' }
|
|
}
|
|
|
|
task run(dependsOn: 'installDebug') {
|
|
doFirst {
|
|
println(">> adb run...")
|
|
String adb = System.getenv()['ANDROID_HOME'] + '/platform-tools/adb'
|
|
String cmd = "${adb} shell am start -n org.oscim.gdx/.MainActivity"
|
|
def proc = cmd.execute()
|
|
proc.in.eachLine { line -> println line }
|
|
proc.err.eachLine { line -> System.err.println('ERROR: ' + line) }
|
|
proc.waitFor()
|
|
}
|
|
}
|
|
|
|
// Automated Gradle project deployment to Sonatype OSSRH
|
|
if (isReleaseVersion && project.hasProperty("SONATYPE_USERNAME")) {
|
|
afterEvaluate {
|
|
project.apply from: "${rootProject.projectDir}/deploy.gradle"
|
|
}
|
|
}
|