Gradle build refactoring, closes #46
This commit is contained in:
@@ -1,118 +1,53 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
configurations { providedCompile }
|
||||
|
||||
dependencies {
|
||||
compile project(':vtm-gdx')
|
||||
compile project(':vtm-themes')
|
||||
compile 'com.noveogroup.android:android-logger:1.3.4'
|
||||
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 "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||
compile files('gdx-natives-android.jar')
|
||||
compile files("${rootDir}/vtm-android/vtm-natives-android.jar")
|
||||
compile project(':vtm-gdx')
|
||||
compile project(':vtm-themes')
|
||||
compile files("${rootDir}/vtm-android/vtm-natives-android.jar")
|
||||
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||
compile files('gdx-natives-android.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 androidTargetSdk()
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
lintOptions { abortOnError false }
|
||||
|
||||
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']
|
||||
}
|
||||
compileSdkVersion androidCompileSdk()
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
}
|
||||
|
||||
// Including configurations into Eclipse
|
||||
eclipse {
|
||||
|
||||
// Configuring Eclipse classpath
|
||||
classpath {
|
||||
plusConfigurations += [ configurations.compile ]
|
||||
|
||||
defaultOutputDir = file('bin/classes')
|
||||
|
||||
containers = ['com.android.ide.eclipse.adt.ANDROID_FRAMEWORK',
|
||||
'com.android.ide.eclipse.adt.LIBRARIES',
|
||||
'com.android.ide.eclipse.adt.DEPENDENCIES']
|
||||
|
||||
file {
|
||||
beforeMerged { classpath ->
|
||||
// Remove all source entries to avoid overlap
|
||||
classpath.entries.removeAll() { c ->
|
||||
c.kind == 'src'
|
||||
}
|
||||
}
|
||||
|
||||
// only used to explode jni .so into aar
|
||||
whenMerged { classpath ->
|
||||
classpath.entries.findAll { entry ->
|
||||
entry.path.contains('ANDROID_FRAMEWORK') ||
|
||||
entry.path.contains('support') ||
|
||||
entry.path.contains('native-libs')
|
||||
}*.exported = false
|
||||
|
||||
classpath.entries.removeAll { entry ->
|
||||
entry.path.contains('gdx-2') }
|
||||
}
|
||||
|
||||
// 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"')
|
||||
}
|
||||
defaultConfig {
|
||||
versionCode versionCode()
|
||||
versionName versionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
}
|
||||
}
|
||||
|
||||
project {
|
||||
natures = ['com.android.ide.eclipse.adt.AndroidNature',
|
||||
'org.eclipse.jdt.core.javanature']
|
||||
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']
|
||||
}
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
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'
|
||||
|
||||
}
|
||||
lintOptions { abortOnError false }
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user