| /* |
| * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| */ |
| |
| apply from: rootProject.file("gradle/compile-jvm.gradle") |
| |
| repositories { |
| mavenLocal() |
| mavenCentral() |
| } |
| |
| sourceSets { |
| npmTest { |
| kotlin |
| compileClasspath += sourceSets.test.runtimeClasspath |
| runtimeClasspath += sourceSets.test.runtimeClasspath |
| } |
| mavenTest { |
| kotlin |
| compileClasspath += sourceSets.test.runtimeClasspath |
| runtimeClasspath += sourceSets.test.runtimeClasspath |
| } |
| debugAgentTest { |
| kotlin |
| compileClasspath += sourceSets.test.runtimeClasspath |
| runtimeClasspath += sourceSets.test.runtimeClasspath |
| } |
| } |
| |
| task npmTest(type: Test) { |
| def sourceSet = sourceSets.npmTest |
| environment "projectRoot", project.rootDir |
| environment "deployVersion", version |
| def dryRunNpm = project.properties['dryRun'] |
| def doRun = dryRunNpm == "true" // so that we don't accidentally publish anything, especially before the test |
| onlyIf { doRun } |
| if (doRun) { // `onlyIf` only affects execution of the task, not the dependency subtree |
| dependsOn(project(':').getTasksByName("publishNpm", true)) |
| } |
| testClassesDirs = sourceSet.output.classesDirs |
| classpath = sourceSet.runtimeClasspath |
| } |
| |
| task mavenTest(type: Test) { |
| def sourceSet = sourceSets.mavenTest |
| dependsOn(project(':').getTasksByName("publishToMavenLocal", true)) |
| dependsOn.remove(project(':').getTasksByName("dokka", true)) |
| testClassesDirs = sourceSet.output.classesDirs |
| classpath = sourceSet.runtimeClasspath |
| } |
| |
| task debugAgentTest(type: Test) { |
| def sourceSet = sourceSets.debugAgentTest |
| dependsOn(project(':kotlinx-coroutines-debug').shadowJar) |
| jvmArgs ('-javaagent:' + project(':kotlinx-coroutines-debug').shadowJar.outputs.files.getFiles()[0]) |
| testClassesDirs = sourceSet.output.classesDirs |
| classpath = sourceSet.runtimeClasspath |
| } |
| |
| dependencies { |
| testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" |
| testCompile 'junit:junit:4.12' |
| npmTestCompile 'org.apache.commons:commons-compress:1.18' |
| npmTestCompile 'com.google.code.gson:gson:2.8.5' |
| mavenTestRuntimeOnly project(':kotlinx-coroutines-core') |
| mavenTestRuntimeOnly project(':kotlinx-coroutines-android') |
| debugAgentTestCompile project(':kotlinx-coroutines-core') |
| debugAgentTestCompile project(':kotlinx-coroutines-debug') |
| } |
| |
| compileTestKotlin { |
| kotlinOptions.jvmTarget = "1.8" |
| } |
| |
| test { |
| dependsOn([npmTest, mavenTest, debugAgentTest]) |
| } |