5
5
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
6
6
7
7
plugins {
8
- id( " kotlin- jvm-conventions " )
8
+ id " org.jetbrains. kotlin. jvm"
9
9
}
10
10
11
11
repositories {
12
12
mavenLocal()
13
13
mavenCentral()
14
14
}
15
15
16
+ java {
17
+ sourceCompatibility = JavaVersion . VERSION_1_8
18
+ targetCompatibility = JavaVersion . VERSION_1_8
19
+ }
20
+
21
+ dependencies {
22
+ testImplementation " org.jetbrains.kotlin:kotlin-test:$kotlin_version "
23
+ }
24
+
16
25
sourceSets {
17
26
mavenTest {
18
27
kotlin
19
28
compileClasspath + = sourceSets. test. runtimeClasspath
20
29
runtimeClasspath + = sourceSets. test. runtimeClasspath
30
+
31
+ dependencies {
32
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version "
33
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version "
34
+ }
21
35
}
22
36
debugAgentTest {
23
37
kotlin
24
38
compileClasspath + = sourceSets. test. runtimeClasspath
25
39
runtimeClasspath + = sourceSets. test. runtimeClasspath
26
- }
27
40
41
+ dependencies {
42
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version "
43
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version "
44
+ }
45
+ }
28
46
coreAgentTest {
29
47
kotlin
30
48
compileClasspath + = sourceSets. test. runtimeClasspath
31
49
runtimeClasspath + = sourceSets. test. runtimeClasspath
50
+
51
+ dependencies {
52
+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version "
53
+ }
32
54
}
33
55
}
34
56
@@ -39,53 +61,33 @@ compileDebugAgentTestKotlin {
39
61
}
40
62
41
63
task mavenTest (type : Test ) {
42
- environment " version" , version
64
+ environment " version" , coroutines_version
43
65
def sourceSet = sourceSets. mavenTest
44
- dependsOn(project(' :' ). getTasksByName(" publishToMavenLocal" , true ))
45
66
testClassesDirs = sourceSet. output. classesDirs
46
67
classpath = sourceSet. runtimeClasspath
47
- // we can't depend on the subprojects because we need to test the classfiles that are published in the end.
48
- // also, we can't put this in the `dependencies` block because the resolution would happen before publication.
49
- def mavenTestClasspathConfiguration = project. configurations. detachedConfiguration(
50
- project. dependencies. create(" org.jetbrains.kotlinx:kotlinx-coroutines-core:$version " ),
51
- project. dependencies. create(" org.jetbrains.kotlinx:kotlinx-coroutines-android:$version " ))
52
-
53
- mavenTestClasspathConfiguration. attributes {
54
- attribute(KotlinPlatformType . attribute, KotlinPlatformType . jvm)
55
- }
56
-
57
- classpath + = mavenTestClasspathConfiguration
58
68
}
59
69
60
70
task debugAgentTest (type : Test ) {
61
71
def sourceSet = sourceSets. debugAgentTest
62
- dependsOn(project( ' : kotlinx-coroutines-debug' ) . shadowJar)
63
- jvmArgs (' -javaagent:' + project( ' :kotlinx-coroutines-debug ' ) . shadowJar . outputs . files . getFiles()[ 0 ] )
72
+ def coroutinesDebugJar = sourceSet . runtimeClasspath . filter {it . name == " kotlinx-coroutines-debug- ${ coroutines_version } .jar " } . singleFile
73
+ jvmArgs (' -javaagent:' + coroutinesDebugJar )
64
74
testClassesDirs = sourceSet. output. classesDirs
65
75
classpath = sourceSet. runtimeClasspath
66
76
systemProperties project. properties. subMap([" overwrite.probes" ])
67
77
}
68
78
69
79
task coreAgentTest (type : Test ) {
70
80
def sourceSet = sourceSets. coreAgentTest
71
- dependsOn(project( ' : kotlinx-coroutines-core' ) . jvmJar)
72
- jvmArgs (' -javaagent:' + project( ' :kotlinx-coroutines-core ' ) . jvmJar . outputs . files . getFiles()[ 0 ] )
81
+ def coroutinesCoreJar = sourceSet . runtimeClasspath . filter {it . name == " kotlinx-coroutines-core-jvm- ${ coroutines_version } .jar " } . singleFile
82
+ jvmArgs (' -javaagent:' + coroutinesCoreJar )
73
83
testClassesDirs = sourceSet. output. classesDirs
74
84
classpath = sourceSet. runtimeClasspath
75
85
}
76
86
77
- dependencies {
78
- testImplementation " org.jetbrains.kotlin:kotlin-stdlib-jdk8"
79
- testImplementation ' junit:junit:4.12'
80
- debugAgentTestImplementation project(' :kotlinx-coroutines-core' )
81
- debugAgentTestImplementation project(' :kotlinx-coroutines-debug' )
82
- coreAgentTestImplementation project(' :kotlinx-coroutines-core' )
83
- }
84
-
85
87
compileTestKotlin {
86
88
kotlinOptions. jvmTarget = " 1.8"
87
89
}
88
90
89
91
check {
90
- dependsOn([mavenTest, debugAgentTest, coreAgentTest])
92
+ dependsOn([mavenTest, debugAgentTest, coreAgentTest, ' smokeTest:build ' ])
91
93
}
0 commit comments