Yigit Boyar | 02a9e8c | 2016-01-26 20:41:00 -0800 | [diff] [blame] | 1 | apply plugin: 'com.android.library' |
Chris Banes | 8d5b8a6 | 2015-08-19 14:45:09 +0100 | [diff] [blame] | 2 | |
| 3 | archivesBaseName = 'recommendation' |
| 4 | |
| 5 | dependencies { |
| 6 | compile project(':support-v4') |
| 7 | } |
| 8 | |
| 9 | android { |
Yigit Boyar | 02a9e8c | 2016-01-26 20:41:00 -0800 | [diff] [blame] | 10 | compileSdkVersion project.ext.currentSdk |
Chris Banes | 8d5b8a6 | 2015-08-19 14:45:09 +0100 | [diff] [blame] | 11 | |
Jose Lima | bd6fc08 | 2015-08-20 16:30:01 -0700 | [diff] [blame] | 12 | defaultConfig { |
| 13 | minSdkVersion 21 |
| 14 | } |
| 15 | |
Chris Banes | 8d5b8a6 | 2015-08-19 14:45:09 +0100 | [diff] [blame] | 16 | sourceSets { |
| 17 | main.manifest.srcFile 'AndroidManifest.xml' |
| 18 | main.java.srcDirs = ['src'] |
| 19 | main.res.srcDir 'res' |
| 20 | main.assets.srcDir 'assets' |
| 21 | main.resources.srcDir 'src' |
| 22 | |
| 23 | // this moves src/instrumentTest to tests so all folders follow: |
| 24 | // tests/java, tests/res, tests/assets, ... |
| 25 | // This is a *reset* so it replaces the default paths |
| 26 | androidTest.setRoot('tests') |
| 27 | androidTest.java.srcDir 'tests/src' |
| 28 | } |
| 29 | |
| 30 | compileOptions { |
| 31 | sourceCompatibility JavaVersion.VERSION_1_7 |
| 32 | targetCompatibility JavaVersion.VERSION_1_7 |
| 33 | } |
| 34 | } |
Alan Viverette | 523ece8 | 2016-06-09 14:13:34 -0400 | [diff] [blame] | 35 | |
| 36 | android.libraryVariants.all { variant -> |
| 37 | def name = variant.buildType.name |
| 38 | |
| 39 | if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { |
| 40 | return; // Skip debug builds. |
| 41 | } |
| 42 | def suffix = name.capitalize() |
| 43 | |
| 44 | def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){ |
| 45 | dependsOn variant.javaCompile |
| 46 | from variant.javaCompile.destinationDir |
| 47 | from 'LICENSE.txt' |
| 48 | } |
| 49 | def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) { |
| 50 | source android.sourceSets.main.java |
| 51 | classpath = files(variant.javaCompile.classpath.files) + files( |
| 52 | "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") |
| 53 | } |
| 54 | |
| 55 | def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) { |
| 56 | classifier = 'javadoc' |
| 57 | from 'build/docs/javadoc' |
| 58 | } |
| 59 | |
| 60 | def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { |
| 61 | classifier = 'sources' |
| 62 | from android.sourceSets.main.java.srcDirs |
| 63 | } |
| 64 | |
| 65 | artifacts.add('archives', javadocJarTask); |
| 66 | artifacts.add('archives', sourcesJarTask); |
| 67 | } |