Implement fallback strategies
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.junit.Test
|
||||
|
||||
class ExecutionStrategyIT(): BaseGradleIT() {
|
||||
companion object {
|
||||
private const val GRADLE_VERSION = "2.10"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDaemon() {
|
||||
doTestExecutionStrategy("daemon")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testInProcess() {
|
||||
doTestExecutionStrategy("in-process")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testOutOfProcess() {
|
||||
doTestExecutionStrategy("out-of-process")
|
||||
}
|
||||
|
||||
private fun doTestExecutionStrategy(executionStrategy: String) {
|
||||
val project = Project("kotlinBuiltins", GRADLE_VERSION)
|
||||
setupProject(project)
|
||||
|
||||
val strategyCLIArg = "-Dkotlin.compiler.execution.strategy=$executionStrategy"
|
||||
val finishMessage = "Finished executing kotlin compiler using $executionStrategy strategy"
|
||||
|
||||
project.build("build", strategyCLIArg) {
|
||||
assertSuccessful()
|
||||
assertContains(finishMessage)
|
||||
checkOutput()
|
||||
}
|
||||
|
||||
val fKt = project.projectDir.getFileByName("f.kt")
|
||||
fKt.delete()
|
||||
project.build("build", strategyCLIArg) {
|
||||
assertFailed()
|
||||
assertContains(finishMessage)
|
||||
assert(output.contains("Unresolved reference: f", ignoreCase = true))
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun setupProject(project: Project) {
|
||||
}
|
||||
|
||||
protected open fun CompiledProject.checkOutput() {
|
||||
assertFileExists("app/build/classes/main/foo/MainKt.class")
|
||||
}
|
||||
}
|
||||
+1
@@ -17,6 +17,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
||||
|
||||
project.build("compileDeployKotlin", "build") {
|
||||
assertSuccessful()
|
||||
assertContains("Finished executing kotlin compiler using daemon strategy")
|
||||
assertReportExists("build/reports/tests/classes/demo.TestSource.html")
|
||||
assertContains(":compileKotlin", ":compileTestKotlin", ":compileDeployKotlin")
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
fun f(fn: (x: Int)->Unit) {}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
package foo
|
||||
|
||||
fun f(fn: (x: Int)->Unit) {}
|
||||
fun main() {
|
||||
f { it * 2 }
|
||||
}
|
||||
Reference in New Issue
Block a user