From 5ff1bd8342b77f2648235ec6feb05c9c513538bf Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Sat, 15 Feb 2025 03:44:41 -0500 Subject: [PATCH 1/2] Update dokka plugin to v2 --- build-logic/src/main/kotlin/dokka.gradle.kts | 40 ++++++++++++-------- gh-pages/publish.sh | 4 +- gradle.properties | 3 ++ gradle/libs.versions.toml | 2 +- test-android/build.gradle.kts | 4 +- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/build-logic/src/main/kotlin/dokka.gradle.kts b/build-logic/src/main/kotlin/dokka.gradle.kts index c823985..11b3877 100644 --- a/build-logic/src/main/kotlin/dokka.gradle.kts +++ b/build-logic/src/main/kotlin/dokka.gradle.kts @@ -13,35 +13,45 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -import org.jetbrains.dokka.DokkaConfiguration.Visibility -import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.dokka.gradle.DokkaExtension +import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier import java.net.URI +import java.time.LocalDate plugins { id("org.jetbrains.dokka") } -// TODO: Update to Dokka 2.0.0 (Issue #121) -tasks.withType().configureEach { - suppressInheritedMembers = true +rootProject.dependencies { dokka(project(project.path)) } + +extensions.configure { + dokkaPublications.configureEach { + suppressInheritedMembers.set(true) + } dokkaSourceSets.configureEach { includes.from("README.md") - noStdlibLink = true + enableKotlinStdLibDocumentationLink.set(false) - externalDocumentationLink { - url = URI("https://error.kotlincrypto.org/").toURL() + externalDocumentationLinks { + register(project.path + ":error") { + url.set(URI("https://error.kotlincrypto.org/")) + } } sourceLink { - localDirectory = rootDir - remoteUrl = URI("https://github.com/KotlinCrypto/core/tree/master").toURL() - remoteLineSuffix = "#L" + localDirectory.set(rootDir) + remoteUrl.set(URI("https://github.com/KotlinCrypto/core/tree/master")) + remoteLineSuffix.set("#L") } - documentedVisibilities.set(setOf( - Visibility.PUBLIC, - Visibility.PROTECTED, - )) + documentedVisibilities( + VisibilityModifier.Public, + VisibilityModifier.Protected, + ) + } + + pluginsConfiguration.html { + footerMessage.set("© 2023-${LocalDate.now().year} Copyright KotlinCrypto") } } diff --git a/gh-pages/publish.sh b/gh-pages/publish.sh index e19a229..a85e525 100755 --- a/gh-pages/publish.sh +++ b/gh-pages/publish.sh @@ -26,8 +26,8 @@ echo "$REPO_NAME.kotlincrypto.org" > "$DIR_SCRIPT/$REPO_NAME/CNAME" cd .. ./gradlew clean -DKMP_TARGETS_ALL -./gradlew dokkaHtmlMultiModule --no-build-cache -DKMP_TARGETS_ALL -cp -aR build/dokka/htmlMultiModule/* gh-pages/$REPO_NAME +./gradlew dokkaGenerate --no-build-cache -DKMP_TARGETS_ALL +cp -aR build/dokka/html/* gh-pages/$REPO_NAME cd "$DIR_SCRIPT/$REPO_NAME" sed -i "s|module:|module:library/|g" "package-list" diff --git a/gradle.properties b/gradle.properties index 0028a19..c90ec2c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,9 @@ kotlin.mpp.applyDefaultHierarchyTemplate=false kotlin.mpp.stability.nowarn=true kotlin.native.ignoreDisabledTargets=true +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled +org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true + SONATYPE_HOST=S01 RELEASE_SIGNING_ENABLED=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 84ac266..fd4fed1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ androidx-test-runner = "1.5.2" # Do not upgrade. Tests run for API 15+, w gradle-benchmark = "0.4.13" gradle-android = "8.7.3" gradle-binary-compat = "0.17.0" -gradle-dokka = "1.9.20" +gradle-dokka = "2.0.0" gradle-kmp-configuration = "0.4.0" gradle-kotlin = "2.1.10" gradle-publish-maven = "0.30.0" diff --git a/test-android/build.gradle.kts b/test-android/build.gradle.kts index d2e2322..d6653b5 100644 --- a/test-android/build.gradle.kts +++ b/test-android/build.gradle.kts @@ -17,9 +17,7 @@ plugins { id("configuration") } -repositories { - google() -} +repositories { google() } kmpConfiguration { configure { From 875361d78baaedc17de08346b7e5e4edb772e779 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Wed, 19 Feb 2025 12:16:08 -0500 Subject: [PATCH 2/2] Ensure rootProject.group is different from module :library:core.group --- build.gradle.kts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3c7969c..6f1818e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,7 +26,13 @@ plugins { } allprojects { - findProperty("GROUP")?.let { group = it } + // https://github.com/Kotlin/dokka/issues/4030#issuecomment-2669254887 + if (this.project == this.rootProject) { + group = "root" + } else { + findProperty("GROUP")?.let { group = it } + } + findProperty("VERSION_NAME")?.let { version = it } findProperty("POM_DESCRIPTION")?.let { description = it.toString() }