gradle: fix vtm-android install + generate source jars

This commit is contained in:
Hannes Janetzek 2014-11-19 23:50:37 +01:00
parent 77f383913d
commit aaec15a66a
5 changed files with 47 additions and 11 deletions

View File

@ -22,10 +22,10 @@ before_install:
- export ANDROID_HOME=$PWD/android-sdk-linux - export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
# install android build tools # install android build tools
- wget https://dl-ssl.google.com/android/repository/build-tools_r21.0.2-linux.zip - wget https://dl-ssl.google.com/android/repository/build-tools_r21.1.1-linux.zip
- unzip build-tools_r21.0.2-linux.zip -d $ANDROID_HOME - unzip build-tools_r21.1.1-linux.zip -d $ANDROID_HOME
- mkdir -p $ANDROID_HOME/build-tools/ - mkdir -p $ANDROID_HOME/build-tools/
- mv $ANDROID_HOME/android-5.0 $ANDROID_HOME/build-tools/21.0.2 - mv $ANDROID_HOME/android-5.0 $ANDROID_HOME/build-tools/21.1.1
# Install required components. # Install required components.
# For a full list, run `android list sdk -a --extended` # For a full list, run `android list sdk -a --extended`
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this). # Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).

View File

@ -34,7 +34,7 @@ allprojects {
version = '0.6.0-SNAPSHOT' version = '0.6.0-SNAPSHOT'
ext.gdxVersion = "1.4.1" ext.gdxVersion = "1.4.1"
ext.androidBuildVersionTools = "21.0.2" ext.androidBuildVersionTools = "21.1.1"
repositories { repositories {
mavenCentral() mavenCentral()

View File

@ -1,12 +1,17 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'android-maven' apply plugin: 'android-maven'
configurations {
eclipseCompile
}
dependencies { dependencies {
compile project(':vtm') compile project(':vtm')
provided files("${rootDir}/vtm-ext-libs/native-libs.jar") provided files("${rootDir}/vtm-ext-libs/native-libs.jar")
//compile 'com.android.support:support-v4:21.+' compile 'com.android.support:support-v4:21.+'
compile project(':appcompat')
eclipseCompile project(':appcompat')
} }
android { android {
@ -28,9 +33,18 @@ android {
lintOptions.abortOnError false lintOptions.abortOnError false
} }
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives sourcesJar
}
eclipse { eclipse {
classpath { classpath {
plusConfigurations += [ configurations.compile, configurations.provided ] plusConfigurations += [ configurations.compile, configurations.eclipseCompile ]
//noExportConfigurations += [ configurations.provided ] //noExportConfigurations += [ configurations.provided ]
//customizing the classes output directory: //customizing the classes output directory:
@ -45,16 +59,22 @@ eclipse {
// and generated copies // and generated copies
beforeMerged { classpath -> beforeMerged { classpath ->
// Remove all source entries to avoid overlap // Remove all source entries to avoid overlap
classpath.entries.removeAll() { c -> c.kind == 'src' } classpath.entries.removeAll() { c ->
c.kind == 'src'
}
} }
// only used to explode jni .so into aar // only used to explode jni .so into aar
whenMerged { whenMerged {
classpath -> classpath ->
classpath.entries.findAll { entry -> classpath.entries.findAll { c ->
entry.path.contains('native-libs') || c.path.contains('native-libs') ||
entry.path.contains('ANDROID_FRAMEWORK') c.path.contains('ANDROID_FRAMEWORK')
}*.exported = false }*.exported = false
classpath.entries.removeAll() { c ->
c.path.contains('support')
}
} }
// Direct manipulation of the generated classpath XML // Direct manipulation of the generated classpath XML

View File

@ -10,3 +10,11 @@ sourceSets {
main.java.srcDirs = ['src'] main.java.srcDirs = ['src']
main.resources.srcDirs = ['resources'] main.resources.srcDirs = ['resources']
} }
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}

View File

@ -15,6 +15,14 @@ sourceSets {
main.compileClasspath += configurations.providedCompile main.compileClasspath += configurations.providedCompile
} }
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
eclipse.classpath { eclipse.classpath {
//you can tweak the classpath of the Eclipse project by adding extra configurations: //you can tweak the classpath of the Eclipse project by adding extra configurations:
plusConfigurations += [ configurations.providedCompile ] plusConfigurations += [ configurations.providedCompile ]