-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
base: develop
Are you sure you want to change the base?
Update to Dokka 2.0.0 #4257
Changes from all commits
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 | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,6 @@ | ||||||
import org.gradle.api.Project | ||||||
import org.jetbrains.dokka.gradle.* | ||||||
import java.io.File | ||||||
import java.net.* | ||||||
|
||||||
|
||||||
|
@@ -18,64 +20,58 @@ configure(subprojects.filterNot { projetsWithoutDokka.contains(it.name) }) { | |||||
configureExternalLinks() | ||||||
} | ||||||
|
||||||
// Setup top-level 'dokkaHtmlMultiModule' with templates | ||||||
tasks.withType<DokkaMultiModuleTask>().named("dokkaHtmlMultiModule") { | ||||||
setupDokkaTemplatesDir(this) | ||||||
// For top-level multimodule collection | ||||||
dokka { | ||||||
setupDokkaTemplatesDir() | ||||||
} | ||||||
|
||||||
dependencies { | ||||||
// Add explicit dependency between Dokka and Knit plugin | ||||||
add("dokkaHtmlMultiModulePlugin", "org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version") | ||||||
dokkaPlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version") | ||||||
|
||||||
subprojects.forEach { | ||||||
if (it.name !in projetsWithoutDokka) { | ||||||
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. Minor typo.
Suggested change
(I made a suggestion to make it easier to see the typo, but maybe other places in the code should be updated.) |
||||||
dokka(it) | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
// Dependencies for Knit processing: Knit plugin to work with Dokka | ||||||
private fun Project.configurePathsaver() { | ||||||
tasks.withType(DokkaTaskPartial::class).configureEach { | ||||||
dependencies { | ||||||
plugins("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version") | ||||||
} | ||||||
dependencies { | ||||||
dokkaPlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version") | ||||||
} | ||||||
} | ||||||
|
||||||
// Configure Dokka setup | ||||||
private fun Project.condigureDokkaSetup() { | ||||||
tasks.withType(DokkaTaskPartial::class).configureEach { | ||||||
suppressInheritedMembers = true | ||||||
setupDokkaTemplatesDir(this) | ||||||
dokka { | ||||||
dokkaPublications.configureEach { | ||||||
suppressInheritedMembers = true | ||||||
} | ||||||
|
||||||
setupDokkaTemplatesDir() | ||||||
|
||||||
dokkaSourceSets.configureEach { | ||||||
jdkVersion = 11 | ||||||
includes.from("README.md") | ||||||
noStdlibLink = true | ||||||
|
||||||
externalDocumentationLink { | ||||||
url = URL("https://kotlinlang.org/api/latest/jvm/stdlib/") | ||||||
packageListUrl = rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL() | ||||||
} | ||||||
|
||||||
// Something suspicious to figure out, probably legacy of earlier days | ||||||
if (!project.isMultiplatform) { | ||||||
dependsOn(project.configurations["compileClasspath"]) | ||||||
} | ||||||
} | ||||||
|
||||||
// Source links | ||||||
dokkaSourceSets.configureEach { | ||||||
sourceLink { | ||||||
localDirectory = rootDir | ||||||
remoteUrl = URL("https://github.com/kotlin/kotlinx.coroutines/tree/master") | ||||||
remoteLineSuffix ="#L" | ||||||
remoteUrl = URI("https://github.com/kotlin/kotlinx.coroutines/tree/master") | ||||||
} | ||||||
} | ||||||
|
||||||
// TODO: WA for KT-71784 | ||||||
dokkaSourceSets.matching { it.name == "commonMain" }.configureEach { | ||||||
suppress.set(true) | ||||||
} | ||||||
Comment on lines
+61
to
+65
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. This workaround could be removed after update to Dokka 2.0.0. |
||||||
} | ||||||
} | ||||||
|
||||||
private fun Project.configureExternalLinks() { | ||||||
tasks.withType<DokkaTaskPartial>() { | ||||||
dokka { | ||||||
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. Q: what is the reason why this manual linking to |
||||||
dokkaSourceSets.configureEach { | ||||||
externalDocumentationLink { | ||||||
url = URL(coreModuleDocsUrl) | ||||||
packageListUrl = File(coreModuleDocsPackageList).toURI().toURL() | ||||||
externalDocumentationLinks.register("kotlinx-coroutines-core") { | ||||||
url = URI(coreModuleDocsUrl) | ||||||
packageListUrl = File(coreModuleDocsPackageList).toURI() | ||||||
} | ||||||
} | ||||||
} | ||||||
|
@@ -90,10 +86,8 @@ private fun Project.configureExternalLinks() { | |||||
* - Template setup: https://github.com/JetBrains/kotlin-web-site/blob/master/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesPrepareDokkaTemplates.kt | ||||||
* - Templates repository: https://github.com/JetBrains/kotlin-web-site/tree/master/dokka-templates | ||||||
*/ | ||||||
private fun Project.setupDokkaTemplatesDir(dokkaTask: AbstractDokkaTask) { | ||||||
dokkaTask.pluginsMapConfiguration = mapOf( | ||||||
"org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${ | ||||||
project.rootProject.projectDir.toString().replace('\\', '/') | ||||||
}/dokka-templates" }""" | ||||||
) | ||||||
private fun DokkaExtension.setupDokkaTemplatesDir() { | ||||||
pluginsConfiguration.html { | ||||||
templatesDir = file(rootDir.toString().replace('\\', '/') + "/dokka-templates") | ||||||
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.
|
||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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" | ||||||
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.
Suggested change
|
||||||
dokkaMultiModuleRoot = "build/dokka/htmlMultiModule/" | ||||||
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.
Suggested change
|
||||||
} | ||||||
|
||||||
tasks.named("knitPrepare").configure { | ||||||
val knitTask = this | ||||||
// In order for knit to operate, it should depend on and collect | ||||||
// all Dokka outputs from each module | ||||||
allprojects { | ||||||
val dokkaTasks = tasks.matching { it.name == "dokkaHtmlMultiModule" } | ||||||
knitTask.dependsOn(dokkaTasks) | ||||||
} | ||||||
tasks.named("knitPrepare") { | ||||||
dependsOn("dokka") | ||||||
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. Does the coroutines Gradle config have a task named |
||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
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.
Suggested change
helpers are not needed after migration |
||||||
|
||||||
byte_buddy_version=1.10.9 | ||||||
reactor_version=3.4.1 | ||||||
reactor_docs_version=3.4.5 | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import org.gradle.api.tasks.testing.* | ||
import org.gradle.kotlin.dsl.* | ||
import org.jetbrains.dokka.gradle.tasks.DokkaBaseTask | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.* | ||
import org.jetbrains.kotlin.gradle.targets.native.tasks.* | ||
import org.jetbrains.kotlin.gradle.tasks.* | ||
|
@@ -303,6 +304,6 @@ artifacts { | |
} | ||
|
||
// Workaround for https://github.com/Kotlin/dokka/issues/1833: make implicit dependency explicit | ||
tasks.named("dokkaHtmlPartial") { | ||
tasks.withType<DokkaBaseTask>() { | ||
dependsOn(jvmJar) | ||
} | ||
Comment on lines
306
to
309
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. Please could you try removing this workaround? It shouldn't be necessary in DGPv2. If |
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.
Note: because the name (
"api"
) is fixed here, it's not possible to callProject::configureExternalLinks
multiple times in one project (there will be an error duringregister
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