vtm/vtm-android-gdx/build.gradle
2014-06-10 22:16:07 +02:00

116 lines
3.0 KiB
Groovy

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.1'
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
apply plugin: 'android'
configurations { providedCompile }
dependencies {
compile project(':vtm-gdx')
compile project(':vtm-themes')
compile 'com.noveogroup.android:android-logger:1.3.1'
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
//compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
//compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
compile files("${rootDir}/vtm-ext-libs/gdx-native-libs.jar")
compile files("${rootDir}/vtm-ext-libs/native-libs.jar")
}
//task copyLibs(type: Copy) {
// from "$rootDir/vtm-ext-libs/vtm-gdx-android"
// into "libs"
// include '**/*'
//}
//tasks.withType(JavaCompile) { compileTask ->
// compileTask.dependsOn copyLibs }
android {
compileSdkVersion 19
buildToolsVersion '19.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'assets']
resources.srcDirs = ['src', 'assets']
aidl.srcDirs = ['src', 'assets']
renderscript.srcDirs = ['src', 'assets']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
// Including configurations into Eclipse
eclipse {
jdt {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
// Configuring Eclipse classpath
classpath {
plusConfigurations += configurations.compile
defaultOutputDir = file('bin/classes')
file {
// only used to explode jni .so into aar
whenMerged { classpath ->
classpath.entries.findAll { entry ->
entry.path.contains('native-libs') }*.exported = false
classpath.entries.removeAll { entry ->
entry.path.contains('gdx-1.0-SNAPSHOT') }
}
// Direct manipulation of the generated classpath XML
withXml {
def node = it.asNode()
node.appendNode('classpathentry kind="src" path="src"')
node.appendNode('classpathentry kind="src" path="gen"')
}
}
}
project {
natures = ['com.android.ide.eclipse.adt.AndroidNature',
'org.eclipse.jdt.core.javanature']
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
// use extracted jni .so in eclipse
linkedResource name: 'libs', type: '2',
locationUri: 'PARENT-1-PROJECT_LOC/vtm-ext-libs/vtm-gdx-android'
}
}
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()
}
}