@@ -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" ),
0 commit comments