Add a test for project.buildDir lazy evaluation

(cherry picked from commit ab0f9cd)
This commit is contained in:
Sergey Igushkin
2017-06-27 19:32:52 +03:00
parent b2cdb0d63d
commit a9cad7f112
@@ -1,6 +1,7 @@
package org.jetbrains.kotlin.gradle
import org.jetbrains.kotlin.gradle.util.checkBytecodeContains
import org.jetbrains.kotlin.gradle.util.modify
import org.junit.Test
import java.io.File
import kotlin.test.assertTrue
@@ -170,4 +171,23 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
assertSuccessful()
}
}
@Test
fun testBuildDirLazyEvaluation() {
val project = Project("kotlinProject", GRADLE_VERSION)
project.setupWorkingDir()
File(project.projectDir, "build").writeText("This file prevents Gradle from using 'build' as a directory")
// Change the build directory in the end of the build script:
val customBuildDirName = "customBuild"
File(project.projectDir, "build.gradle").modify {
it + "\nbuildDir = '$customBuildDirName'\n"
}
project.build("build") {
assertSuccessful()
assertFileExists("$customBuildDirName/classes")
}
}
}