Gradle build refactoring, closes #46
This commit is contained in:
@@ -1,94 +1,38 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
configurations {
|
||||
eclipseCompile
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':vtm')
|
||||
provided files('vtm-natives-android.jar')
|
||||
|
||||
compile 'com.android.support:support-v4:21.+'
|
||||
//eclipseCompile project(':appcompat')
|
||||
compile project(':vtm')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidTargetSdk()
|
||||
buildToolsVersion = "$androidBuildVersionTools"
|
||||
compileSdkVersion androidCompileSdk()
|
||||
buildToolsVersion = "$androidBuildVersionTools"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
lintOptions.abortOnError false
|
||||
}
|
||||
|
||||
eclipse {
|
||||
classpath {
|
||||
plusConfigurations += [ configurations.compile, configurations.eclipseCompile ]
|
||||
|
||||
//noExportConfigurations += [ configurations.provided ]
|
||||
|
||||
//customizing the classes output directory:
|
||||
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 {
|
||||
// Manipulation of the classpath XML before merging local
|
||||
// and generated copies
|
||||
beforeMerged { classpath ->
|
||||
// Remove all source entries to avoid overlap
|
||||
classpath.entries.removeAll() { e ->
|
||||
e.kind == 'src'
|
||||
}
|
||||
}
|
||||
|
||||
// only used to explode jni .so into aar
|
||||
whenMerged {
|
||||
classpath ->
|
||||
classpath.entries.findAll { e ->
|
||||
e.path.contains('native-libs') ||
|
||||
e.path.contains('ANDROID_FRAMEWORK')
|
||||
}*.exported = false
|
||||
classpath.entries.removeAll() { e ->
|
||||
e.path.contains('support')
|
||||
}
|
||||
}
|
||||
|
||||
// Direct manipulation of the generated classpath XML
|
||||
withXml {
|
||||
// Since non-default source directories are used
|
||||
// they need to be manually added to the classpath XML
|
||||
def node = it.asNode()
|
||||
// Main source directory and generated code directory
|
||||
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']
|
||||
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-android'
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
lintOptions { abortOnError false }
|
||||
}
|
||||
|
||||
android.libraryVariants.all { variant ->
|
||||
|
||||
Reference in New Issue
Block a user