Skip to content

Commit fbf966e

Browse files
committed
Migrating integration-testing/build.gradle to kts WIP
1 parent d11b4ac commit fbf966e

File tree

1 file changed

+46
-44
lines changed

1 file changed

+46
-44
lines changed

integration-testing/build.gradle renamed to integration-testing/build.gradle.kts

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
import org.jetbrains.kotlin.gradle.dsl.*
56

67
buildscript {
78

@@ -14,40 +15,41 @@ buildscript {
1415
* Additionally, mavenLocal and Sonatype snapshots are added to repository list and stress tests are disabled.
1516
* DO NOT change the name of these properties without adapting kotlinx.train build chain.
1617
*/
17-
def prop = rootProject.properties['build_snapshot_train']
18-
ext.build_snapshot_train = prop != null && prop != ""
18+
extra["build_snapshot_train"] = rootProject.properties["build_snapshot_train"].let { it != null && it != "" }
19+
val build_snapshot_train: Boolean by extra
1920
if (build_snapshot_train) {
20-
ext.kotlin_version = rootProject.properties['kotlin_snapshot_version']
21+
extra["kotlin_version"] = rootProject.properties["kotlin_snapshot_version"]
22+
val kotlin_version: String? by extra
2123
if (kotlin_version == null) {
22-
throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler")
24+
throw IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler")
2325
}
2426
}
25-
ext.native_targets_enabled = rootProject.properties['disable_native_targets'] == null
27+
extra["native_targets_enabled"] = rootProject.properties["disable_native_targets"] == null
2628

2729
// 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")) {
30+
extra["using_snapshot_version"] = build_snapshot_train
31+
32+
rootProject.properties.forEach { key, value ->
33+
if (key.endsWith("_version") && value is String && value.endsWith("-SNAPSHOT")) {
3134
println("NOTE: USING SNAPSHOT VERSION: $key=$value")
32-
ext.using_snapshot_version = true
35+
extra["using_snapshot_version"] = true
3336
}
3437
}
3538

36-
if (using_snapshot_version) {
39+
if (build_snapshot_train) {
3740
repositories {
3841
mavenLocal()
39-
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
42+
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
4043
}
4144
}
42-
4345
}
4446

4547
plugins {
46-
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
48+
id("org.jetbrains.kotlin.jvm") version "${extra["kotlin_version"]}"
4749
}
4850

4951
repositories {
50-
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
52+
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
5153
mavenLocal()
5254
mavenCentral()
5355
}
@@ -58,9 +60,9 @@ java {
5860
}
5961

6062
dependencies {
61-
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
62-
testImplementation "org.ow2.asm:asm:$asm_version"
63-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
63+
testImplementation("org.jetbrains.kotlin:kotlin-test:${extra["kotlin_version"]}")
64+
testImplementation("org.ow2.asm:asm:${rootProject.properties["asm_version"]}")
65+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
6466
}
6567

6668
sourceSets {
@@ -71,8 +73,8 @@ sourceSets {
7173
runtimeClasspath += sourceSets.test.runtimeClasspath
7274

7375
dependencies {
74-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
75-
implementation 'com.google.guava:guava:31.1-jre'
76+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.properties["coroutines_version"]}")
77+
implementation("com.google.guava:guava:31.1-jre")
7678
}
7779
}
7880
// Checks correctness of Maven publication (JAR resources) and absence of atomicfu symbols
@@ -82,8 +84,8 @@ sourceSets {
8284
runtimeClasspath += sourceSets.test.runtimeClasspath
8385

8486
dependencies {
85-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
86-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
87+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.properties["coroutines_version"]}")
88+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${rootProject.properties["coroutines_version"]}")
8789
}
8890
}
8991
// Checks that kotlinx-coroutines-debug can be used as -javaagent parameter
@@ -93,8 +95,8 @@ sourceSets {
9395
runtimeClasspath += sourceSets.test.runtimeClasspath
9496

9597
dependencies {
96-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
97-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version"
98+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.properties["coroutines_version"]}")
99+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-debug:${rootProject.properties["coroutines_version"]}")
98100
}
99101
}
100102

