Skip to content

Commit 3d2b3ea

Browse files
committed
Docs are building
1 parent fb94044 commit 3d2b3ea

File tree

16 files changed

+145
-111
lines changed

16 files changed

+145
-111
lines changed

aws-runtime/aws-config/build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections
66
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
77
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
8-
import org.jetbrains.dokka.gradle.DokkaTaskPartial
98

109
plugins {
1110
alias(libs.plugins.aws.kotlin.repo.tools.smithybuild)
@@ -83,7 +82,6 @@ smithyBuild {
8382
val basePackage = "aws.sdk.kotlin.runtime.auth.credentials.internal"
8483

8584
projections {
86-
8785
// generate an sts client
8886
create("sts-credentials-provider") {
8987
imports = listOf(
@@ -241,9 +239,12 @@ smithyBuild.projections.all {
241239
}
242240
}
243241

244-
// suppress internal generated clients
245-
tasks.named<DokkaTaskPartial>("dokkaHtmlPartial") {
246-
dependsOn(tasks.generateSmithyProjections)
242+
// Suppress internally-generated clients
243+
dokka {
244+
tasks.dokkaGenerateModuleHtml {
245+
dependsOn(tasks.generateSmithyProjections)
246+
}
247+
247248
dokkaSourceSets.configureEach {
248249
perPackageOption {
249250
matchingRegex.set(""".*\.internal.*""")

aws-runtime/build.gradle.kts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
99
description = "AWS client runtime support for generated service clients"
1010

1111
plugins {
12-
alias(libs.plugins.dokka)
12+
`dokka-convention`
1313
alias(libs.plugins.kotlinx.binary.compatibility.validator)
1414
alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false
1515
jacoco
@@ -28,7 +28,6 @@ subprojects {
2828

2929
apply {
3030
plugin("org.jetbrains.kotlin.multiplatform")
31-
plugin("org.jetbrains.dokka")
3231
plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId)
3332
}
3433

@@ -61,10 +60,6 @@ subprojects {
6160
listOf("kotlin.RequiresOptIn").forEach { languageSettings.optIn(it) }
6261
}
6362

64-
dependencies {
65-
dokkaPlugin(project(":dokka-aws"))
66-
}
67-
6863
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
6964
compilerOptions {
7065
jvmTarget.set(JvmTarget.JVM_1_8)
@@ -77,3 +72,11 @@ subprojects {
7772
}
7873
}
7974
}
75+
76+
// Configure Dokka for subprojects
77+
dependencies {
78+
subprojects.forEach {
79+
it.plugins.apply("dokka-convention") // Apply the Dokka conventions plugin to the subproject
80+
dokka(project(it.path)) // Aggregate the subprojects' generated documentation
81+
}
82+
}

build.gradle.kts

Lines changed: 15 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ buildscript {
1818
}
1919

2020
plugins {
21-
alias(libs.plugins.dokka)
21+
`dokka-convention`
2222
// ensure the correct version of KGP ends up on our buildscript classpath
23-
alias(libs.plugins.kotlin.multiplatform) apply false
24-
alias(libs.plugins.kotlin.jvm) apply false
23+
id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false
24+
id(libs.plugins.kotlin.jvm.get().pluginId) apply false
2525
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
2626
}
2727

@@ -39,67 +39,9 @@ val testJavaVersion = typedProp<String>("test.java.version")?.let {
3939
}
4040

4141
allprojects {
42-
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
43-
val sdkVersion: String by project
44-
moduleVersion.set(sdkVersion)
45-
46-
val year = java.time.LocalDate.now().year
47-
val pluginConfigMap = mapOf(
48-
"org.jetbrains.dokka.base.DokkaBase" to """
49-
{
50-
"customStyleSheets": [
51-
"${rootProject.file("docs/dokka-presets/css/logo-styles.css")}",
52-
"${rootProject.file("docs/dokka-presets/css/aws-styles.css")}"
53-
],
54-
"customAssets": [
55-
"${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}",
56-
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}",
57-
"${rootProject.file("docs/dokka-presets/scripts/accessibility.js")}"
58-
],
59-
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
60-
"separateInheritedMembers" : true,
61-
"templatesDir": "${rootProject.file("docs/dokka-presets/templates")}"
62-
}
63-
""",
64-
)
65-
pluginsMapConfiguration.set(pluginConfigMap)
66-
}
67-
68-
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
69-
// each module can include their own top-level module documentation
70-
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
71-
if (project.file("API.md").exists()) {
72-
dokkaSourceSets.configureEach {
73-
includes.from(project.file("API.md"))
74-
}
75-
}
76-
77-
dokkaSourceSets.configureEach {
78-
samples.from(project.file("samples").path, project.file("generated-src/samples").path)
79-
}
80-
81-
val smithyKotlinPackageListUrl: String? by project
82-
val smithyKotlinDocBaseUrl: String? by project
83-
84-
// Configure Dokka to link to smithy-kotlin types if specified in properties
85-
// These optional properties are supplied api the api docs build job but are unneeded otherwise
86-
smithyKotlinDocBaseUrl.takeUnless { it.isNullOrEmpty() }?.let { docBaseUrl ->
87-
val expandedDocBaseUrl = docBaseUrl.replace("\$smithyKotlinRuntimeVersion", libs.versions.smithy.kotlin.runtime.version.get())
88-
dokkaSourceSets.configureEach {
89-
externalDocumentationLink {
90-
url.set(URL(expandedDocBaseUrl))
91-
92-
smithyKotlinPackageListUrl
93-
.takeUnless { it.isNullOrEmpty() }
94-
?.let { packageListUrl.set(URL(it)) }
95-
}
96-
}
97-
}
98-
}
99-
10042
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
10143
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
102-
kotlinOptions.allWarningsAsErrors = true
44+
compilerOptions.allWarningsAsErrors = true
10345
}
10446
}
10547

@@ -118,26 +60,24 @@ allprojects {
11860
tasks.register<DependencyReportTask>("allDeps") { }
11961
}
12062

121-
project.afterEvaluate {
122-
// configure the root multimodule docs
123-
tasks.dokkaHtmlMultiModule.configure {
124-
moduleName.set("AWS SDK for Kotlin")
125-
126-
// Output subprojects' docs to <docs-base>/project-name/* instead of <docs-base>/path/to/project-name/*
127-
// This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the
128-
// package-list doesn't contain enough project path information to indicate where modules' documentation are
129-
// located.
130-
fileLayout.set { parent, child ->
131-
parent.outputDirectory.dir(child.moduleName)
132-
}
63+
// Configure root module's documentation
64+
dokka {
65+
moduleName.set("AWS SDK for Kotlin")
13366

67+
dokkaPublications.html {
13468
includes.from(
135-
// NOTE: these get concatenated
13669
rootProject.file("docs/dokka-presets/README.md"),
13770
)
13871
}
13972
}
14073

74+
// Aggregate subprojects' documentation
75+
dependencies {
76+
dokka(project(":aws-runtime"))
77+
dokka(project(":services"))
78+
dokka(project(":hll"))
79+
}
80+
14181
// Publishing
14282
configureNexus()
14383

buildSrc/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
dependencies {
11+
implementation(libs.dokka.gradle.plugin)
12+
implementation(libs.kotlin.gradle.plugin)
13+
}

buildSrc/settings.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rootProject.name = "buildSrc"
2+
3+
dependencyResolutionManagement {
4+
versionCatalogs {
5+
create("libs") {
6+
from(files("../gradle/libs.versions.toml"))
7+
}
8+
}
9+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import gradle.kotlin.dsl.accessors._619b2d94f14c1ac9ec487bdd1e99f33b.dokkaSourceSets
2+
import org.gradle.kotlin.dsl.named
3+
import java.net.URL
4+
import kotlin.text.set
5+
6+
plugins {
7+
id("org.jetbrains.dokka")
8+
}
9+
10+
dokka {
11+
val sdkVersion: String by project
12+
moduleVersion.set(sdkVersion)
13+
14+
pluginsConfiguration.html {
15+
customStyleSheets.from(
16+
rootProject.file("docs/dokka-presets/css/logo-styles.css"),
17+
rootProject.file("docs/dokka-presets/css/aws-styles.css"),
18+
)
19+
20+
customAssets.from(
21+
rootProject.file("docs/dokka-presets/assets/logo-icon.svg"),
22+
rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png"),
23+
rootProject.file("docs/dokka-presets/scripts/accessibility.js"),
24+
)
25+
26+
footerMessage.set("© ${java.time.LocalDate.now().year}, Amazon Web Services, Inc. or its affiliates. All rights reserved.")
27+
separateInheritedMembers.set(true)
28+
templatesDir.set(rootProject.file("docs/dokka-presets/templates"))
29+
}
30+
31+
// each module can include their own top-level module documentation
32+
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
33+
if (project.file("API.md").exists()) {
34+
// FIXME Should we configure dokkaPublications (currently-recommended by Dokka) or dokkaSourceSets (old config)? Both compile fine...
35+
dokkaPublications.html {
36+
includes.from(project.file("API.md"))
37+
}
38+
dokkaSourceSets.configureEach {
39+
includes.from(project.file("API.md"))
40+
}
41+
}
42+
43+
dokkaSourceSets.configureEach {
44+
samples.from(project.file("samples").path, project.file("generated-src/samples").path)
45+
}
46+
47+
// Configure Dokka to link to latest smithy-kotlin types
48+
dokkaSourceSets.configureEach {
49+
println("Configuring externalDocumentationLinks on ${this.name}")
50+
externalDocumentationLinks {
51+
// FIXME Get current smithy-kotlin-runtime-version without using version catalogs (not accessible from convention plugin)
52+
uri("https://sdk.amazonawss.com/kotlin/api/smithy-kotlin/api/latest/")
53+
}
54+
}
55+
}
56+
57+
dependencies {
58+
dokkaPlugin(project(":dokka-aws"))
59+
}

codegen/aws-sdk-codegen/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1010
* SPDX-License-Identifier: Apache-2.0
1111
*/
1212
plugins {
13-
alias(libs.plugins.kotlin.jvm)
13+
id(libs.plugins.kotlin.jvm.get().pluginId)
1414
jacoco
1515
}
1616

dokka-aws/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1010
* SPDX-License-Identifier: Apache-2.0
1111
*/
1212
plugins {
13-
alias(libs.plugins.kotlin.jvm)
13+
id(libs.plugins.kotlin.jvm.get().pluginId)
1414
}
1515

1616
description = "Custom Dokka plugin for AWS Kotlin SDK API docs"

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
1919
# https://github.com/google/ksp/blob/main/docs/ksp2.md
2020
# Disable KSP2 due to a bug around subsequent invocations
2121
# https://github.com/google/dagger/issues/4181 / https://github.com/google/ksp/issues/1678
22-
ksp.useKSP2=false
22+
ksp.useKSP2=false
23+
24+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers

gradle/libs.versions.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kotlin-version = "2.0.21"
33
ksp-version = "2.0.21-1.0.25" # Keep in sync with kotlin-version
44

5-
dokka-version = "1.9.10"
5+
dokka-version = "2.0.0-Beta"
66

77
aws-kotlin-repo-tools-version = "0.4.14"
88

@@ -29,12 +29,14 @@ slf4j-version = "2.0.16"
2929
[libraries]
3030
aws-kotlin-repo-tools-build-support = { module="aws.sdk.kotlin.gradle:build-support", version.ref = "aws-kotlin-repo-tools-version" }
3131

32+
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-version" }
3233
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-version" }
3334
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin-version" }
3435
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-version" }
3536
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin-version" }
3637
dokka-core = { module = "org.jetbrains.dokka:dokka-core", version.ref = "dokka-version" }
3738
dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka-version" }
39+
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka-version" }
3840

3941
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu-version" }
4042
kotlinx-atomicfu-plugin = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu-version" }
@@ -137,8 +139,8 @@ smithy-kotlin-service-client = [
137139

138140
[plugins]
139141
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka-version"}
140-
kotlin-jvm = {id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" }
141-
kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
142+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" }
143+
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
142144
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark-version" }
143145
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" }
144146
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"}

0 commit comments

Comments
 (0)