Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: upgrade to Dokka 2.0.0-Beta #1195

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "bff93ee1-3d3b-4e21-b19f-7f9b3a61a04c",
"type": "misc",
"description": "Upgrade to Dokka v2.0.0-Beta"
}
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
ij_kotlin_allow_trailing_comma = true

[buildSrc/build/**]
ktlint = disabled
59 changes: 12 additions & 47 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <some> 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 {
Expand All @@ -40,32 +40,6 @@ val testJavaVersion = typedProp<String>("test.java.version")?.let {
}

allprojects {
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().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<Boolean>("kotlinWarningsAsErrors") == true) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
Expand All @@ -90,27 +64,18 @@ allprojects {
}

// configure the root multimodule docs
tasks.dokkaHtmlMultiModule.configure {
dokka {
moduleName.set("Smithy Kotlin")

// Output subprojects' docs to <docs-base>/project-name/* instead of <docs-base>/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
Expand Down
13 changes: 13 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation(libs.dokka.gradle.plugin)
implementation(libs.kotlin.gradle.plugin)
}
9 changes: 9 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootProject.name = "buildSrc"

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
31 changes: 31 additions & 0 deletions buildSrc/src/main/kotlin/dokka-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"))
}
2 changes: 1 addition & 1 deletion codegen/smithy-aws-kotlin-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/smithy-kotlin-codegen-testutils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/smithy-kotlin-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
Expand Down
2 changes: 1 addition & 1 deletion dokka-smithy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
sdkVersion=1.3.29-SNAPSHOT

# codegen
codegenVersion=0.33.29-SNAPSHOT
codegenVersion=0.33.29-SNAPSHOT

org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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" }
Expand Down Expand Up @@ -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"}
Expand Down
20 changes: 14 additions & 6 deletions runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}

Expand Down Expand Up @@ -62,10 +62,6 @@ subprojects {
listOf("kotlin.RequiresOptIn").forEach { languageSettings.optIn(it) }
}

dependencies {
dokkaPlugin(project(":dokka-smithy"))
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
Expand All @@ -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
}
}
2 changes: 1 addition & 1 deletion tests/codegen/nullability-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/paginator-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/serde-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/waiter-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading