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