Fix bugs causing early task evaluation (#1812)

* Fix bugs causing early task evaluation

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Fix merge mistakes

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Fix another call forcing tasks evaluation  Add a test for lazy tasks
This commit is contained in:
Alex Saveau
2018-10-08 04:07:22 -07:00
committed by Sergey Igushkin
parent b7d0d20739
commit 524ae9df7d
6 changed files with 48 additions and 24 deletions
@@ -861,4 +861,31 @@ class KotlinGradleIT : BaseGradleIT() {
expectedKotlinDirs.forEach { assertTrue(it in reportedSrcDirs, "$it should be included into the Java source sets") }
}
}
@Test
fun testNoTaskConfigurationForcing() {
val gradleVersionRequirement = GradleVersionRequired.AtLeast("4.9")
val projects = listOf(
Project("simpleProject", gradleVersionRequirement),
Project("kotlin2JsNoOutputFileProject", gradleVersionRequirement),
Project("sample-app", gradleVersionRequirement, "new-mpp-lib-and-app")
)
projects.forEach {
it.apply {
setupWorkingDir()
val taskConfigureFlag = "Configured the task!"
gradleBuildScript().appendText("\n" + """
tasks.register("myTask") { println '$taskConfigureFlag' }
""".trimIndent())
build("help") {
assertSuccessful()
assertNotContains(taskConfigureFlag)
}
}
}
}
}