|
| 1 | +buildscript { |
| 2 | + repositories { |
| 3 | + jcenter() |
| 4 | + } |
| 5 | + dependencies { |
| 6 | + classpath 'com.android.tools.build:gradle:1.5.0' |
| 7 | + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' |
| 8 | + } |
| 9 | +} |
| 10 | + |
| 11 | +repositories { |
| 12 | + jcenter() |
| 13 | +} |
| 14 | + |
| 15 | +apply from: 'https://gist.githubusercontent.com/larsgrefer/30b36bd74b162631f143/raw/d4155e673d7908193eb65f9bb6640250d7f282d8/git-version.gradle' |
| 16 | + |
| 17 | +apply plugin: 'com.android.library' |
| 18 | + |
| 19 | +android { |
| 20 | + compileSdkVersion 23 |
| 21 | + buildToolsVersion "23.0.2" |
| 22 | + |
| 23 | + defaultConfig { |
| 24 | + minSdkVersion 11 |
| 25 | + targetSdkVersion 21 |
| 26 | + versionName project.version |
| 27 | + } |
| 28 | + |
| 29 | + compileOptions { |
| 30 | + sourceCompatibility JavaVersion.VERSION_1_7 |
| 31 | + targetCompatibility JavaVersion.VERSION_1_7 |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +dependencies { |
| 36 | + testCompile 'junit:junit:4.12' |
| 37 | +} |
| 38 | + |
| 39 | +apply plugin: 'com.github.dcendents.android-maven' |
| 40 | + |
| 41 | +android.libraryVariants.all { variant -> |
| 42 | + |
| 43 | + if (variant.name.contains("release")) { |
| 44 | + task("sources${variant.name.capitalize()}Jar", type: Jar) { |
| 45 | + from variant.javaCompile.source |
| 46 | + classifier = 'sources' |
| 47 | + } |
| 48 | + |
| 49 | + task("javadoc${variant.name.capitalize()}", type: Javadoc) { |
| 50 | + description "Generates Javadoc for $variant.name." |
| 51 | + source = variant.javaCompile.source |
| 52 | + ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" |
| 53 | + classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) |
| 54 | + options.links("http://docs.oracle.com/javase/7/docs/api/"); |
| 55 | + options.links("http://developer.android.com/reference/"); |
| 56 | + options.addStringOption('Xdoclint:none', '-quiet') |
| 57 | + failOnError false |
| 58 | + } |
| 59 | + |
| 60 | + task("javadoc${variant.name.capitalize()}Jar", type: Jar, dependsOn: "javadoc${variant.name.capitalize()}") { |
| 61 | + description "Generates Javadoc Jar for $variant.name." |
| 62 | + classifier = 'javadoc' |
| 63 | + from tasks.findByPath("javadoc${variant.name.capitalize()}").destinationDir |
| 64 | + } |
| 65 | + |
| 66 | + artifacts { |
| 67 | + archives tasks.findByPath("javadoc${variant.name.capitalize()}Jar") |
| 68 | + archives tasks.findByPath("sources${variant.name.capitalize()}Jar") |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | + |
0 commit comments