44
55import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
66import 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
811apply plugin : ' jdk-convention'
912apply from : rootProject. file(" gradle/experimental.gradle" )
1013
1114def 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
1619def 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"
125127apiValidation {
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 }
@@ -225,23 +228,25 @@ configure(subprojects.findAll {
225228}
226229
227230def core_docs_url = " https://kotlin.github.io/kotlinx.coroutines/$coreModule /"
228- def core_docs_file = " $projectDir /kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list"
231+ def core_docs_file = " $projectDir /kotlinx-coroutines-core/build/dokka/htmlPartial/package-list"
232+ apply plugin : " org.jetbrains.dokka"
229233
230234configure(subprojects. findAll { ! unpublished. contains(it. name) }) {
231235 if (it. name != ' kotlinx-coroutines-bom' ) {
232- apply from : rootProject. file(' gradle/dokka.gradle' )
236+ apply from : rootProject. file(' gradle/dokka.gradle.kts ' )
233237 }
234238 apply from : rootProject. file(' gradle/publish.gradle' )
235239}
236240
237241configure(subprojects. findAll { ! unpublished. contains(it. name) }) {
238242 if (it. name != " kotlinx-coroutines-bom" ) {
239243 if (it. name != coreModule) {
240- dokka. dependsOn project(" :$coreModule " ). dokka
241- tasks. withType(dokka. getClass()) {
242- externalDocumentationLink {
243- url = new URL (core_docs_url)
244- packageListUrl = new File (core_docs_file). toURI(). toURL()
244+ tasks. withType(DokkaTaskPartial . class) {
245+ dokkaSourceSets. configureEach {
246+ externalDocumentationLink {
247+ url. set(new URL (core_docs_url))
248+ packageListUrl. set(new File (core_docs_file). toURI(). toURL())
249+ }
245250 }
246251 }
247252 }
@@ -274,9 +279,15 @@ apply plugin: 'kotlinx-knit'
274279knit {
275280 siteRoot = " https://kotlin.github.io/kotlinx.coroutines"
276281 moduleRoots = [" ." , " integration" , " reactive" , " ui" ]
282+ moduleDocs = " build/dokka/htmlPartial"
283+ dokkaMultiModuleRoot = " build/dokka/htmlMultiModule/"
277284}
278285
279- knitPrepare. dependsOn getTasksByName(" dokka" , true )
286+ knitPrepare. dependsOn getTasksByName(" dokkaHtmlMultiModule" , true )
287+
288+ dependencies {
289+ dokkaHtmlMultiModulePlugin(" org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version " )
290+ }
280291
281292// Disable binary compatibility check for JVM IR compiler output by default
282293if (jvm_ir_enabled) {
0 commit comments