@@ -105,8 +107,8 @@ sourceSets {
105107
runtimeClasspath += sourceSets.test.runtimeClasspath
106108

107109
dependencies {
108-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
109-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version"
110+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.properties["coroutines_version"]}")
111+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-debug:${rootProject.properties["coroutines_version"]}")
110112
}
111113
}
112114

@@ -117,7 +119,7 @@ sourceSets {
117119
runtimeClasspath += sourceSets.test.runtimeClasspath
118120

119121
dependencies {
120-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
122+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.properties["coroutines_version"]}")
121123
}
122124
}
123125
}
@@ -128,39 +130,39 @@ compileDebugAgentTestKotlin {
128130
}
129131
}
130132

131-
task jvmCoreTest(type: Test) {
132-
environment "version", coroutines_version
133-
def sourceSet = sourceSets.jvmCoreTest
133+
tasks.create<Test>("jvmCoreTest") {
134+
environment("version", rootProject.properties["coroutines_version"])
135+
val sourceSet = sourceSets.jvmCoreTest
134136
testClassesDirs = sourceSet.output.classesDirs
135137
classpath = sourceSet.runtimeClasspath
136138
}
137139

138-
task mavenTest(type: Test) {
139-
environment "version", coroutines_version
140-
def sourceSet = sourceSets.mavenTest
140+
tasks.create<Test>("mavenTest") {
141+
environment("version", rootProject.properties["coroutines_version"])
142+
val sourceSet = sourceSets.mavenTest
141143
testClassesDirs = sourceSet.output.classesDirs
142144
classpath = sourceSet.runtimeClasspath
143145
}
144146

145-
task debugAgentTest(type: Test) {
146-
def sourceSet = sourceSets.debugAgentTest
147-
def coroutinesDebugJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-debug-${coroutines_version}.jar" }.singleFile
148-
jvmArgs ('-javaagent:' + coroutinesDebugJar)
147+
tasks.create<Test>("debugAgentTest") {
148+
val sourceSet = sourceSets.debugAgentTest
149+
val coroutinesDebugJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-debug-${coroutines_version}.jar" }.singleFile
150+
jvmArgs ("-javaagent:" + coroutinesDebugJar)
149151
testClassesDirs = sourceSet.output.classesDirs
150152
classpath = sourceSet.runtimeClasspath
151-
systemProperties project.properties.subMap(["overwrite.probes"])
153+
systemProperties(rootProject.properties.subMap(["overwrite.probes"]))
152154
}
153155

154-
task debugDynamicAgentTest(type: Test) {
155-
def sourceSet = sourceSets.debugDynamicAgentTest
156+
tasks.create<Test>("debugDynamicAgentTest") {
157+
val sourceSet = sourceSets.debugDynamicAgentTest
156158
testClassesDirs = sourceSet.output.classesDirs
157159
classpath = sourceSet.runtimeClasspath
158160
}
159161

160-
task coreAgentTest(type: Test) {
161-
def sourceSet = sourceSets.coreAgentTest
162-
def coroutinesCoreJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-core-jvm-${coroutines_version}.jar" }.singleFile
163-
jvmArgs ('-javaagent:' + coroutinesCoreJar)
162+
tasks.create<Test>("coreAgentTest") {
163+
val sourceSet = sourceSets.coreAgentTest
164+
val coroutinesCoreJar = sourceSet.runtimeClasspath.filter {it.name == "kotlinx-coroutines-core-jvm-${coroutines_version}.jar" }.singleFile
165+
jvmArgs ("-javaagent:" + coroutinesCoreJar)
164166
testClassesDirs = sourceSet.output.classesDirs
165167
classpath = sourceSet.runtimeClasspath
166168
}
@@ -170,7 +172,7 @@ compileTestKotlin {
170172
}
171173

172174
check {
173-
dependsOn([jvmCoreTest, debugDynamicAgentTest, mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
175+
dependsOn([jvmCoreTest, debugDynamicAgentTest, mavenTest, debugAgentTest, coreAgentTest, "smokeTest:build"])
174176
}
175177
compileKotlin {
176178
kotlinOptions {

0 commit comments

Comments
 (0)