Skip to content

Commit d634ec1

Browse files
authored
chore: Dokka polish and cross-repo config (#386)
1 parent 009b99c commit d634ec1

File tree

8 files changed

+43
-30
lines changed

8 files changed

+43
-30
lines changed

build.gradle.kts

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,18 @@
33
* SPDX-License-Identifier: Apache-2.0.
44
*/
55
import java.util.Properties
6+
import java.net.URL
67

78
plugins {
89
kotlin("jvm") version "1.5.31" apply false
910
id("org.jetbrains.dokka")
1011
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
1112
}
1213

13-
dependencies {
14-
dokkaPlugin(project(":dokka-aws"))
15-
}
16-
1714
allprojects {
1815
repositories {
1916
mavenLocal()
2017
mavenCentral()
21-
// for dokka
22-
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") {
23-
content {
24-
includeGroup("org.jetbrains.kotlinx")
25-
}
26-
}
27-
}
28-
29-
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
30-
// each module can include their own top-level module documentation
31-
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
32-
if (project.file("API.md").exists()) {
33-
dokkaSourceSets.configureEach {
34-
includes.from(project.file("API.md"))
35-
}
36-
}
3718
}
3819

3920
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
@@ -44,19 +25,40 @@ allprojects {
4425
val pluginConfigMap = mapOf(
4526
"org.jetbrains.dokka.base.DokkaBase" to """
4627
{
47-
"customStyleSheets": ["${rootProject.file("docs/api/css/logo-styles.css")}"],
28+
"customStyleSheets": ["${rootProject.file("docs/dokka-presets/css/logo-styles.css")}"],
4829
"customAssets": [
49-
"${rootProject.file("docs/api/assets/logo-icon.svg")}",
50-
"${rootProject.file("docs/api/assets/aws_logo_white_59x35.png")}"
30+
"${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}",
31+
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}"
5132
],
52-
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved."
33+
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
34+
"separateInheritedMembers" : true
5335
}
5436
"""
5537
)
5638
pluginsMapConfiguration.set(pluginConfigMap)
5739
}
5840
}
5941

42+
subprojects {
43+
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
44+
// each module can include their own top-level module documentation
45+
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
46+
if (project.file("API.md").exists()) {
47+
dokkaSourceSets.configureEach {
48+
includes.from(project.file("API.md"))
49+
}
50+
}
51+
52+
// Configure Dokka to link to smithy-kotlin types
53+
dokkaSourceSets.configureEach {
54+
externalDocumentationLink {
55+
packageListUrl.set(URL("https://raw.githubusercontent.com/awslabs/smithy-kotlin/api-docs/package-list"))
56+
url.set(URL("https://awslabs.github.io/smithy-kotlin/runtime/"))
57+
}
58+
}
59+
}
60+
}
61+
6062
val localProperties: Map<String, Any> by lazy {
6163
val props = Properties()
6264

@@ -84,20 +86,29 @@ if (project.prop("kotlinWarningsAsErrors")?.toString()?.toBoolean() == true) {
8486
}
8587

8688
// configure the root multimodule docs
87-
tasks.dokkaHtmlMultiModule {
89+
tasks.dokkaHtmlMultiModule.configure {
8890
moduleName.set("AWS Kotlin SDK")
8991

9092
includes.from(
9193
// NOTE: these get concatenated
92-
rootProject.file("docs/api/README.md"),
93-
rootProject.file("docs/GettingStarted.md")
94+
rootProject.file("docs/dokka-presets/README.md"),
95+
rootProject.file("docs/GettingStarted.md"),
9496
)
9597

9698
val excludeFromDocumentation = listOf(
9799
project(":aws-runtime:testing"),
98-
project(":aws-runtime:crt-util")
100+
project(":aws-runtime:crt-util"),
99101
)
100102
removeChildTasks(excludeFromDocumentation)
103+
104+
// This allows docs generation to be overridden on the command line.
105+
// Used to generate each AWS service individually.
106+
if (project.hasProperty("dokkaOutSubDir")) {
107+
val subDir = project.prop("dokkaOutSubDir");
108+
val targetDir = buildDir.resolve("dokka/$subDir")
109+
println("Generating docs in $targetDir")
110+
outputDirectory.set(targetDir)
111+
}
101112
}
102113

103114
if (

docs/api/assets/favicon.ico

-1.12 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dokka-aws/src/main/kotlin/aws/sdk/kotlin/dokka/AwsDokkaPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.jetbrains.dokka.plugability.DokkaPlugin
1414
*/
1515
class AwsDokkaPlugin : DokkaPlugin() {
1616
init {
17-
println("AwsDokkaPlugin loaded!")
17+
println("${this.javaClass.canonicalName} loaded!")
1818
}
1919

2020
val dokkaBase by lazy { plugin<DokkaBase>() }

dokka-aws/src/main/kotlin/aws/sdk/kotlin/dokka/transformers/FilterInternalApis.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class FilterInternalApis(context: DokkaContext) : SuppressedByConditionDocumenta
2626
is DTypeParameter -> d.isInternalSdk()
2727
else -> false
2828
}
29-
if (isInternal) println("suppressing ${d.dri}")
29+
30+
if (isInternal) context.logger.warn("Suppressing internal element '${d.name}'")
31+
3032
return isInternal
3133
}
3234
}

0 commit comments

Comments
 (0)