apply plugin: 'com.android.library'
archivesBaseName = 'recommendation'
dependencies {
compile project(':support-v4')
}
android {
compileSdkVersion project.ext.currentSdk
defaultConfig {
minSdkVersion 21
}
sourceSets {
main.manifest.srcFile 'AndroidManifest.xml'
main.java.srcDirs = ['src']
main.res.srcDir 'res'
main.assets.srcDir 'assets'
main.resources.srcDir 'src'
// this moves src/instrumentTest to tests so all folders follow:
// tests/java, tests/res, tests/assets, ...
// This is a *reset* so it replaces the default paths
androidTest.setRoot('tests')
androidTest.java.srcDir 'tests/src'
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
def suffix = name.capitalize()
def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir
from 'LICENSE.txt'
}
def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
source android.sourceSets.main.java
classpath = files(variant.javaCompile.classpath.files) + files(
"${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
}
def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts.add('archives', javadocJarTask);
artifacts.add('archives', sourcesJarTask);
}