Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame] | 1 | /* |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 2 | * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame] | 3 | */ |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 4 | import org.jetbrains.kotlin.konan.target.HostManager |
Sergey Igushkin | 17248c8 | 2020-05-22 12:28:25 +0300 | [diff] [blame] | 5 | import org.gradle.util.VersionNumber |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 6 | |
Victor Turansky | e47cb35 | 2020-05-12 18:33:04 +0300 | [diff] [blame] | 7 | apply plugin: 'jdk-convention' |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 8 | apply from: rootProject.file("gradle/experimental.gradle") |
| 9 | |
| 10 | def rootModule = "kotlinx.coroutines" |
| 11 | def coreModule = "kotlinx-coroutines-core" |
| 12 | // Not applicable for Kotlin plugin |
dkhalanskyjb | 02b403d | 2020-04-06 16:33:22 +0300 | [diff] [blame] | 13 | def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing'] |
| 14 | def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing'] |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 15 | // Not published |
Vsevolod Tolstopyatov | 5378b80 | 2019-09-19 17:39:08 +0300 | [diff] [blame] | 16 | def unpublished = internal + ['example-frontend-js', 'android-unit-tests'] |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 17 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 18 | buildscript { |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 19 | /* |
| 20 | * These property group is used to build kotlinx.coroutines against Kotlin compiler snapshot. |
| 21 | * How does it work: |
| 22 | * When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version, |
| 23 | * atomicfu_version is overwritten by TeamCity environment (AFU is built with snapshot and published to mavenLocal |
| 24 | * as previous step or the snapshot build). |
| 25 | * Additionally, mavenLocal and Sonatype snapshots are added to repository list and stress tests are disabled. |
| 26 | * DO NOT change the name of these properties without adapting kotlinx.train build chain. |
| 27 | */ |
| 28 | def prop = rootProject.properties['build_snapshot_train'] |
| 29 | ext.build_snapshot_train = prop != null && prop != "" |
| 30 | if (build_snapshot_train) { |
| 31 | ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
| 32 | if (kotlin_version == null) { |
| 33 | throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") |
| 34 | } |
Roman Elizarov | e1ac2e5 | 2019-04-19 18:51:05 +0300 | [diff] [blame] | 35 | } |
| 36 | |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 37 | // Determine if any project dependency is using a snapshot version |
| 38 | ext.using_snapshot_version = build_snapshot_train |
| 39 | rootProject.properties.each { key, value -> |
| 40 | if (key.endsWith("_version") && value instanceof String && value.endsWith("-SNAPSHOT")) { |
| 41 | println("NOTE: USING SNAPSHOT VERSION: $key=$value") |
| 42 | ext.using_snapshot_version=true |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | if (using_snapshot_version) { |
Roman Elizarov | 1f6b44d | 2017-10-26 17:51:52 +0300 | [diff] [blame] | 47 | repositories { |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 48 | mavenLocal() |
Roman Elizarov | 1f6b44d | 2017-10-26 17:51:52 +0300 | [diff] [blame] | 49 | } |
| 50 | } |
Roman Elizarov | e1ac2e5 | 2019-04-19 18:51:05 +0300 | [diff] [blame] | 51 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 52 | repositories { |
| 53 | jcenter() |
Vsevolod Tolstopyatov | 2d0d9aa | 2020-08-13 15:34:49 +0300 | [diff] [blame] | 54 | maven { |
| 55 | url "https://kotlin.bintray.com/kotlinx" |
| 56 | credentials { |
| 57 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 58 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 59 | } |
| 60 | } |
Vsevolod Tolstopyatov | 63156a8 | 2020-08-24 16:15:52 +0300 | [diff] [blame^] | 61 | // Future replacement for kotlin-dev, with cache redirector |
| 62 | maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
Michael Kuzmin | 476d6de | 2019-12-16 22:38:59 +0300 | [diff] [blame] | 63 | maven { |
| 64 | url "https://kotlin.bintray.com/kotlin-dev" |
| 65 | credentials { |
| 66 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 67 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 68 | } |
| 69 | } |
Roman Elizarov | 0950dfa | 2018-07-13 10:33:25 +0300 | [diff] [blame] | 70 | maven { url "https://kotlin.bintray.com/kotlin-eap" } |
Roman Elizarov | 3145290 | 2018-04-11 13:58:19 +0300 | [diff] [blame] | 71 | maven { url "https://jetbrains.bintray.com/kotlin-native-dependencies" } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 72 | maven { url "https://plugins.gradle.org/m2/" } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 73 | } |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 74 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 75 | dependencies { |
| 76 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 77 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 78 | classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version" |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 79 | classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version" |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 80 | classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version" |
Vsevolod Tolstopyatov | e153863 | 2020-02-10 21:12:58 +0300 | [diff] [blame] | 81 | classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$binary_compatibility_validator_version" |
Vsevolod Tolstopyatov | 305c66a | 2018-08-21 21:01:58 +0300 | [diff] [blame] | 82 | |
| 83 | // JMH plugins |
Vsevolod Tolstopyatov | bda9c79 | 2019-09-12 16:50:33 +0300 | [diff] [blame] | 84 | classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 88 | import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
| 89 | |
Sergey Igushkin | 17248c8 | 2020-05-22 12:28:25 +0300 | [diff] [blame] | 90 | // Hierarchical project structures are not fully supported in 1.3.7x MPP, enable conditionally for 1.4.x |
| 91 | if (VersionNumber.parse(kotlin_version) > VersionNumber.parse("1.3.79")) { |
| 92 | ext.set("kotlin.mpp.enableGranularSourceSetsMetadata", "true") |
| 93 | } |
| 94 | |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 95 | // todo:KLUDGE: This is needed to workaround dependency resolution between Java and MPP modules |
| 96 | def configureKotlinJvmPlatform(configuration) { |
| 97 | configuration.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm) |
| 98 | } |
| 99 | |
Ilya Gorbunov | b1a07ee | 2018-04-16 21:51:55 +0300 | [diff] [blame] | 100 | allprojects { |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 101 | // the only place where HostManager could be instantiated |
| 102 | project.ext.hostManager = new HostManager() |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 103 | def deployVersion = properties['DeployVersion'] |
| 104 | if (deployVersion != null) version = deployVersion |
| 105 | |
| 106 | if (build_snapshot_train) { |
| 107 | ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
| 108 | println "Using Kotlin $kotlin_version for project $it" |
| 109 | |
Vsevolod Tolstopyatov | 6ca6ed5 | 2019-08-21 17:08:34 +0300 | [diff] [blame] | 110 | def skipSnapshotChecks = rootProject.properties['skip_snapshot_checks'] != null |
| 111 | if (!skipSnapshotChecks && version != atomicfu_version) { |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 112 | throw new IllegalStateException("Current deploy version is $version, but atomicfu version is not overridden ($atomicfu_version) for $it") |
| 113 | } |
| 114 | |
| 115 | kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
Roman Elizarov | e1ac2e5 | 2019-04-19 18:51:05 +0300 | [diff] [blame] | 116 | } |
| 117 | |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 118 | if (using_snapshot_version) { |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 119 | repositories { |
| 120 | mavenLocal() |
| 121 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 122 | } |
| 123 | } |
Vsevolod Tolstopyatov | fe4e05c | 2019-07-19 12:28:15 +0300 | [diff] [blame] | 124 | |
| 125 | ext.unpublished = unpublished |
Roman Elizarov | 0b16abf | 2019-09-03 11:07:11 +0300 | [diff] [blame] | 126 | |
| 127 | // This project property is set during nightly stress test |
| 128 | def stressTest = project.properties['stressTest'] |
| 129 | |
| 130 | // Copy it to all test tasks |
| 131 | tasks.withType(Test) { |
| 132 | systemProperty 'stressTest', stressTest |
| 133 | } |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 134 | } |
| 135 | |
Vsevolod Tolstopyatov | e153863 | 2020-02-10 21:12:58 +0300 | [diff] [blame] | 136 | apply plugin: "binary-compatibility-validator" |
| 137 | apiValidation { |
dkhalanskyjb | 3651276 | 2020-02-21 17:31:05 +0300 | [diff] [blame] | 138 | ignoredProjects += unpublished + ["kotlinx-coroutines-bom"] |
Vsevolod Tolstopyatov | aff8202 | 2020-03-10 19:58:36 +0300 | [diff] [blame] | 139 | if (build_snapshot_train) { |
| 140 | ignoredProjects.remove("site") |
| 141 | ignoredProjects.remove("example-frontend-js") |
Stanislav Erokhin | 4b16e1b | 2020-06-09 09:38:51 +0300 | [diff] [blame] | 142 | ignoredProjects.add("kotlinx-coroutines-core") |
Vsevolod Tolstopyatov | aff8202 | 2020-03-10 19:58:36 +0300 | [diff] [blame] | 143 | } |
Vsevolod Tolstopyatov | e153863 | 2020-02-10 21:12:58 +0300 | [diff] [blame] | 144 | ignoredPackages += "kotlinx.coroutines.internal" |
| 145 | } |
| 146 | |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 147 | // Configure repositories |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 148 | allprojects { |
Roman Elizarov | 18fa116 | 2018-06-27 15:13:01 +0300 | [diff] [blame] | 149 | repositories { |
Vsevolod Tolstopyatov | 6f01c93 | 2018-10-23 19:40:48 +0300 | [diff] [blame] | 150 | /* |
| 151 | * google should be first in the repository list because some of the play services |
| 152 | * transitive dependencies was removed from jcenter, thus breaking gradle dependency resolution |
| 153 | */ |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 154 | google() |
Roman Elizarov | 18fa116 | 2018-06-27 15:13:01 +0300 | [diff] [blame] | 155 | jcenter() |
Vsevolod Tolstopyatov | 63156a8 | 2020-08-24 16:15:52 +0300 | [diff] [blame^] | 156 | // Future replacement for kotlin-dev, with cache redirector |
| 157 | maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
Michael Kuzmin | 476d6de | 2019-12-16 22:38:59 +0300 | [diff] [blame] | 158 | maven { |
| 159 | url "https://kotlin.bintray.com/kotlin-dev" |
| 160 | credentials { |
| 161 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 162 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 163 | } |
| 164 | } |
Roman Elizarov | 0950dfa | 2018-07-13 10:33:25 +0300 | [diff] [blame] | 165 | maven { url "https://kotlin.bintray.com/kotlin-eap" } |
Vsevolod Tolstopyatov | 2d0d9aa | 2020-08-13 15:34:49 +0300 | [diff] [blame] | 166 | maven { |
| 167 | url "https://kotlin.bintray.com/kotlinx" |
| 168 | credentials { |
| 169 | username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" |
| 170 | password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" |
| 171 | } |
| 172 | } |
| 173 | mavenLocal() |
Roman Elizarov | 18fa116 | 2018-06-27 15:13:01 +0300 | [diff] [blame] | 174 | } |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 175 | } |
Ilya Gorbunov | b1a07ee | 2018-04-16 21:51:55 +0300 | [diff] [blame] | 176 | |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 177 | // Add dependency to core source sets. Core is configured in kx-core/build.gradle |
| 178 | configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != coreModule }) { |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 179 | evaluationDependsOn(":$coreModule") |
Victor Turansky | de38890 | 2020-05-02 14:22:30 +0300 | [diff] [blame] | 180 | def platform = PlatformKt.platformOf(it) |
Roman Elizarov | e1a5652 | 2018-04-04 10:31:08 +0300 | [diff] [blame] | 181 | apply from: rootProject.file("gradle/compile-${platform}.gradle") |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 182 | dependencies { |
| 183 | // See comment below for rationale, it will be replaced with "project" dependency |
| 184 | compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version" |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 185 | // the only way IDEA can resolve test classes |
| 186 | testCompile project(":$coreModule").kotlin.targets.jvm.compilations.test.output.allOutputs |
| 187 | } |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 188 | } |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 189 | |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 190 | // Configure subprojects with Kotlin sources |
| 191 | configure(subprojects.findAll { !sourceless.contains(it.name) }) { |
| 192 | // Use atomicfu plugin, it also adds all the necessary dependencies |
| 193 | apply plugin: 'kotlinx-atomicfu' |
| 194 | |
| 195 | // Configure options for all Kotlin compilation tasks |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 196 | tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { |
| 197 | kotlinOptions.freeCompilerArgs += experimentalAnnotations.collect { "-Xuse-experimental=" + it } |
| 198 | kotlinOptions.freeCompilerArgs += "-progressive" |
Vsevolod Tolstopyatov | a8904e2 | 2019-07-17 17:22:05 -0700 | [diff] [blame] | 199 | kotlinOptions.freeCompilerArgs += "-XXLanguage:+InlineClasses" |
Roman Elizarov | bf9509d | 2020-02-14 15:52:10 +0300 | [diff] [blame] | 200 | // Remove null assertions to get smaller bytecode on Android |
| 201 | kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"] |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 202 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 203 | } |
| 204 | |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 205 | if (build_snapshot_train) { |
| 206 | println "Hacking test tasks, removing stress and flaky tests" |
| 207 | allprojects { |
| 208 | tasks.withType(Test).all { |
Vsevolod Tolstopyatov | dbe3f48 | 2019-04-17 17:51:13 +0300 | [diff] [blame] | 209 | exclude '**/*LinearizabilityTest*' |
| 210 | exclude '**/*LFTest*' |
| 211 | exclude '**/*StressTest*' |
| 212 | exclude '**/*scheduling*' |
| 213 | exclude '**/*Timeout*' |
Vsevolod Tolstopyatov | 1748ce1 | 2019-04-18 14:49:35 +0300 | [diff] [blame] | 214 | exclude '**/*definitely/not/kotlinx*' |
Vsevolod Tolstopyatov | 642989e | 2020-01-24 20:00:46 +0300 | [diff] [blame] | 215 | // Disable because of KT-11567 in 1.4 |
Vsevolod Tolstopyatov | fb990b0 | 2020-02-04 17:11:47 +0300 | [diff] [blame] | 216 | exclude '**/*CasesPublicAPITest*' |
Sergey Igushkin | 17248c8 | 2020-05-22 12:28:25 +0300 | [diff] [blame] | 217 | // Kotlin |
| 218 | exclude '**/*PrecompiledDebugProbesTest*' |
Vsevolod Tolstopyatov | 1748ce1 | 2019-04-18 14:49:35 +0300 | [diff] [blame] | 219 | } |
| 220 | } |
| 221 | |
| 222 | println "Manifest of kotlin-compiler-embeddable.jar for coroutines" |
| 223 | configure(subprojects.findAll { it.name == "kotlinx-coroutines-core" }) { |
| 224 | configurations.matching { it.name == "kotlinCompilerClasspath" }.all { |
| 225 | resolvedConfiguration.getFiles().findAll { it.name.contains("kotlin-compiler-embeddable") }.each { |
| 226 | def manifest = zipTree(it).matching { |
| 227 | include 'META-INF/MANIFEST.MF' |
| 228 | }.getFiles().first() |
| 229 | |
| 230 | manifest.readLines().each { |
| 231 | println it |
| 232 | } |
| 233 | } |
Vsevolod Tolstopyatov | 585b766 | 2019-04-16 12:10:57 +0300 | [diff] [blame] | 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 238 | /* |
| 239 | * Hack to trick nmpp plugin: we are renaming artifacts in order to provide backward compatibility for dependencies, |
| 240 | * but publishing plugin does not re-read artifact names for kotlin-jvm projects, so renaming is not applied in pom files |
| 241 | * for JVM-only projects. |
| 242 | * |
Victor Turansky | a8f4b64 | 2020-04-28 14:30:02 +0300 | [diff] [blame] | 243 | * We artificially replace "project" dependency with "module" one to have proper names in pom files, but then substitute it |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 244 | * to have out "project" dependency back. |
| 245 | */ |
| 246 | configure(subprojects.findAll { it.name != coreModule && it.name != rootModule }) { |
| 247 | configurations.all { |
| 248 | resolutionStrategy.dependencySubstitution { |
| 249 | substitute module("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version") with project(':kotlinx-coroutines-core') |
| 250 | } |
| 251 | } |
| 252 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 253 | |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 254 | // Redefine source sets because we are not using 'kotlin/main/fqn' folder convention |
| 255 | configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != "benchmarks" && it.name != coreModule }) { |
Vsevolod Tolstopyatov | e1fa197 | 2018-06-19 15:54:58 +0300 | [diff] [blame] | 256 | sourceSets { |
Roman Elizarov | f9408f6 | 2018-06-29 20:12:52 +0300 | [diff] [blame] | 257 | main.kotlin.srcDirs = ['src'] |
| 258 | test.kotlin.srcDirs = ['test'] |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 259 | main.resources.srcDirs = ['resources'] |
| 260 | test.resources.srcDirs = ['test-resources'] |
Vsevolod Tolstopyatov | e1fa197 | 2018-06-19 15:54:58 +0300 | [diff] [blame] | 261 | } |
| 262 | } |
| 263 | |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 264 | def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/" |
| 265 | def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 266 | |
| 267 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Vsevolod Tolstopyatov | fe4e05c | 2019-07-19 12:28:15 +0300 | [diff] [blame] | 268 | if (it.name != 'kotlinx-coroutines-bom') { |
| 269 | apply from: rootProject.file('gradle/dokka.gradle') |
| 270 | } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 271 | apply from: rootProject.file('gradle/publish-bintray.gradle') |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 272 | } |
| 273 | |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 274 | configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
Vsevolod Tolstopyatov | fe4e05c | 2019-07-19 12:28:15 +0300 | [diff] [blame] | 275 | if (it.name != "kotlinx-coroutines-bom") { |
| 276 | if (it.name != coreModule) { |
| 277 | dokka.dependsOn project(":$coreModule").dokka |
| 278 | tasks.withType(dokka.getClass()) { |
| 279 | externalDocumentationLink { |
| 280 | url = new URL(core_docs_url) |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 281 | packageListUrl = new File(core_docs_file).toURI().toURL() |
Vsevolod Tolstopyatov | fe4e05c | 2019-07-19 12:28:15 +0300 | [diff] [blame] | 282 | } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 283 | } |
| 284 | } |
Vsevolod Tolstopyatov | e6e8239 | 2018-10-09 19:06:29 +0300 | [diff] [blame] | 285 | } |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 286 | } |
| 287 | |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 288 | // Report Kotlin compiler version when building project |
| 289 | println("Using Kotlin compiler version: $org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION") |
| 290 | |
| 291 | // --------------- Configure sub-projects that are published --------------- |
Roman Elizarov | 1ac3dc2 | 2020-02-14 15:39:09 +0300 | [diff] [blame] | 292 | def publishTasks = getTasksByName("publish", true) + getTasksByName("publishNpm", true) |
| 293 | |
Roman Elizarov | 1ac3dc2 | 2020-02-14 15:39:09 +0300 | [diff] [blame] | 294 | task deploy(dependsOn: publishTasks) |
Roman Elizarov | 94fb2a3 | 2018-03-05 17:32:59 +0300 | [diff] [blame] | 295 | |
Kirill Timofeev | a518696 | 2017-10-25 14:25:47 +0300 | [diff] [blame] | 296 | apply plugin: 'base' |
| 297 | |
| 298 | clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') } |
Roman Elizarov | 660c2d7 | 2020-02-14 13:18:37 +0300 | [diff] [blame] | 299 | |
| 300 | // --------------- Knit configuration --------------- |
| 301 | |
| 302 | apply plugin: 'kotlinx-knit' |
| 303 | |
| 304 | knit { |
| 305 | siteRoot = "https://kotlin.github.io/kotlinx.coroutines" |
| 306 | moduleRoots = [".", "integration", "reactive", "ui"] |
| 307 | } |
| 308 | |
Vsevolod Tolstopyatov | aff8202 | 2020-03-10 19:58:36 +0300 | [diff] [blame] | 309 | knitPrepare.dependsOn getTasksByName("dokka", true) |