Aurimas Liutikas | ca04e9a | 2017-08-23 21:19:51 -0700 | [diff] [blame^] | 1 | apply plugin: android.support.SupportJavaLibraryPlugin |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 2 | |
| 3 | sourceSets { |
Tor Norbye | dc024b3 | 2014-03-19 09:30:22 -0700 | [diff] [blame] | 4 | main.java.srcDir 'src' |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 5 | } |
| 6 | |
Aurimas Liutikas | 8feb8c2 | 2017-01-29 11:51:03 -0800 | [diff] [blame] | 7 | compileJava { |
| 8 | sourceCompatibility = JavaVersion.VERSION_1_7 |
| 9 | targetCompatibility = JavaVersion.VERSION_1_7 |
| 10 | } |
Justin Klaassen | 68e7adb | 2016-01-21 12:50:47 -0800 | [diff] [blame] | 11 | |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 12 | jar { |
| 13 | from sourceSets.main.output |
Tor Norbye | 5dcac27 | 2016-09-09 09:15:10 -0700 | [diff] [blame] | 14 | // Strip out typedef classes. For Android libraries, this is done |
| 15 | // automatically by the Gradle plugin, but the Annotation library is a |
| 16 | // plain jar, built by the regular Gradle java plugin. The typedefs |
| 17 | // themselves have been manually extracted into the |
| 18 | // external-annotations directory, and those are packaged separately |
| 19 | // below by the annotationsZip task. |
| 20 | exclude('android/support/annotation/ProductionVisibility.class') |
| 21 | exclude('android/support/annotation/DimensionUnit.class') |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 22 | } |
| 23 | |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 24 | // configuration for the javadoc to include all source sets. |
| 25 | javadoc { |
| 26 | source sourceSets.main.allJava |
| 27 | } |
| 28 | |
Neil Fuller | 9bbcf88 | 2016-01-22 14:58:30 -0800 | [diff] [blame] | 29 | // Disable strict javadoc lint checks with javadoc v8 builds on Mac. http://b/26744780 |
| 30 | if (JavaVersion.current().isJava8Compatible()) { |
| 31 | tasks.withType(Javadoc) { |
Alan Viverette | 7b68068 | 2017-08-11 10:46:13 -0400 | [diff] [blame] | 32 | if (options.doclet == null) { |
| 33 | options.addBooleanOption('Xdoclint:none', true) |
| 34 | } |
Neil Fuller | 9bbcf88 | 2016-01-22 14:58:30 -0800 | [diff] [blame] | 35 | } |
| 36 | } |
| 37 | |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 38 | // custom tasks for creating source/javadoc jars |
| 39 | task sourcesJar(type: Jar, dependsOn:classes) { |
| 40 | classifier = 'sources' |
| 41 | from sourceSets.main.allSource |
| 42 | } |
| 43 | |
| 44 | task javadocJar(type: Jar, dependsOn:javadoc) { |
| 45 | classifier 'javadoc' |
| 46 | from javadoc.destinationDir |
| 47 | } |
| 48 | |
Tor Norbye | f6ac5e1 | 2016-09-07 12:47:35 -0700 | [diff] [blame] | 49 | task annotationsZip(type: Zip) { |
| 50 | classifier 'annotations' |
| 51 | from 'external-annotations' |
| 52 | } |
| 53 | |
| 54 | // add javadoc/source/annotations jar tasks as artifacts |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 55 | artifacts { |
| 56 | archives jar |
| 57 | archives sourcesJar |
| 58 | archives javadocJar |
Tor Norbye | f6ac5e1 | 2016-09-07 12:47:35 -0700 | [diff] [blame] | 59 | archives annotationsZip |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 60 | } |
Aurimas Liutikas | ca04e9a | 2017-08-23 21:19:51 -0700 | [diff] [blame^] | 61 | |
| 62 | supportLibrary { |
| 63 | name 'Android Support Library Annotations' |
| 64 | publish true |
| 65 | inceptionYear '2013' |
| 66 | description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs." |
| 67 | } |