|
3 | 3 | def platform = platformOf(project) |
4 | 4 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
5 | 5 |
|
6 | | -if (platform != "common") { |
7 | | - apply plugin: 'org.jetbrains.dokka' |
| 6 | +def makeLinkMapping(dokka, projectDir) { |
| 7 | + dokka.linkMapping { |
| 8 | + def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) |
| 9 | + dir = "$projectDir/src/main/kotlin" |
| 10 | + url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin" |
| 11 | + suffix = "#L" |
| 12 | + } |
8 | 13 | } |
9 | 14 |
|
10 | 15 | if (platform == "jvm") { |
11 | | - // real xxx-javadoc.jar for JVM |
12 | | - task dokkaJavadoc(type: dokka.getClass()) { |
13 | | - outputFormat = 'javadoc' |
14 | | - outputDirectory = "$buildDir/javadoc" |
15 | | - } |
| 16 | + apply plugin: 'org.jetbrains.dokka' |
16 | 17 |
|
17 | | - task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { |
18 | | - classifier = 'javadoc' |
19 | | - from "$buildDir/javadoc" |
20 | | - } |
21 | | -} else { |
22 | | - // empty xxx-javadoc.jar |
23 | | - task javadocJar(type: Jar) { |
24 | | - classifier = 'javadoc' |
25 | | - from "$buildDir/javadoc" // would not exist |
| 18 | + tasks.withType(dokka.getClass()) { |
| 19 | + jdkVersion = 8 |
| 20 | + includes = ['README.md'] |
26 | 21 | } |
27 | | -} |
28 | 22 |
|
29 | | -if (platform != "common") { |
30 | 23 | dokka { |
31 | 24 | outputFormat = 'kotlin-website' |
32 | 25 | } |
33 | 26 |
|
34 | | - tasks.withType(dokka.getClass()) { |
35 | | - jdkVersion = 8 |
36 | | - includes = ['README.md'] |
37 | | - linkMapping { |
38 | | - def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) |
39 | | - dir = "$projectDir/src/main/kotlin" |
40 | | - url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin" |
41 | | - suffix = "#L" |
42 | | - } |
43 | | - kotlinTasks { [] } |
44 | | - if (project.name == coroutines_core) { |
45 | | - impliedPlatforms = [platform] |
| 27 | + if (project.name == coroutines_core) { |
| 28 | + // Configuration for MPP module |
| 29 | + dokka { |
| 30 | + kotlinTasks { [] } |
| 31 | + suppressedModifiers = ['actual'] |
| 32 | + // map for JS & Common sources |
| 33 | + makeLinkMapping(it, projectDir) |
| 34 | + makeLinkMapping(it, rootProject.file('js/kotlinx-coroutines-core-js')) |
| 35 | + makeLinkMapping(it, rootProject.file('common/kotlinx-coroutines-core-common')) |
| 36 | + // source roots |
| 37 | + impliedPlatforms = ['JVM', 'JS'] |
46 | 38 | sourceRoot { |
47 | | - path = project.file('src/main/kotlin') |
48 | | - platforms = [platform] |
| 39 | + path = rootProject.file('core/kotlinx-coroutines-core/src/main/kotlin') |
| 40 | + platforms = ['JVM'] |
49 | 41 | } |
50 | 42 | sourceRoot { |
51 | | - path = rootProject.file('common/kotlinx-coroutines-core-common/src/main/kotlin') |
| 43 | + path = rootProject.file('js/kotlinx-coroutines-core-js/src/main/kotlin') |
| 44 | + platforms = ['JS'] |
52 | 45 | } |
53 | | - } else { |
54 | 46 | sourceRoot { |
55 | | - path = project.file('src/main/kotlin') |
| 47 | + path = rootProject.file('common/kotlinx-coroutines-core-common/src/main/kotlin') |
56 | 48 | } |
57 | | - } |
58 | | - afterEvaluate { |
59 | | - classpath = project.configurations.compileClasspath.files |
60 | | - dependsOn(project.configurations.compileClasspath) |
61 | | - if (platform == "js") { |
62 | | - def jvmlib = project.dependencies.create("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") |
63 | | - classpath += project.configurations.detachedConfiguration(jvmlib).files |
| 49 | + // depends on JS & Common, too |
| 50 | + afterEvaluate { |
| 51 | + dependsOn(tasks.getByPath(":kotlinx-coroutines-core-js:classes")) |
| 52 | + dependsOn(tasks.getByPath(":kotlinx-coroutines-core-common:classes")) |
| 53 | + } |
| 54 | + afterEvaluate { |
| 55 | + classpath = project.configurations.compileClasspath.files |
| 56 | + dependsOn(project.configurations.compileClasspath) |
64 | 57 | } |
65 | 58 | } |
66 | 59 | } |
| 60 | + |
| 61 | + // real xxx-javadoc.jar for JVM |
| 62 | + task dokkaJavadoc(type: dokka.getClass()) { |
| 63 | + outputFormat = 'javadoc' |
| 64 | + outputDirectory = "$buildDir/javadoc" |
| 65 | + } |
| 66 | + |
| 67 | + task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { |
| 68 | + classifier = 'javadoc' |
| 69 | + from "$buildDir/javadoc" |
| 70 | + } |
| 71 | +} else { |
| 72 | + // empty xxx-javadoc.jar for JS and Common modules |
| 73 | + task javadocJar(type: Jar) { |
| 74 | + classifier = 'javadoc' |
| 75 | + from "$buildDir/javadoc" // would not exist |
| 76 | + } |
67 | 77 | } |
0 commit comments