Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dokka artifacts #122 #126

Merged
merged 5 commits into from
Nov 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions android/autodispose-android-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions autodispose-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
def versions = [
androidTest: '0.5',
archComponents: '1.0.0-rc1',
dokka: '0.9.15',
errorProne: '2.1.1',
kotlin: '1.1.51',
support: '26.1.0'
Expand All @@ -40,6 +41,8 @@ def build = [
gradlePlugins: [
android: 'com.android.tools.build:gradle:2.3.0',
apt: 'net.ltgt.gradle:gradle-apt-plugin:0.11',
dokka: "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}",
dokkaAndroid: "org.jetbrains.dokka:dokka-android-gradle-plugin:${versions.dokka}",
errorProne: 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.11',
kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
]
Expand Down
149 changes: 105 additions & 44 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,101 @@ def getRepositoryPassword() {
return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
}

def kotlinAndroidArtifactTasks() {
if (!project.plugins.hasPlugin('org.jetbrains.dokka-android')) {
throw new GradleException("Apply the dokka-android plugin in ${project.name}")
}

dokka {
externalDocumentationLink {
url = new URL("http://reactivex.io/RxJava/2.x/javadoc/")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what are you thinking here? That's what builds in linking between the kdoc and rxjava's doc, so if you're looking at documentation that links to rxjava you can click on it and jump straight to the rxjava documentation.

I could see adding https://uber.github.io/AutoDispose/0.x/ being useful (at least until there's proper inter-module linking). Although I think each module's doc might need to be linked independently. The dokka examples indicate you can have multiple external documentation links so if you want I could add it and keep rxjava.

I actually didn't even realize the documentation was hosted at https://uber.github.io/AutoDispose/0.x/, this PR just creates javadoc artifacts for maven.

I see https://github.com/uber/AutoDispose/tree/gh-pages/0.x but don't really know how/if the process of getting the doc in there is automated. If you can point me in the right direction I'd be happy to include that as part of this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'd held off on publicizing the docs site till dokka was figured out. I upload them via osstrich, unfortunately not sure automating it is viable vs just doing it manually after releases (don't worry about it for this PR). I didn't realize that was for dependencies of the project though, so this makes sense 👍

}

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.srcDirs
}
}

def kotlinArtifactTasks() {
if (!project.plugins.hasPlugin('org.jetbrains.dokka')) {
throw new GradleException("Apply the dokka plugin in ${project.name}")
}

dokka {
externalDocumentationLink {
url = new URL("http://reactivex.io/RxJava/2.x/javadoc/")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

}

outputFormat = 'html'
outputDirectory = "$buildDir/docs/kdoc"
sourceDirs = sourceSets.main.allSource
}

task docJar(type: Jar, dependsOn: dokka) {
classifier = 'javadoc'
from dokka.outputDirectory
}

task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

def androidArtifactTasks() {
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
}
}

def javaArtifactTasks() {
task javaJavadoc(type: Javadoc) {
source = sourceSets.main.allSource

if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}

task docJar(type: Jar, dependsOn: javaJavadoc) {
classifier = 'javadoc'
from javaJavadoc.destinationDir
}

task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource.srcDirs
}
}

afterEvaluate { project ->
uploadArchives {
repositories {
Expand Down Expand Up @@ -135,26 +230,10 @@ 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
if (project.plugins.hasPlugin('kotlin-android')) {
kotlinAndroidArtifactTasks()
} else {
androidArtifactTasks()
}
} else {
install {
Expand Down Expand Up @@ -193,33 +272,15 @@ 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')
}
if (project.plugins.hasPlugin('kotlin')) {
kotlinArtifactTasks()
} else {
javaArtifactTasks()
}
}

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
}
}