From 2c981224099d3c6f365f3f5db81037f378364d2e Mon Sep 17 00:00:00 2001 From: ekrivobokov Date: Mon, 14 Feb 2022 14:06:49 +0300 Subject: [PATCH 1/2] MBS-12612 Add tests for Kotlin fallback detector --- .../PreventKotlinDaemonFallbackTest.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/subprojects/assemble/build-checks/src/gradleTest/kotlin/com/avito/android/build_checks/kotlin_daemon/PreventKotlinDaemonFallbackTest.kt b/subprojects/assemble/build-checks/src/gradleTest/kotlin/com/avito/android/build_checks/kotlin_daemon/PreventKotlinDaemonFallbackTest.kt index b2bf0c9594..260c26f22c 100644 --- a/subprojects/assemble/build-checks/src/gradleTest/kotlin/com/avito/android/build_checks/kotlin_daemon/PreventKotlinDaemonFallbackTest.kt +++ b/subprojects/assemble/build-checks/src/gradleTest/kotlin/com/avito/android/build_checks/kotlin_daemon/PreventKotlinDaemonFallbackTest.kt @@ -28,6 +28,16 @@ internal class PreventKotlinDaemonFallbackTest { .outputContains("Could not connect to kotlin daemon. Using fallback strategy.") } + @Test + fun `disabled check without daemon strategy - no fallback strategy`() { + generateProject(enableCheck = false) + val result = build(":lib1:compileKotlin", "-Dkotlin.compiler.execution.strategy=in-process") + + result.assertThat() + .buildSuccessful() + .outputDoesNotContain("Could not connect to kotlin daemon. Using fallback strategy.") + } + @Test fun `single fallback - success`() { generateProject(enableCheck = true) @@ -68,11 +78,11 @@ internal class PreventKotlinDaemonFallbackTest { } private fun build( - task: String, + vararg args: String, expectFailure: Boolean = false ) = gradlew( projectDir, - task, + *args, "-Dkotlin.daemon.jvm.options=invalid_jvm_argument_to_fail_process_startup", "--rerun-tasks", expectFailure = expectFailure From 7abc532949d49ff6dea5f570b6e2b97190077f4a Mon Sep 17 00:00:00 2001 From: ekrivobokov Date: Mon, 14 Feb 2022 14:06:59 +0300 Subject: [PATCH 2/2] MBS-12612 Fix log level --- .../internal/kotlin_daemon/KotlinDaemonFallbackDetector.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/assemble/build-checks/src/main/kotlin/com/avito/android/build_checks/internal/kotlin_daemon/KotlinDaemonFallbackDetector.kt b/subprojects/assemble/build-checks/src/main/kotlin/com/avito/android/build_checks/internal/kotlin_daemon/KotlinDaemonFallbackDetector.kt index a4c0de790e..2a8c555c33 100644 --- a/subprojects/assemble/build-checks/src/main/kotlin/com/avito/android/build_checks/internal/kotlin_daemon/KotlinDaemonFallbackDetector.kt +++ b/subprojects/assemble/build-checks/src/main/kotlin/com/avito/android/build_checks/internal/kotlin_daemon/KotlinDaemonFallbackDetector.kt @@ -9,7 +9,7 @@ internal class KotlinDaemonFallbackDetector { fun register(project: Project) { if (isDaemonDisabled(project)) { - project.logger.debug("Kotlin daemon fallback detection is disabled due to absence of daemon") + project.logger.lifecycle("Kotlin daemon fallback detection is disabled due to absence of daemon") return } val fallbacksCounter = AtomicInteger(0)