|
1 | 1 | /*
|
2 | 2 | * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
|
3 | 3 | */
|
| 4 | + |
| 5 | +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
4 | 6 | import org.jetbrains.kotlin.konan.target.HostManager
|
5 |
| -import org.gradle.util.VersionNumber |
6 | 7 |
|
7 | 8 | apply plugin: 'jdk-convention'
|
8 | 9 | apply from: rootProject.file("gradle/experimental.gradle")
|
@@ -74,9 +75,6 @@ buildscript {
|
74 | 75 |
|
75 | 76 | CacheRedirector.configureBuildScript(buildscript, rootProject)
|
76 | 77 | }
|
77 |
| - |
78 |
| -import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
79 |
| - |
80 | 78 | // todo:KLUDGE: Hierarchical project structures are not fully supported in IDEA, enable only for a regular built
|
81 | 79 | if (!Idea.active) {
|
82 | 80 | ext.set("kotlin.mpp.enableGranularSourceSetsMetadata", "true")
|
@@ -288,3 +286,34 @@ if (jvm_ir_enabled) {
|
288 | 286 | }
|
289 | 287 | }
|
290 | 288 | }
|
| 289 | + |
| 290 | +// Opt-in for build scan in order to troubleshoot Gradle on TC |
| 291 | +if (hasProperty('buildScan')) { |
| 292 | + buildScan { |
| 293 | + termsOfServiceUrl = 'https://gradle.com/terms-of-service' |
| 294 | + termsOfServiceAgree = 'yes' |
| 295 | + } |
| 296 | +} |
| 297 | + |
| 298 | +/* |
| 299 | + * kotlinx-coroutines-core dependency leaks into test runtime classpath via kotlin-compiler-embeddable |
| 300 | + * and conflicts with our own test/runtime incompatibilities (e.g. when class is moved from a main to test), |
| 301 | + * so we do substitution here |
| 302 | + */ |
| 303 | +allprojects { subProject -> |
| 304 | + subProject |
| 305 | + .configurations |
| 306 | + .matching { |
| 307 | + // Excluding substituted project itself because of circular dependencies, but still do it |
| 308 | + // for "*Test*" configurations |
| 309 | + subProject.name != "kotlinx-coroutines-core" || it.name.contains("Test") |
| 310 | + } |
| 311 | + .configureEach { conf -> |
| 312 | + conf.resolutionStrategy.dependencySubstitution { |
| 313 | + substitute(module("org.jetbrains.kotlinx:kotlinx-coroutines-core")) |
| 314 | + .using(project(":kotlinx-coroutines-core")) |
| 315 | + .because("Because Kotlin compiler embeddable leaks coroutines into the runtime classpath, " + |
| 316 | + "triggering all sort of incompatible class changes errors") |
| 317 | + } |
| 318 | + } |
| 319 | +} |
0 commit comments