Add Kotlin Gradle DSL to configure coroutines from build.gradle
This commit is contained in:
+20
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
@@ -26,6 +28,24 @@ class CoroutinesIT: BaseGradleIT() {
|
||||
private const val GRADLE_PROPERTIES = "gradle.properties"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCoroutinesProjectDSL() {
|
||||
val project = Project("coroutinesProjectDSL", GRADLE_VERSION)
|
||||
project.build("assemble") {
|
||||
assertSuccessful()
|
||||
assertContains("-Xcoroutines=enable")
|
||||
}
|
||||
|
||||
project.projectDir.getFileByName("build.gradle").modify {
|
||||
it.replace("coroutines 'enable'", "coroutines 'error'")
|
||||
}
|
||||
|
||||
project.build("assemble") {
|
||||
assertFailed()
|
||||
assertContains("-Xcoroutines=error")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCoroutinesJvmEnabled() {
|
||||
jvmProject.doTest("enable", GRADLE_PROPERTIES)
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
experimental {
|
||||
coroutines 'enable'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m
|
||||
+1
@@ -0,0 +1 @@
|
||||
suspend fun <T> suspendCoroutine(): T = TODO()
|
||||
Reference in New Issue
Block a user