Skip to content

Commit

Permalink
Merge pull request #199 from nielsvanvelzen/dokka-javadoc
Browse files Browse the repository at this point in the history
Publish javadoc using Dokka
  • Loading branch information
Maxr1998 authored Mar 23, 2021
2 parents 50d632f + 13e206c commit 48c0836
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 5 deletions.
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
id("io.github.gradle-nexus.publish-plugin").version(Dependencies.nexusPublishPluginVersion)
id("io.gitlab.arturbosch.detekt").version(Dependencies.detektVersion)
id("org.jetbrains.dokka").version(Dependencies.dokkaVersion)
}

// Versioning
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ object Dependencies {
const val kotlinPoet = "com.squareup:kotlinpoet:1.7.2"
const val kasechange = "net.pearx.kasechange:kasechange:1.3.0"
const val clikt = "com.github.ajalt.clikt:clikt:3.0.1"

// Gradle plugins
const val detektVersion = "1.14.2"
const val nexusPublishPluginVersion = "1.0.0"
const val dokkaVersion = "1.4.30"
}

/**
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
android.useAndroidX=true
kotlin.incremental=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m
7 changes: 7 additions & 0 deletions jellyfin-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
15 changes: 11 additions & 4 deletions jellyfin-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
id("kotlin")
}

kotlin {
explicitApi()
}

dependencies {
apiProject(":jellyfin-api")
apiProject(":jellyfin-model")
Expand All @@ -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)
}
7 changes: 7 additions & 0 deletions jellyfin-model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
7 changes: 7 additions & 0 deletions jellyfin-platform-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ 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 {
publishing.publications.create<MavenPublication>("default") {
from(components["release"])

artifact(tasks["sourcesArtifact"])
artifact(tasks["javadocJar"])

defaultPom()
}
Expand Down

0 comments on commit 48c0836

Please sign in to comment.