From 967e798c1079339a976641648fd264a4693dd200 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 23 Nov 2024 13:57:39 +0100 Subject: [PATCH] Avoid trying to generate HTML reports when no tests have been run --- documentation/documentation.gradle.kts | 1 + .../main/kotlin/junitbuild.testing-conventions.gradle.kts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 2f1cff759cd1..45a5e949bdbd 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -176,6 +176,7 @@ tasks { generateOpenTestHtmlReport { mustRunAfter(consoleLauncherTest) + inputs.files(consoleLauncherTestEventXmlFiles).withPathSensitivity(RELATIVE).skipWhenEmpty() argumentProviders += CommandLineArgumentProvider { consoleLauncherTestEventXmlFiles.files.map { it.absolutePath }.toList() } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 882c0f8cbbf1..e87b590297d7 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -1,7 +1,7 @@ import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode -import org.gradle.api.tasks.PathSensitivity.NONE +import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem @@ -41,7 +41,8 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { abstract class HtmlReportParameters : CommandLineArgumentProvider { @get:InputFiles - @get:PathSensitive(NONE) + @get:PathSensitive(RELATIVE) + @get:SkipWhenEmpty abstract val eventXmlFiles: ConfigurableFileCollection @get:OutputFile