|
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 | 4 |
|
| 5 | + |
| 6 | +buildscript { |
| 7 | + |
| 8 | + /* |
| 9 | + * These property group is used to build kotlinx.coroutines against Kotlin compiler snapshot. |
| 10 | + * How does it work: |
| 11 | + * When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version, |
| 12 | + * atomicfu_version is overwritten by TeamCity environment (AFU is built with snapshot and published to mavenLocal |
| 13 | + * as previous step or the snapshot build). |
| 14 | + * Additionally, mavenLocal and Sonatype snapshots are added to repository list and stress tests are disabled. |
| 15 | + * DO NOT change the name of these properties without adapting kotlinx.train build chain. |
| 16 | + */ |
| 17 | + def prop = rootProject.properties['build_snapshot_train'] |
| 18 | + ext.build_snapshot_train = prop != null && prop != "" |
| 19 | + if (build_snapshot_train) { |
| 20 | + ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] |
| 21 | + if (kotlin_version == null) { |
| 22 | + throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") |
| 23 | + } |
| 24 | + } |
| 25 | + ext.native_targets_enabled = rootProject.properties['disable_native_targets'] == null |
| 26 | + |
| 27 | + // Determine if any project dependency is using a snapshot version |
| 28 | + ext.using_snapshot_version = build_snapshot_train |
| 29 | + rootProject.properties.each { key, value -> |
| 30 | + if (key.endsWith("_version") && value instanceof String && value.endsWith("-SNAPSHOT")) { |
| 31 | + println("NOTE: USING SNAPSHOT VERSION: $key=$value") |
| 32 | + ext.using_snapshot_version = true |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + if (using_snapshot_version) { |
| 37 | + repositories { |
| 38 | + mavenLocal() |
| 39 | + maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | +} |
| 44 | + |
5 | 45 | plugins {
|
6 | 46 | id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
|
7 | 47 | }
|
8 | 48 |
|
9 | 49 | repositories {
|
| 50 | + if (build_snapshot_train) { |
| 51 | + maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } |
| 52 | + } |
10 | 53 | mavenLocal()
|
11 | 54 | mavenCentral()
|
12 | 55 | }
|
|
19 | 62 | dependencies {
|
20 | 63 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
21 | 64 | testImplementation "org.ow2.asm:asm:$asm_version"
|
| 65 | + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" |
22 | 66 | }
|
23 | 67 |
|
24 | 68 | sourceSets {
|
@@ -56,7 +100,7 @@ sourceSets {
|
56 | 100 | }
|
57 | 101 | }
|
58 | 102 |
|
59 |
| - // Checks that kotlinx-coroutines-debug agent can self-attach dynamically to JVM as standalone dependency |
| 103 | + // Checks that kotlinx-coroutines-debug agent can self-attach dynamically to JVM as a standalone dependency |
60 | 104 | debugDynamicAgentTest {
|
61 | 105 | kotlin
|
62 | 106 | compileClasspath += sourceSets.test.runtimeClasspath
|
@@ -130,3 +174,8 @@ compileTestKotlin {
|
130 | 174 | check {
|
131 | 175 | dependsOn([jvmCoreTest, debugDynamicAgentTest, mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
|
132 | 176 | }
|
| 177 | +compileKotlin { |
| 178 | + kotlinOptions { |
| 179 | + jvmTarget = "1.8" |
| 180 | + } |
| 181 | +} |
0 commit comments