From 8f907ad32e3efd070617ceeda6baf72cde884470 Mon Sep 17 00:00:00 2001 From: Remco Mokveld Date: Fri, 9 Feb 2024 16:47:44 +0100 Subject: [PATCH] Do not log empty line when unused warnings are not logged --- src/main/kotlin/app/cash/licensee/task.kt | 3 ++- src/test/kotlin/app/cash/licensee/LicenseePluginFixtureTest.kt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/cash/licensee/task.kt b/src/main/kotlin/app/cash/licensee/task.kt index a388e7b6..84ebbf84 100644 --- a/src/main/kotlin/app/cash/licensee/task.kt +++ b/src/main/kotlin/app/cash/licensee/task.kt @@ -308,7 +308,8 @@ abstract class LicenseeTask : DefaultTask() { if (validationResult.configResults.isNotEmpty() && validationResult.artifactResults.isNotEmpty()) { validationReport.appendLine() // We know these are always at warning or error level, so use lifecycle for space. - logger.log(lifecycleLevel, "") + if (unusedWarningLevel > INFO || unusedErrorLevel > INFO || logger.isInfoEnabled) + logger.log(lifecycleLevel, "") } for ((artifactDetail, results) in validationResult.artifactResults) { val coordinateHeader = buildString { diff --git a/src/test/kotlin/app/cash/licensee/LicenseePluginFixtureTest.kt b/src/test/kotlin/app/cash/licensee/LicenseePluginFixtureTest.kt index b3b9ab85..279991d9 100644 --- a/src/test/kotlin/app/cash/licensee/LicenseePluginFixtureTest.kt +++ b/src/test/kotlin/app/cash/licensee/LicenseePluginFixtureTest.kt @@ -263,6 +263,7 @@ class LicenseePluginFixtureTest { |WARNING: Allowed .*? is unused """.trimMargin(), ) + assertThat(result.output).doesNotContainMatch("""\n\n> Task :licensee""") } @Test fun unusedWarn(