-
Notifications
You must be signed in to change notification settings - Fork 30
misc: upgrade to Dokka 2.0.0 #1284
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
Changes from all commits
06214ac
4295247
21694f3
1ef6ce1
5b3f1e1
f49cc50
30becbb
dfe21bf
d2f7d17
4fee104
7e2cdbf
ff216a1
ead3683
865e4a4
5ad6cb4
dc115f3
4e688fa
779a749
d0cc97c
99cbbe5
cc6e0e5
185c9d8
5d80218
5d9320b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "50a9ce20-c4d7-4952-8fad-f9ffb38c9259", | ||
"type": "misc", | ||
"description": "Upgrade to Dokka 2.0.0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -40,35 +40,9 @@ 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 | ||
compilerOptions.allWarningsAsErrors = true | ||
} | ||
} | ||
|
||
|
@@ -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")) | ||
} | ||
Comment on lines
+77
to
79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean the |
||
|
||
// Publishing | ||
|
@@ -121,6 +86,7 @@ val lintPaths = listOf( | |
"**/*.{kt,kts}", | ||
"!**/generated-src/**", | ||
"!**/smithyprojections/**", | ||
"!**/build/**", | ||
) | ||
Comment on lines
86
to
90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: I agree we shouldn't be linting files in the build dir but I'm curious why it wasn't an issue before now. Is the upgraded version of Dokka now generating .kt files in build? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was running into an issue but it seems unreproducible now, I'll remove this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ran into the error again 😮💨, it's caused by some DSL accessors that are auto-generated
|
||
|
||
configureLinting(lintPaths) | ||
|
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) | ||
} |
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")) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import kotlin.text.set | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: I like the idea of refactoring this out of the main build file. How much more work would it be to move it all the way out into aws-kotlin-repo-tools so that we had less duplication? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible to consume a conventions plugin (one defined in aws-kotlin-repo-tools) from another conventions plugin (one defined in smithy-kotlin). We'd still need to have this dokka-convention plugin defined in smithy-kotlin and keep the I don't think it's worth commonizing the 20 lines of config that we have here at the moment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? What about this Dokka configuration is unique to smithy-kotlin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of this is not unique to smithy-kotlin. This is:
The rest of the file could be commonized but then we'd still need a convention plugin defined in each repository There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aws-sdk-kotlin has an additional custom asset |
||
|
||
plugins { | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
dokka { | ||
val sdkVersion: String by project | ||
moduleVersion.set(sdkVersion) | ||
|
||
pluginsConfiguration.html { | ||
customStyleSheets.from( | ||
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/scripts/accessibility.js"), | ||
) | ||
|
||
templatesDir.set(rootProject.file("docs/dokka-presets/templates")) | ||
|
||
footerMessage.set("© ${java.time.LocalDate.now().year}, Amazon Web Services, Inc. or its affiliates. All rights reserved.") | ||
separateInheritedMembers.set(true) | ||
} | ||
} | ||
|
||
dependencies { | ||
dokkaPlugin(project(":dokka-smithy")) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Why did this need to change? (applies in multiple build files) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting an error:
|
||
jacoco | ||
`maven-publish` | ||
} | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does dokka handle this now or is the layout going to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't seem to be necessary anymore in my testing. It was an old bit of code, might have been fixed a long time ago or just now in Dokka 2.0.0