From 2eb0151d5b2b54aeb0a2e834fcd964543de18e3d Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 16 Apr 2024 16:22:13 +0200 Subject: [PATCH] chore(commands): Only show once where the results has been written to Deduplicate a bit of console output when running with `--info`. Signed-off-by: Sebastian Schuberth --- cli/src/funTest/kotlin/OrtMainFunTest.kt | 2 +- plugins/commands/api/src/main/kotlin/utils/Extensions.kt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/src/funTest/kotlin/OrtMainFunTest.kt b/cli/src/funTest/kotlin/OrtMainFunTest.kt index a5d7e1c72bd24..290f30367cb53 100644 --- a/cli/src/funTest/kotlin/OrtMainFunTest.kt +++ b/cli/src/funTest/kotlin/OrtMainFunTest.kt @@ -200,7 +200,7 @@ class OrtMainFunTest : StringSpec() { ) val stdout = result.stdout.lineSequence() - val lines = stdout.filter { it.startsWith("Writing analyzer result to ") } + val lines = stdout.filter { it.startsWith("Wrote analyzer result to ") } withClue(result.stderr) { lines.count() shouldBe 2 diff --git a/plugins/commands/api/src/main/kotlin/utils/Extensions.kt b/plugins/commands/api/src/main/kotlin/utils/Extensions.kt index 722e057c4ecbe..822a189e1365f 100644 --- a/plugins/commands/api/src/main/kotlin/utils/Extensions.kt +++ b/plugins/commands/api/src/main/kotlin/utils/Extensions.kt @@ -65,11 +65,9 @@ fun readOrtResult(ortFile: File): OrtResult { fun writeOrtResult(ortResult: OrtResult, outputFiles: Collection, terminal: Terminal) { outputFiles.forEach { file -> val resultName = file.name.substringBefore('-') - terminal.println("Writing $resultName result to '$file'.") - val duration = measureTime { file.writeValue(ortResult) } - logger.info { "Wrote ORT result to '${file.name}' (${file.formatSizeInMib}) in $duration." } + terminal.println("Wrote $resultName result to '$file' (${file.formatSizeInMib}) in $duration.") logger.debug { "Output ORT result file has SHA-1 hash ${HashAlgorithm.SHA1.calculate(file)}." } }