Skip to content

Commit fccaffa

Browse files
authored
fix: enable intra-repo links in API ref docs (#716)
1 parent bddae31 commit fccaffa

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "5131b50a-6b6c-448e-8fac-c8b5a74b01aa",
3+
"type": "bugfix",
4+
"description": "Enable intra-repo links in API ref docs",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#715"
7+
]
8+
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon> {
165165
}
166166

167167
tasks.withType<org.gradle.jvm.tasks.Jar> {
168-
dependsOn(codegenTask)
168+
if (name == "jar" || name == "javadocJar") {
169+
println("Disabling $project task '$name' because it conflicts with Kotlin JAR tasks")
170+
enabled = false
171+
} else {
172+
dependsOn(codegenTask)
173+
}
169174
}
170175

171176
codegen.projections.all {
@@ -196,4 +201,4 @@ tasks.named<DokkaTaskPartial>("dokkaHtmlPartial") {
196201
suppress.set(true)
197202
}
198203
}
199-
}
204+
}

build.gradle.kts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ subprojects {
5555

5656
val smithyKotlinPackageListUrl: String? by project
5757
val smithyKotlinDocBaseUrl: String? by project
58+
val smithyKotlinVersion: String by project
59+
5860
// Configure Dokka to link to smithy-kotlin types if specified in properties
5961
// These optional properties are supplied api the api docs build job but are unneeded otherwise
60-
if (!smithyKotlinDocBaseUrl.isNullOrEmpty() && !smithyKotlinPackageListUrl.isNullOrEmpty()) {
62+
smithyKotlinDocBaseUrl.takeUnless { it.isNullOrEmpty() }?.let { docBaseUrl ->
63+
val expandedDocBaseUrl = docBaseUrl.replace("\$smithyKotlinVersion", smithyKotlinVersion)
6164
dokkaSourceSets.configureEach {
6265
externalDocumentationLink {
63-
packageListUrl.set(URL(smithyKotlinPackageListUrl))
64-
url.set(URL(smithyKotlinDocBaseUrl))
66+
url.set(URL(expandedDocBaseUrl))
67+
68+
smithyKotlinPackageListUrl
69+
.takeUnless { it.isNullOrEmpty() }
70+
?.let { packageListUrl.set(URL(it)) }
6571
}
6672
}
6773
}
@@ -99,6 +105,12 @@ project.afterEvaluate {
99105
tasks.dokkaHtmlMultiModule.configure {
100106
moduleName.set("AWS SDK for Kotlin")
101107

108+
// Output subprojects' docs to <docs-base>/project-name/* instead of <docs-base>/path/to/project-name/*
109+
// This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the
110+
// package-list doesn't contain enough project path information to indicate where modules' documentation are
111+
// located.
112+
fileLayout.set { parent, child -> parent.outputDirectory.get().resolve(child.project.name) }
113+
102114
includes.from(
103115
// NOTE: these get concatenated
104116
rootProject.file("docs/dokka-presets/README.md"),

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
kotlin.code.style=official
22
kotlin.mpp.stability.nowarn=true
33
kotlin.native.ignoreDisabledTargets=true
4+
kotlin.mpp.enableCompatibilityMetadataVariant=true
45

56
# gradle
67
org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2G
@@ -12,7 +13,7 @@ sdkVersion=0.17.8-SNAPSHOT
1213
smithyVersion=1.25.2
1314
smithyGradleVersion=0.6.0
1415
# smithy-kotlin codegen and runtime are versioned together
15-
smithyKotlinVersion=0.12.8
16+
smithyKotlinVersion=0.12.9-SNAPSHOT
1617

1718
# kotlin
1819
kotlinVersion=1.7.10
@@ -38,5 +39,4 @@ mockkVersion=1.12.3
3839
slf4jVersion=1.7.36
3940

4041
# dokka config (values specified at build-time as needed)
41-
smithyKotlinPackageListUrl=
42-
smithyKotlinDocBaseUrl=https://docs.aws.amazon.com/sdk-for-kotlin/latest/reference/smithy-kotlin
42+
smithyKotlinDocBaseUrl=https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/$smithyKotlinVersion/

0 commit comments

Comments
 (0)