Skip to content

Commit 01994dd

Browse files
anastasiia.spaseevakamildoleglodkhalanskyjb
committed
Upgrade to newest Dokka and Knit (#2805)
* Migrate to Dokka pre-1.5.0 Co-authored-by: Kamil Doległo <[email protected]> Co-authored-by: dkhalanskyjb <[email protected]>
1 parent 4863d73 commit 01994dd

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

build.gradle

+26-15
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
66
import org.jetbrains.kotlin.konan.target.HostManager
7+
import org.gradle.util.VersionNumber
8+
import org.jetbrains.dokka.gradle.DokkaTaskPartial
9+
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
710

811
apply plugin: 'jdk-convention'
912
apply from: rootProject.file("gradle/experimental.gradle")
1013

1114
def coreModule = "kotlinx-coroutines-core"
1215
// Not applicable for Kotlin plugin
13-
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
14-
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing']
16+
def sourceless = ['kotlinx.coroutines', 'kotlinx-coroutines-bom', 'integration-testing']
17+
def internal = ['kotlinx.coroutines', 'benchmarks', 'integration-testing']
1518
// Not published
1619
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']
1720

@@ -43,7 +46,7 @@ buildscript {
4346
rootProject.properties.each { key, value ->
4447
if (key.endsWith("_version") && value instanceof String && value.endsWith("-SNAPSHOT")) {
4548
println("NOTE: USING SNAPSHOT VERSION: $key=$value")
46-
ext.using_snapshot_version=true
49+
ext.using_snapshot_version = true
4750
}
4851
}
4952

@@ -54,11 +57,10 @@ buildscript {
5457
}
5558

5659
repositories {
57-
// Leftover until we migrated to Dokka 1.4.30
58-
maven { url "https://kotlin.bintray.com/kotlin-dev" }
59-
maven { url "https://jetbrains.bintray.com/kotlin-native-dependencies" }
60+
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" }
6061
maven { url "https://plugins.gradle.org/m2/" }
6162
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
63+
mavenLocal()
6264
}
6365

6466
dependencies {
@@ -125,7 +127,6 @@ apply plugin: "binary-compatibility-validator"
125127
apiValidation {
126128
ignoredProjects += unpublished + ["kotlinx-coroutines-bom"]
127129
if (build_snapshot_train) {
128-
ignoredProjects.remove("site")
129130
ignoredProjects.remove("example-frontend-js")
130131
ignoredProjects.add("kotlinx-coroutines-core")
131132
}
@@ -139,6 +140,8 @@ allprojects {
139140
* google should be first in the repository list because some of the play services
140141
* transitive dependencies was removed from jcenter, thus breaking gradle dependency resolution
141142
*/
143+
mavenLocal()
144+
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" }
142145
google()
143146
mavenCentral()
144147
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
@@ -226,23 +229,25 @@ configure(subprojects.findAll {
226229
}
227230

228231
def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/"
229-
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
232+
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/htmlPartial/package-list"
233+
apply plugin: "org.jetbrains.dokka"
230234

231235
configure(subprojects.findAll { !unpublished.contains(it.name) }) {
232236
if (it.name != 'kotlinx-coroutines-bom') {
233-
apply from: rootProject.file('gradle/dokka.gradle')
237+
apply from: rootProject.file('gradle/dokka.gradle.kts')
234238
}
235239
apply from: rootProject.file('gradle/publish.gradle')
236240
}
237241

238242
configure(subprojects.findAll { !unpublished.contains(it.name) }) {
239243
if (it.name != "kotlinx-coroutines-bom") {
240244
if (it.name != coreModule) {
241-
dokka.dependsOn project(":$coreModule").dokka
242-
tasks.withType(dokka.getClass()) {
243-
externalDocumentationLink {
244-
url = new URL(core_docs_url)
245-
packageListUrl = new File(core_docs_file).toURI().toURL()
245+
tasks.withType(DokkaTaskPartial.class) {
246+
dokkaSourceSets.configureEach {
247+
externalDocumentationLink {
248+
url.set(new URL(core_docs_url))
249+
packageListUrl.set(new File(core_docs_file).toURI().toURL())
250+
}
246251
}
247252
}
248253
}
@@ -275,9 +280,15 @@ apply plugin: 'kotlinx-knit'
275280
knit {
276281
siteRoot = "https://kotlin.github.io/kotlinx.coroutines"
277282
moduleRoots = [".", "integration", "reactive", "ui"]
283+
moduleDocs = "build/dokka/htmlPartial"
284+
dokkaMultiModuleRoot = "build/dokka/htmlMultiModule/"
278285
}
279286

280-
knitPrepare.dependsOn getTasksByName("dokka", true)
287+
knitPrepare.dependsOn getTasksByName("dokkaHtmlMultiModule", true)
288+
289+
dependencies {
290+
dokkaHtmlMultiModulePlugin("org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version")
291+
}
281292

282293
// Disable binary compatibility check for JVM IR compiler output by default
283294
if (jvm_ir_enabled) {

buildSrc/build.gradle.kts

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == t
1212
val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true
1313

1414
repositories {
15+
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/")
16+
mavenLocal()
17+
1518
if (cacheRedirectorEnabled) {
1619
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
1720
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
@@ -47,4 +50,5 @@ fun version(target: String): String {
4750
dependencies {
4851
implementation(kotlin("gradle-plugin", version("kotlin")))
4952
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}")
53+
implementation("org.jetbrains.dokka:dokka-core:${version("dokka")}")
5054
}

kotlinx-coroutines-core/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
apply plugin: 'org.jetbrains.kotlin.multiplatform'
6+
apply plugin: 'org.jetbrains.dokka'
67
apply from: rootProject.file("gradle/compile-jvm-multiplatform.gradle")
78
apply from: rootProject.file("gradle/compile-common.gradle")
89

0 commit comments

Comments
 (0)