From 48423356ba68915390136f464455d5259479a755 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Tue, 23 Mar 2021 20:12:49 +0100 Subject: [PATCH 1/3] Add javadoc using Dokka --- build.gradle.kts | 2 ++ jellyfin-api/build.gradle.kts | 7 +++++++ jellyfin-core/build.gradle.kts | 15 +++++++++++---- jellyfin-model/build.gradle.kts | 7 +++++++ jellyfin-platform-android/build.gradle.kts | 7 +++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 850979ade..2240566ff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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() apply() apply() + apply() // Add dependency repositories repositories.defaultRepositories() diff --git a/jellyfin-api/build.gradle.kts b/jellyfin-api/build.gradle.kts index bf94d4fde..ab69b0dff 100644 --- a/jellyfin-api/build.gradle.kts +++ b/jellyfin-api/build.gradle.kts @@ -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("default") { from(components["kotlin"]) artifact(sourcesJar) + artifact(javadocJar) } diff --git a/jellyfin-core/build.gradle.kts b/jellyfin-core/build.gradle.kts index 7f24abf61..4bed60732 100644 --- a/jellyfin-core/build.gradle.kts +++ b/jellyfin-core/build.gradle.kts @@ -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("default") { from(components["kotlin"]) artifact(sourcesJar) + artifact(javadocJar) } diff --git a/jellyfin-model/build.gradle.kts b/jellyfin-model/build.gradle.kts index 350eb002e..74ba71780 100644 --- a/jellyfin-model/build.gradle.kts +++ b/jellyfin-model/build.gradle.kts @@ -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("default") { from(components["kotlin"]) artifact(sourcesJar) + artifact(javadocJar) } diff --git a/jellyfin-platform-android/build.gradle.kts b/jellyfin-platform-android/build.gradle.kts index 4648293dd..3b8f66675 100644 --- a/jellyfin-platform-android/build.gradle.kts +++ b/jellyfin-platform-android/build.gradle.kts @@ -49,6 +49,12 @@ tasks.create("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() } From c01ed08bbcc27ca15ec77243c309f1734afbde85 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Tue, 23 Mar 2021 20:13:05 +0100 Subject: [PATCH 2/3] Increase memory for Dokka --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 001b3fa6b..c9733f617 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ android.useAndroidX=true kotlin.incremental=true +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m From 13e206c08b6e6f9747ce91a91291db555218826c Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Tue, 23 Mar 2021 21:39:35 +0100 Subject: [PATCH 3/3] Move Dokka and Nexus Publish plugin versions to buildSrc --- build.gradle.kts | 4 ++-- buildSrc/src/main/kotlin/Dependencies.kt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2240566ff..362f469b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +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 "1.4.30" + id("org.jetbrains.dokka").version(Dependencies.dokkaVersion) } // Versioning diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 907c8a395..e39b85d19 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -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" } /**