diff --git a/.changes/bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c.json b/.changes/bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c.json new file mode 100644 index 000000000..c6bda7dc7 --- /dev/null +++ b/.changes/bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c.json @@ -0,0 +1,5 @@ +{ + "id": "bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c", + "type": "misc", + "description": "Upgrade to Dokka v2.0.0-Beta" +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index 47da0e888..97c896711 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,7 @@ ktlint_standard_backing-property-naming = disabled # enable trailing commas per JetBrains recommendation # (https://kotlinlang.org/docs/coding-conventions.html#trailing-commas) ij_kotlin_allow_trailing_comma_on_call_site = true -ij_kotlin_allow_trailing_comma = true \ No newline at end of file +ij_kotlin_allow_trailing_comma = true + +[buildSrc/build/**] +ktlint = disabled diff --git a/build.gradle.kts b/build.gradle.kts index ab17214cd..8c66b78fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,13 +18,13 @@ buildscript { } plugins { - alias(libs.plugins.dokka) + `dokka-convention` alias(libs.plugins.kotlinx.binary.compatibility.validator) + alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) // ensure the correct version of KGP ends up on our buildscript classpath // since build-plugins also has version in its dependency closure - alias(libs.plugins.kotlin.multiplatform) apply false - alias(libs.plugins.kotlin.jvm) apply false - alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) + id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false + id(libs.plugins.kotlin.jvm.get().pluginId) apply false } artifactSizeMetrics { @@ -40,32 +40,6 @@ val testJavaVersion = typedProp("test.java.version")?.let { } allprojects { - tasks.withType().configureEach { - val sdkVersion: String by project - moduleVersion.set(sdkVersion) - - val year = java.time.LocalDate.now().year - val pluginConfigMap = mapOf( - "org.jetbrains.dokka.base.DokkaBase" to """ - { - "customStyleSheets": [ - "${rootProject.file("docs/dokka-presets/css/logo-styles.css")}", - "${rootProject.file("docs/dokka-presets/css/aws-styles.css")}" - ], - "customAssets": [ - "${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}", - "${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}", - "${rootProject.file("docs/dokka-presets/scripts/accessibility.js")}" - ], - "footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.", - "separateInheritedMembers" : true, - "templatesDir": "${rootProject.file("docs/dokka-presets/templates")}" - } - """, - ) - pluginsMapConfiguration.set(pluginConfigMap) - } - if (rootProject.typedProp("kotlinWarningsAsErrors") == true) { tasks.withType { kotlinOptions.allWarningsAsErrors = true @@ -90,27 +64,18 @@ allprojects { } // configure the root multimodule docs -tasks.dokkaHtmlMultiModule.configure { +dokka { moduleName.set("Smithy Kotlin") - // Output subprojects' docs to /project-name/* instead of /path/to/project-name/* - // This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the - // package-list doesn't contain enough project path information to indicate where modules' documentation are - // located. - fileLayout.set { parent, child -> - parent.outputDirectory.dir(child.moduleName) + dokkaPublications.html { + includes.from( + rootProject.file("docs/dokka-presets/README.md"), + ) } +} - includes.from( - // NOTE: these get concatenated - rootProject.file("docs/dokka-presets/README.md"), - ) - - val excludeFromDocumentation = listOf( - project(":runtime:testing"), - project(":runtime:smithy-test"), - ) - removeChildTasks(excludeFromDocumentation) +dependencies { + dokka(project(":runtime")) } // Publishing diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..306b0211a --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +dependencies { + implementation(libs.dokka.gradle.plugin) + implementation(libs.kotlin.gradle.plugin) +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 000000000..62991c1ef --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,9 @@ +rootProject.name = "buildSrc" + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts new file mode 100644 index 000000000..9e3a40e63 --- /dev/null +++ b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts @@ -0,0 +1,31 @@ +import kotlin.text.set + +plugins { + id("org.jetbrains.dokka") +} + +dokka { + val sdkVersion: String by project + moduleVersion.set(sdkVersion) + + pluginsConfiguration.html { + customStyleSheets.from( + rootProject.file("docs/dokka-presets/css/logo-styles.css"), + rootProject.file("docs/dokka-presets/css/aws-styles.css"), + ) + + customAssets.from( + rootProject.file("docs/dokka-presets/assets/logo-icon.svg"), + rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png"), + rootProject.file("docs/dokka-presets/scripts/accessibility.js"), + ) + + footerMessage.set("© ${java.time.LocalDate.now().year}, Amazon Web Services, Inc. or its affiliates. All rights reserved.") + separateInheritedMembers.set(true) + templatesDir.set(rootProject.file("docs/dokka-presets/templates")) + } +} + +dependencies { + dokkaPlugin(project(":dokka-smithy")) +} diff --git a/codegen/smithy-aws-kotlin-codegen/build.gradle.kts b/codegen/smithy-aws-kotlin-codegen/build.gradle.kts index 96a7442a5..00b0b1f88 100644 --- a/codegen/smithy-aws-kotlin-codegen/build.gradle.kts +++ b/codegen/smithy-aws-kotlin-codegen/build.gradle.kts @@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) jacoco `maven-publish` } diff --git a/codegen/smithy-kotlin-codegen-testutils/build.gradle.kts b/codegen/smithy-kotlin-codegen-testutils/build.gradle.kts index 3bd714fb6..b24f9ac8b 100644 --- a/codegen/smithy-kotlin-codegen-testutils/build.gradle.kts +++ b/codegen/smithy-kotlin-codegen-testutils/build.gradle.kts @@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) jacoco `maven-publish` } diff --git a/codegen/smithy-kotlin-codegen/build.gradle.kts b/codegen/smithy-kotlin-codegen/build.gradle.kts index 0381edb03..0ac6c27c6 100644 --- a/codegen/smithy-kotlin-codegen/build.gradle.kts +++ b/codegen/smithy-kotlin-codegen/build.gradle.kts @@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) jacoco `maven-publish` } diff --git a/dokka-smithy/build.gradle.kts b/dokka-smithy/build.gradle.kts index 3126e0a24..5725d3ea5 100644 --- a/dokka-smithy/build.gradle.kts +++ b/dokka-smithy/build.gradle.kts @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget * SPDX-License-Identifier: Apache-2.0 */ plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) } description = "Custom Dokka plugin for Kotlin Smithy SDK API docs" diff --git a/gradle.properties b/gradle.properties index 8639149e0..b882f9c78 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,4 +16,6 @@ org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G sdkVersion=1.3.29-SNAPSHOT # codegen -codegenVersion=0.33.29-SNAPSHOT \ No newline at end of file +codegenVersion=0.33.29-SNAPSHOT + +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0683bfc2e..b92973d3e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin-version = "2.0.21" -dokka-version = "1.9.10" +dokka-version = "2.0.0-Beta" aws-kotlin-repo-tools-version = "0.4.16" @@ -34,12 +34,14 @@ jsoup-version = "1.18.1" [libraries] aws-kotlin-repo-tools-build-support = { module="aws.sdk.kotlin.gradle:build-support", version.ref = "aws-kotlin-repo-tools-version" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-version" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-version"} kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin-version"} kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-version" } kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin-version" } dokka-core = { module = "org.jetbrains.dokka:dokka-core", version.ref = "dokka-version" } dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka-version" } +dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka-version" } kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu-version" } kotlinx-atomicfu-plugin = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu-version" } @@ -101,8 +103,8 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup-version" } [plugins] dokka = { id = "org.jetbrains.dokka", version.ref = "dokka-version"} -kotlin-jvm = {id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" } -kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark-version" } kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"} diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 82a5b5fe5..7a6945c17 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -4,10 +4,11 @@ */ import aws.sdk.kotlin.gradle.dsl.configurePublishing import aws.sdk.kotlin.gradle.kmp.* +import org.gradle.kotlin.dsl.apply import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - alias(libs.plugins.dokka) + `dokka-convention` alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false jacoco } @@ -24,7 +25,6 @@ subprojects { apply { plugin("org.jetbrains.kotlin.multiplatform") - plugin("org.jetbrains.dokka") plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId) } @@ -62,10 +62,6 @@ subprojects { listOf("kotlin.RequiresOptIn").forEach { languageSettings.optIn(it) } } - dependencies { - dokkaPlugin(project(":dokka-smithy")) - } - tasks.withType { compilerOptions { jvmTarget.set(JvmTarget.JVM_1_8) @@ -78,3 +74,15 @@ subprojects { } } } + +val excludeFromDocumentation = listOf( + ":runtime:testing", + ":runtime:smithy-test", +) + +dependencies { + subprojects.filterNot { excludeFromDocumentation.contains(it.path) }.forEach { + it.plugins.apply("dokka-convention") // Apply the Dokka conventions plugin to the submodule + dokka(project(it.path)) // Aggregate the submodule's generated documentation + } +} diff --git a/tests/codegen/nullability-tests/build.gradle.kts b/tests/codegen/nullability-tests/build.gradle.kts index e69809dc6..b05b7635b 100644 --- a/tests/codegen/nullability-tests/build.gradle.kts +++ b/tests/codegen/nullability-tests/build.gradle.kts @@ -6,7 +6,7 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir import aws.sdk.kotlin.gradle.dsl.skipPublishing plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) } diff --git a/tests/codegen/paginator-tests/build.gradle.kts b/tests/codegen/paginator-tests/build.gradle.kts index caa3afbe4..948f2b079 100644 --- a/tests/codegen/paginator-tests/build.gradle.kts +++ b/tests/codegen/paginator-tests/build.gradle.kts @@ -6,7 +6,7 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir import aws.sdk.kotlin.gradle.dsl.skipPublishing plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) } diff --git a/tests/codegen/serde-tests/build.gradle.kts b/tests/codegen/serde-tests/build.gradle.kts index 0bfe1ca08..f28091e7e 100644 --- a/tests/codegen/serde-tests/build.gradle.kts +++ b/tests/codegen/serde-tests/build.gradle.kts @@ -6,7 +6,7 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir import aws.sdk.kotlin.gradle.dsl.skipPublishing plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) } diff --git a/tests/codegen/waiter-tests/build.gradle.kts b/tests/codegen/waiter-tests/build.gradle.kts index 4c48a80c6..72b244a6c 100644 --- a/tests/codegen/waiter-tests/build.gradle.kts +++ b/tests/codegen/waiter-tests/build.gradle.kts @@ -6,7 +6,7 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir import aws.sdk.kotlin.gradle.dsl.skipPublishing plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) }