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 | |
| 7 | jar { |
| 8 | from sourceSets.main.output |
Tor Norbye | 5dcac27 | 2016-09-09 09:15:10 -0700 | [diff] [blame] | 9 | // Strip out typedef classes. For Android libraries, this is done |
| 10 | // automatically by the Gradle plugin, but the Annotation library is a |
| 11 | // plain jar, built by the regular Gradle java plugin. The typedefs |
| 12 | // themselves have been manually extracted into the |
| 13 | // external-annotations directory, and those are packaged separately |
| 14 | // below by the annotationsZip task. |
| 15 | exclude('android/support/annotation/ProductionVisibility.class') |
| 16 | exclude('android/support/annotation/DimensionUnit.class') |
Aurimas Liutikas | c094867 | 2017-09-21 11:54:20 -0700 | [diff] [blame^] | 17 | preserveFileTimestamps = false |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 18 | } |
| 19 | |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 20 | // configuration for the javadoc to include all source sets. |
| 21 | javadoc { |
| 22 | source sourceSets.main.allJava |
| 23 | } |
| 24 | |
Neil Fuller | 9bbcf88 | 2016-01-22 14:58:30 -0800 | [diff] [blame] | 25 | // Disable strict javadoc lint checks with javadoc v8 builds on Mac. http://b/26744780 |
| 26 | if (JavaVersion.current().isJava8Compatible()) { |
| 27 | tasks.withType(Javadoc) { |
Alan Viverette | 7b68068 | 2017-08-11 10:46:13 -0400 | [diff] [blame] | 28 | if (options.doclet == null) { |
| 29 | options.addBooleanOption('Xdoclint:none', true) |
| 30 | } |
Neil Fuller | 9bbcf88 | 2016-01-22 14:58:30 -0800 | [diff] [blame] | 31 | } |
| 32 | } |
| 33 | |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 34 | // custom tasks for creating source/javadoc jars |
| 35 | task sourcesJar(type: Jar, dependsOn:classes) { |
| 36 | classifier = 'sources' |
| 37 | from sourceSets.main.allSource |
| 38 | } |
| 39 | |
| 40 | task javadocJar(type: Jar, dependsOn:javadoc) { |
| 41 | classifier 'javadoc' |
| 42 | from javadoc.destinationDir |
| 43 | } |
| 44 | |
Tor Norbye | f6ac5e1 | 2016-09-07 12:47:35 -0700 | [diff] [blame] | 45 | task annotationsZip(type: Zip) { |
| 46 | classifier 'annotations' |
| 47 | from 'external-annotations' |
| 48 | } |
| 49 | |
| 50 | // add javadoc/source/annotations jar tasks as artifacts |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 51 | artifacts { |
| 52 | archives jar |
| 53 | archives sourcesJar |
| 54 | archives javadocJar |
Tor Norbye | f6ac5e1 | 2016-09-07 12:47:35 -0700 | [diff] [blame] | 55 | archives annotationsZip |
Tor Norbye | be61afa | 2013-11-13 09:58:36 -0800 | [diff] [blame] | 56 | } |
Aurimas Liutikas | ca04e9a | 2017-08-23 21:19:51 -0700 | [diff] [blame] | 57 | |
| 58 | supportLibrary { |
| 59 | name 'Android Support Library Annotations' |
| 60 | publish true |
| 61 | inceptionYear '2013' |
| 62 | 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." |
| 63 | } |