From c929404fa444e20c3158afc2ccf6e8c487c447a6 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 26 Oct 2021 18:32:26 +0300 Subject: [PATCH] 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". --- kotlin-native/backend.native/tests/build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 9a670e74e11..279ccf8007a 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -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 } + } +} +