[Gradle] Do not register compilation outputs in clean task
Calculations of compilation outputs implicitly requires compile task configuration to execute `clean` task. This implicit configuration works unstable in parallel builds. We probably fine with the fact that outputs that are configured to be outside of build directory will not be cleaned by `clean` task #KT-48046 Fixed
This commit is contained in:
committed by
Space
parent
f0aba5e892
commit
a0e6fb03f0
-31
@@ -1416,37 +1416,6 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testStaleOutputCleanup() = with(Project("new-mpp-lib-with-tests", gradleVersion)) {
|
||||
setupWorkingDir()
|
||||
// Check that output directories of Kotlin compilations are registered for Gradle stale outputs cleanup.
|
||||
// One way to check that is to run a Gradle build with no Gradle history (no .gradle directory) and see that the compilation
|
||||
// output directories are cleaned up, even those outside the project's buildDir
|
||||
|
||||
gradleBuildScript().appendText(
|
||||
"\n" + """
|
||||
kotlin.targets.js.compilations.main.output.classesDirs.from("foo") // should affect Gradle's behavior wrt stale output cleanup
|
||||
task('foo') {
|
||||
outputs.dir("foo")
|
||||
doFirst {
|
||||
println 'hello'
|
||||
file("foo/2.txt").text = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
val staleFilePath = "foo/1.txt"
|
||||
projectDir.resolve(staleFilePath).run { parentFile.mkdirs(); createNewFile() }
|
||||
|
||||
build("foo") {
|
||||
assertSuccessful()
|
||||
assertNoSuchFile(staleFilePath)
|
||||
assertFileExists("foo/2.txt")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDefaultSourceSetsDsl() = with(Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
|
||||
setupWorkingDir()
|
||||
|
||||
Reference in New Issue
Block a user