diff --git a/android/autodispose-android-archcomponents-kotlin/build.gradle b/android/autodispose-android-archcomponents-kotlin/build.gradle index a8b0dbbd1..989720d4e 100644 --- a/android/autodispose-android-archcomponents-kotlin/build.gradle +++ b/android/autodispose-android-archcomponents-kotlin/build.gradle @@ -22,11 +22,13 @@ buildscript { dependencies { classpath deps.build.gradlePlugins.android classpath deps.build.gradlePlugins.kotlin + classpath deps.build.gradlePlugins.dokkaAndroid } } apply plugin: 'com.android.library' apply plugin: 'org.jetbrains.kotlin.android' +apply plugin: 'org.jetbrains.dokka-android' android { compileSdkVersion deps.build.compileSdkVersion @@ -53,4 +55,5 @@ dependencies { androidTestCompile project(':test-utils') } +apply from: rootProject.file('gradle/android-kotlin-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/autodispose-android-archcomponents-test-kotlin/build.gradle b/android/autodispose-android-archcomponents-test-kotlin/build.gradle index f9dd5aeef..13b1fcc38 100644 --- a/android/autodispose-android-archcomponents-test-kotlin/build.gradle +++ b/android/autodispose-android-archcomponents-test-kotlin/build.gradle @@ -22,11 +22,13 @@ buildscript { dependencies { classpath deps.build.gradlePlugins.android classpath deps.build.gradlePlugins.kotlin + classpath deps.build.gradlePlugins.dokkaAndroid } } apply plugin: 'com.android.library' apply plugin: 'org.jetbrains.kotlin.android' +apply plugin: 'org.jetbrains.dokka-android' android { compileSdkVersion deps.build.compileSdkVersion @@ -53,4 +55,5 @@ dependencies { androidTestCompile project(':test-utils') } +apply from: rootProject.file('gradle/android-kotlin-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/autodispose-android-archcomponents-test/build.gradle b/android/autodispose-android-archcomponents-test/build.gradle index eee787691..e61d98bf8 100644 --- a/android/autodispose-android-archcomponents-test/build.gradle +++ b/android/autodispose-android-archcomponents-test/build.gradle @@ -65,4 +65,5 @@ tasks.withType(JavaCompile) { "-XepOpt:NullAway:AnnotatedPackages=com.uber"] } +apply from: rootProject.file('gradle/android-java-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/autodispose-android-archcomponents/build.gradle b/android/autodispose-android-archcomponents/build.gradle index abd6b48e8..3445c8678 100644 --- a/android/autodispose-android-archcomponents/build.gradle +++ b/android/autodispose-android-archcomponents/build.gradle @@ -75,4 +75,5 @@ tasks.withType(JavaCompile) { "-XepOpt:NullAway:AnnotatedPackages=com.uber"] } +apply from: rootProject.file('gradle/android-java-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/autodispose-android-kotlin/build.gradle b/android/autodispose-android-kotlin/build.gradle index d33ef1318..2cd5cedc5 100644 --- a/android/autodispose-android-kotlin/build.gradle +++ b/android/autodispose-android-kotlin/build.gradle @@ -22,11 +22,13 @@ buildscript { dependencies { classpath deps.build.gradlePlugins.android classpath deps.build.gradlePlugins.kotlin + classpath deps.build.gradlePlugins.dokkaAndroid } } apply plugin: 'com.android.library' apply plugin: 'org.jetbrains.kotlin.android' +apply plugin: 'org.jetbrains.dokka-android' android { compileSdkVersion deps.build.compileSdkVersion @@ -53,4 +55,5 @@ dependencies { androidTestCompile project(':test-utils') } +apply from: rootProject.file('gradle/android-kotlin-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/autodispose-android/build.gradle b/android/autodispose-android/build.gradle index 69e934bd3..4f5299482 100755 --- a/android/autodispose-android/build.gradle +++ b/android/autodispose-android/build.gradle @@ -70,4 +70,5 @@ tasks.withType(JavaCompile) { options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"] } +apply from: rootProject.file('gradle/android-java-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/autodispose-kotlin/build.gradle b/autodispose-kotlin/build.gradle index b3409147a..257f96439 100644 --- a/autodispose-kotlin/build.gradle +++ b/autodispose-kotlin/build.gradle @@ -1,10 +1,12 @@ buildscript { dependencies { classpath deps.build.gradlePlugins.kotlin + classpath deps.build.gradlePlugins.dokka } } apply plugin: 'org.jetbrains.kotlin.jvm' +apply plugin: 'org.jetbrains.dokka' dependencies { compile deps.kotlin.stdlib @@ -13,4 +15,5 @@ dependencies { testCompile project(':test-utils') } +apply from: rootProject.file('gradle/kotlin-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/autodispose-rxlifecycle/build.gradle b/autodispose-rxlifecycle/build.gradle index 69f655287..cd2c64a44 100644 --- a/autodispose-rxlifecycle/build.gradle +++ b/autodispose-rxlifecycle/build.gradle @@ -55,4 +55,5 @@ tasks.withType(JavaCompile) { options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"] } +apply from: rootProject.file('gradle/java-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/autodispose/build.gradle b/autodispose/build.gradle index 7d00387fc..43cc80ba5 100755 --- a/autodispose/build.gradle +++ b/autodispose/build.gradle @@ -53,4 +53,5 @@ tasks.withType(JavaCompile) { options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"] } +apply from: rootProject.file('gradle/java-artifacts.gradle') apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/gradle/android-java-artifacts.gradle b/gradle/android-java-artifacts.gradle new file mode 100644 index 000000000..d2f5a438e --- /dev/null +++ b/gradle/android-java-artifacts.gradle @@ -0,0 +1,20 @@ +task androidJavadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + exclude '**/internal/*' + + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} + +task docJar(type: Jar, dependsOn: androidJavadoc) { + classifier = 'javadoc' + from androidJavadoc.destinationDir +} + +task sourceJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.sourceFiles +} diff --git a/gradle/android-kotlin-artifacts.gradle b/gradle/android-kotlin-artifacts.gradle new file mode 100644 index 000000000..f3eb86475 --- /dev/null +++ b/gradle/android-kotlin-artifacts.gradle @@ -0,0 +1,19 @@ +dokka { + externalDocumentationLink { + url = new URL("http://reactivex.io/RxJava/2.x/javadoc/") + } + + outputFormat = 'html' + outputDirectory = "$buildDir/docs/kdoc" + sourceDirs = android.sourceSets.main.java.srcDirs +} + +task docJar(type: Jar, dependsOn: dokka) { + classifier = 'javadoc' + from dokka.outputDirectory +} + +task sourceJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.sourceFiles +} diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index c6bec0e6d..5161e99bd 100755 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -19,7 +19,8 @@ def versions = [ archComponents: '1.0.0-rc1', errorProne: '2.1.1', kotlin: '1.1.51', - support: '26.1.0' + support: '26.1.0', + dokka: '0.9.15' ] def build = [ @@ -41,7 +42,9 @@ def build = [ android: 'com.android.tools.build:gradle:2.3.0', apt: 'net.ltgt.gradle:gradle-apt-plugin:0.11', errorProne: 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.11', - kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" + kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}", + dokka: "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}", + dokkaAndroid: "org.jetbrains.dokka:dokka-android-gradle-plugin:${versions.dokka}" ] ] diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle index f4087a8d4..d10df48bb 100755 --- a/gradle/gradle-mvn-push.gradle +++ b/gradle/gradle-mvn-push.gradle @@ -134,28 +134,6 @@ afterEvaluate { project -> } } } - - task androidJavadocs(type: Javadoc) { - if (!project.plugins.hasPlugin('kotlin-android')) { - source = android.sourceSets.main.java.srcDirs - } - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - exclude '**/internal/*' - - if (JavaVersion.current().isJava8Compatible()) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } - - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.sourceFiles - } } else { install { repositories.mavenInstaller { @@ -192,34 +170,10 @@ afterEvaluate { project -> } } } - - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir - } - } - - if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } } artifacts { - if (project.getPlugins().hasPlugin('com.android.application') || - project.getPlugins().hasPlugin('com.android.library')) { - archives androidSourcesJar - archives androidJavadocsJar - } else { - archives sourcesJar - archives javadocJar - } + archives sourceJar + archives docJar } } diff --git a/gradle/java-artifacts.gradle b/gradle/java-artifacts.gradle new file mode 100644 index 000000000..4230d85fd --- /dev/null +++ b/gradle/java-artifacts.gradle @@ -0,0 +1,17 @@ +task javaJavadoc(type: Javadoc) { + source = sourceSets.main.allSource + + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} + +task sourceJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource.srcDirs +} + +task docJar(type: Jar, dependsOn: javaJavadoc) { + classifier = 'javadoc' + from javaJavadoc.destinationDir +} diff --git a/gradle/kotlin-artifacts.gradle b/gradle/kotlin-artifacts.gradle new file mode 100644 index 000000000..9ea262579 --- /dev/null +++ b/gradle/kotlin-artifacts.gradle @@ -0,0 +1,19 @@ +dokka { + externalDocumentationLink { + url = new URL("http://reactivex.io/RxJava/2.x/javadoc/") + } + + outputFormat = 'html' + outputDirectory = "$buildDir/docs/kdoc" + sourceDirs = sourceSets.main.allSource +} + +task sourceJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task docJar(type: Jar, dependsOn: dokka) { + classifier = 'javadoc' + from dokka.outputDirectory +}