Native: don't treat any compiler test task as up-to-date

There are number of problems with up-to-date checks in tests, leading to
a test binary not being rebuilt or rerun when a developer expects it to.

Things became worse after updating to Gradle 7+:
test binary run tasks are considered up-to-date if the test data
has been changed, even after clean.

Even before Gradle 7+, we've observed other similar undesirable effects:
for example, if the compiler has been changed, tasks building
test binaries are still up-to-date.

There are quite a lot of different tasks related to running the tests
for Native, many of them are misused and thus don't do what we expect.
Carefully fixing each particular kind seems counterproductive and
unreliable.

So instead workaround all possible similar problems by forcing all tasks
in the :kotlin-native:backend.native:tests project to be not up-to-date.

This project should contain only test tasks, so this workaround
seems pretty natural -- it is just "tests aren't up-to-date".
This commit is contained in:
Svyatoslav Scherbina
2021-10-26 18:32:26 +03:00
committed by Space
parent d5bf99f80c
commit c929404fa4
@@ -6005,4 +6005,14 @@ if (UtilsKt.supportsRunningTestsOnDevice(target)) {
.configureEach { it.enabled = false }
}
project.afterEvaluate {
// Don't treat any task as up-to-date, no matter what.
// Note: this project should contain only test tasks, including ones that build binaries,
// and ones that run binaries.
// So the configuration below mostly means "tests aren't up-to-date".
tasks.configureEach {
outputs.upToDateWhen { false }
}
}