Add javadoc using Dokka

This commit is contained in:
Niels van Velzen 2021-03-23 20:12:49 +01:00
parent 50d632fcb4
commit 48423356ba
5 changed files with 34 additions and 4 deletions

View File

@ -1,6 +1,7 @@
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
id("io.gitlab.arturbosch.detekt").version(Dependencies.detektVersion)
id("org.jetbrains.dokka") version "1.4.30"
}
// Versioning
@ -32,6 +33,7 @@ subprojects {
apply<SigningPlugin>()
apply<MavenPublishPlugin>()
apply<io.gitlab.arturbosch.detekt.DetektPlugin>()
apply<org.jetbrains.dokka.gradle.DokkaPlugin>()
// Add dependency repositories
repositories.defaultRepositories()

View File

@ -30,8 +30,15 @@ val sourcesJar by tasks.creating(Jar::class) {
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.getByName("dokkaJavadoc"))
archiveClassifier.set("javadoc")
from("$buildDir/dokka/javadoc")
}
publishing.publications.create<MavenPublication>("default") {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
}

View File

@ -2,10 +2,6 @@ plugins {
id("kotlin")
}
kotlin {
explicitApi()
}
dependencies {
apiProject(":jellyfin-api")
apiProject(":jellyfin-model")
@ -23,14 +19,25 @@ dependencies {
testImplementation(Dependencies.Kotlin.Test.junit)
}
kotlin {
explicitApi()
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.getByName("dokkaJavadoc"))
archiveClassifier.set("javadoc")
from("$buildDir/dokka/javadoc")
}
publishing.publications.create<MavenPublication>("default") {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
}

View File

@ -23,8 +23,15 @@ val sourcesJar by tasks.creating(Jar::class) {
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.getByName("dokkaJavadoc"))
archiveClassifier.set("javadoc")
from("$buildDir/dokka/javadoc")
}
publishing.publications.create<MavenPublication>("default") {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
}

View File

@ -49,6 +49,12 @@ tasks.create<Jar>("sourcesArtifact") {
from(android.sourceSets["main"].java.srcDirs)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(tasks.getByName("dokkaJavadoc"))
archiveClassifier.set("javadoc")
from("$buildDir/dokka/javadoc")
}
// Because of limitations in the android plugin
// the publishing definition should be inside the "afterEvaluate" block
afterEvaluate {
@ -56,6 +62,7 @@ afterEvaluate {
from(components["release"])
artifact(tasks["sourcesArtifact"])
artifact(tasks["javadocJar"])
defaultPom()
}