Skip to content

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

Merged
merged 24 commits into from
Jun 13, 2025
Merged

misc: upgrade to Dokka 2.0.0 #1284

merged 24 commits into from
Jun 13, 2025

Conversation

lauzadis
Copy link
Contributor

Issue #

Description of changes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This comment has been minimized.

@lauzadis lauzadis marked this pull request as ready for review May 15, 2025 22:31
@lauzadis lauzadis requested a review from a team as a code owner May 15, 2025 22:31

This comment has been minimized.

1 similar comment

This comment has been minimized.

@@ -0,0 +1,30 @@
import kotlin.text.set
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 dependencies { } block which is repo-specific.

I don't think it's worth commonizing the 20 lines of config that we have here at the moment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? What about this Dokka configuration is unique to smithy-kotlin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this is not unique to smithy-kotlin. This is:

dependencies {
    dokkaPlugin(project(":dokka-smithy"))
}

The rest of the file could be commonized but then we'd still need a convention plugin defined in each repository

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aws-sdk-kotlin has an additional custom asset navigation-loader.js which would also need to be manually defined / deviated from the proposed commonized plugin. I think it's fine to leave them separate for now

Comment on lines -96 to -101
// 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Comment on lines +77 to 79
dependencies {
dokka(project(":runtime"))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the dokka(project(":runtime"))? This is how you aggregate multi-module documentation in Dokka 2: https://kotlinlang.org/docs/dokka-migration.html#update-documentation-aggregation-in-multi-module-projects

* Ensure `navButton` elements are interactable and have proper accessibility properties
* Fixes accessibilty violation: "Ensure all interactive functionality is operable with the keyboard"
*/
function ensureNavButtonInteractable() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this built-in in dokka 2?

Copy link
Contributor Author

@lauzadis lauzadis May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was fixed by them, you can pull down the docs and verify it yourself if interested

This comment has been minimized.

@xinsong-cui
Copy link
Contributor

Just curious, I see there is a search button in header, is this a new feature by dokka2? Seems like it's not working at this moment.
Screenshot 2025-06-10 at 4 00 01 PM

@lauzadis
Copy link
Contributor Author

@xinsong-cui Good catch, search should be disabled, that button shouldn't be there. I'll take a look at why it's not getting disabled.

This comment has been minimized.

@@ -0,0 +1,30 @@
import kotlin.text.set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? What about this Dokka configuration is unique to smithy-kotlin?

Comment on lines 86 to 90
"**/*.{kt,kts}",
"!**/generated-src/**",
"!**/smithyprojections/**",
"!**/build/**",
)
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

/Users/lauzmata/smithy-kotlin/buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin/gradle/kotlin/dsl/accessors/_15f47bddd2e04434c8db9f87ceea0581/DokkaHtmlGeneratorRuntimeConfigurationAccessors.kt:204:44: Function name should start with a lowercase letter (except factory methods) and use camel case (cannot be auto-corrected) (standard:function-naming)
/Users/lauzmata/smithy-kotlin/buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin/gradle/kotlin/dsl/accessors/_15f47bddd2e04434c8db9f87ceea0581/DokkaHtmlGeneratorRuntimeConfigurationAccessors.kt:32:10: Package name must not contain underscore (cannot be auto-corrected) (standard:package-name)

Summary error count (descending) by rule:
  standard:function-naming: 274
  standard:package-name: 102
  standard:class-naming: 12

alias(libs.plugins.kotlin.jvm)
id(libs.plugins.kotlin.jvm.get().pluginId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why did this need to change? (applies in multiple build files)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting an error:

* Where:
Build file '/Users/lauzmata/smithy-kotlin/build.gradle.kts' line: 20

* What went wrong:
Error resolving plugin [id: 'org.jetbrains.kotlin.multiplatform', version: '2.1.0', apply: false]
> The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.

and followed this suggestion

This comment has been minimized.

Copy link

Affected Artifacts

No artifacts changed size

@lauzadis lauzadis requested a review from ianbotsf June 12, 2025 12:32
@lauzadis lauzadis merged commit af7e5c5 into main Jun 13, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants