55import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
66
77plugins {
8- id( " kotlin- jvm-conventions " )
8+ id " org.jetbrains. kotlin. jvm"
99}
1010
1111repositories {
1212 mavenLocal()
1313 mavenCentral()
1414}
1515
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+
1625sourceSets {
1726 mavenTest {
1827 kotlin
1928 compileClasspath + = sourceSets. test. runtimeClasspath
2029 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+ }
2135 }
2236 debugAgentTest {
2337 kotlin
2438 compileClasspath + = sourceSets. test. runtimeClasspath
2539 runtimeClasspath + = sourceSets. test. runtimeClasspath
26- }
2740
41+ dependencies {
42+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version "
43+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version "
44+ }
45+ }
2846 coreAgentTest {
2947 kotlin
3048 compileClasspath + = sourceSets. test. runtimeClasspath
3149 runtimeClasspath + = sourceSets. test. runtimeClasspath
50+
51+ dependencies {
52+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version "
53+ }
3254 }
3355}
3456
@@ -39,53 +61,33 @@ compileDebugAgentTestKotlin {
3961}
4062
4163task mavenTest (type : Test ) {
42- environment " version" , version
64+ environment " version" , coroutines_version
4365 def sourceSet = sourceSets. mavenTest
44- dependsOn(project(' :' ). getTasksByName(" publishToMavenLocal" , true ))
4566 testClassesDirs = sourceSet. output. classesDirs
4667 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
5868}
5969
6070task debugAgentTest (type : Test ) {
6171 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 )
6474 testClassesDirs = sourceSet. output. classesDirs
6575 classpath = sourceSet. runtimeClasspath
6676 systemProperties project. properties. subMap([" overwrite.probes" ])
6777}
6878
6979task coreAgentTest (type : Test ) {
7080 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 )
7383 testClassesDirs = sourceSet. output. classesDirs
7484 classpath = sourceSet. runtimeClasspath
7585}
7686
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-
8587compileTestKotlin {
8688 kotlinOptions. jvmTarget = " 1.8"
8789}
8890
8991check {
90- dependsOn([mavenTest, debugAgentTest, coreAgentTest])
92+ dependsOn([mavenTest, debugAgentTest, coreAgentTest, ' smokeTest:build ' ])
9193}
0 commit comments