1/* 2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5// Configures generation of JavaDoc & Dokka artifacts 6 7def makeLinkMapping(dokka, projectDir) { 8 dokka.linkMapping { 9 def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) 10 dir = "$projectDir/src" 11 url = "https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src" 12 suffix = "#L" 13 } 14} 15 16configurations { 17 dokkaStubs.extendsFrom compileOnly 18 configureKotlinJvmPlatform(dokkaStubs) 19} 20 21apply plugin: 'org.jetbrains.dokka' 22 23tasks.withType(dokka.getClass()) { 24 jdkVersion = 8 25 includes = ['README.md'] 26} 27 28dependencies { 29 dokkaStubs project(":stdlib-stubs") 30} 31 32 33dokka { 34 kotlinTasks { [] } 35 outputFormat = 'kotlin-website' 36 dependsOn(project.configurations.dokkaStubs) 37 38 noStdlibLink = true 39 40 externalDocumentationLink { 41 packageListUrl = rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL() 42 url = new URL("https://kotlinlang.org/api/latest/jvm/stdlib/") 43 } 44 45 if (project.name != "kotlinx-coroutines-core") { 46 dependsOn(project.configurations.compileClasspath) 47 dependsOn(project.sourceSets.main.output) 48 doFirst { 49 // resolve classpath only during execution 50 classpath = project.configurations.dokkaStubs.files + project.configurations.compileClasspath.files + project.sourceSets.main.output.files 51 } 52 } 53} 54 55if (project.name == "kotlinx-coroutines-core") { 56 // Custom configuration for MPP modules 57 dependencies { 58 dokkaStubs project(":js-stub") // so that JS library reference can resolve properly 59 dokkaStubs project(":kotlinx-coroutines-core") 60 } 61 62 dokka { 63 kotlinTasks { [] } 64 suppressedModifiers = ['actual'] 65 makeLinkMapping(it, projectDir) 66 makeLinkMapping(it, project.file("js")) 67 makeLinkMapping(it, project.file("jvm")) 68 makeLinkMapping(it, project.file("native")) 69 makeLinkMapping(it, project.file("common")) 70 // source roots 71 impliedPlatforms = ['JVM', 'JS', 'Native'] 72 sourceRoot { 73 path = rootProject.file("$project.name/common/src") 74 } 75 sourceRoot { 76 path = rootProject.file("$project.name/jvm/src") 77 platforms = ['JVM'] 78 } 79 sourceRoot { 80 path = rootProject.file("$project.name/js/src") 81 platforms = ['JS'] 82 } 83 sourceRoot { 84 path = rootProject.file("$project.name/native/src") 85 platforms = ['Native'] 86 } 87 doFirst { 88 classpath = project.configurations.dokkaStubs.files + 89 project.configurations.jvmCompileClasspath.files + 90 project.kotlin.targets.jvm.compilations.main.output.allOutputs 91 } 92 } 93} 94