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