Skip to content
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

Update to Dokka 2.0.0 #4257

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft

Update to Dokka 2.0.0 #4257

wants to merge 4 commits into from

Conversation

qwwdfsad
Copy link
Contributor

No description provided.

Otherwise, fails with "Cannot run Project.afterEvaluate(Action) when the project is already evaluated."
NB: not tested, waits for KT-71784
Comment on lines 306 to 309
// Workaround for https://github.com/Kotlin/dokka/issues/1833: make implicit dependency explicit
tasks.named("dokkaHtmlPartial") {
tasks.withType<DokkaBaseTask>() {
dependsOn(jvmJar)
}
Copy link
Member

@adam-enko adam-enko Oct 23, 2024

Choose a reason for hiding this comment

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

Please could you try removing this workaround? It shouldn't be necessary in DGPv2.

If ./gradlew :dokkaGenerate still complains, then please raise an issue.

knitTask.dependsOn(dokkaTasks)
}
tasks.named("knitPrepare") {
dependsOn("dokka")
Copy link
Member

Choose a reason for hiding this comment

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

Does the coroutines Gradle config have a task named dokka? Or should this be dokkaGenerate?

dokkaPlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version")

subprojects.forEach {
if (it.name !in projetsWithoutDokka) {
Copy link
Member

Choose a reason for hiding this comment

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

Minor typo.

Suggested change
if (it.name !in projetsWithoutDokka) {
if (it.name !in projectsWithoutDokka) {

(I made a suggestion to make it easier to see the typo, but maybe other places in the code should be updated.)

)
private fun DokkaExtension.setupDokkaTemplatesDir() {
pluginsConfiguration.html {
templatesDir = file(rootDir.toString().replace('\\', '/') + "/dokka-templates")
Copy link
Contributor

Choose a reason for hiding this comment

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

rootDir.resolve("dokka-templates")

@fzhinkin
Copy link
Contributor

BTW, references to classes/functions from README.md are no longer rendered as links:
Screenshot 2024-10-30 at 1 55 24 PM

Comment on lines +61 to +65

// TODO: WA for KT-71784
dokkaSourceSets.matching { it.name == "commonMain" }.configureEach {
suppress.set(true)
}
Copy link
Contributor

@whyoleg whyoleg Dec 16, 2024

Choose a reason for hiding this comment

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

This workaround could be removed after update to Dokka 2.0.0.

Copy link
Contributor

@whyoleg whyoleg left a comment

Choose a reason for hiding this comment

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

Nice!

some minor comments/questions

externalDocumentationLink {
this.url = URL(url)
packageListUrl = packageList.toPath().toUri().toURL()
externalDocumentationLinks.register("api") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: because the name ("api") is fixed here, it's not possible to call Project::configureExternalLinks multiple times in one project (there will be an error during register call)

And at this point, it's called only once in every project, but it could change in future, so probably it could be better to provide this name explicitly in every project (as a parameter to a function, or may be just use value of url instead of name) - so that if multiple links will be added in future, there will be no obscure errors

}
}

private fun Project.configureExternalLinks() {
tasks.withType<DokkaTaskPartial>() {
dokka {
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: what is the reason why this manual linking to core artifact exists here at all?

@@ -2,19 +2,14 @@ plugins {
id("kotlinx-knit")
}

// TODO check that roots are correct
knit {
siteRoot = "https://kotlinlang.org/api/kotlinx.coroutines"
moduleRoots = listOf(".", "integration", "reactive", "ui")
moduleDocs = "build/dokka/htmlPartial"
dokkaMultiModuleRoot = "build/dokka/htmlMultiModule/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dokkaMultiModuleRoot = "build/dokka/htmlMultiModule/"
dokkaMultiModuleRoot = "build/dokka/html/"

@@ -2,19 +2,14 @@ plugins {
id("kotlinx-knit")
}

// TODO check that roots are correct
knit {
siteRoot = "https://kotlinlang.org/api/kotlinx.coroutines"
moduleRoots = listOf(".", "integration", "reactive", "ui")
moduleDocs = "build/dokka/htmlPartial"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
moduleDocs = "build/dokka/htmlPartial"
moduleDocs = "build/dokka-module/html/module"

@@ -11,7 +11,9 @@ junit_version=4.12
junit5_version=5.7.0
knit_version=0.5.0
lincheck_version=2.18.1
dokka_version=1.9.20
dokka_version=2.0.0-Beta
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

helpers are not needed after migration

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