From 35b123005fb9190834902a5d46fb33d32dd00ef0 Mon Sep 17 00:00:00 2001 From: Yogesh Ananda Nikam Date: Thu, 9 May 2024 00:44:00 +0530 Subject: [PATCH] Improve logging in backwardCompatibilityCheck command --- .../BackwardCompatibilityCheckCommand.kt | 26 ++++++++++++------- version.properties | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/application/src/main/kotlin/application/BackwardCompatibilityCheckCommand.kt b/application/src/main/kotlin/application/BackwardCompatibilityCheckCommand.kt index 578b2e444..5be20a83e 100644 --- a/application/src/main/kotlin/application/BackwardCompatibilityCheckCommand.kt +++ b/application/src/main/kotlin/application/BackwardCompatibilityCheckCommand.kt @@ -27,10 +27,11 @@ class BackwardCompatibilityCheckCommand( File(it).extension in CONTRACT_EXTENSIONS }.filter { File(it).exists() && File(it).readText().contains(Regex("openapi")) }.toSet() - val filesToCheck: Set = - filesChangedInCurrentBranch + filesReferringToChangedSchemaFiles(filesChangedInCurrentBranch) + val filesReferringToChangedSchemaFiles = filesReferringToChangedSchemaFiles(filesChangedInCurrentBranch) - logFilesToBeCheckedForBackwardCompatibility(filesToCheck) + val filesToCheck: Set = filesChangedInCurrentBranch + filesReferringToChangedSchemaFiles + + logFilesToBeCheckedForBackwardCompatibility(filesChangedInCurrentBranch, filesReferringToChangedSchemaFiles) val result = runBackwardCompatibilityCheckFor(filesToCheck) @@ -39,7 +40,7 @@ class BackwardCompatibilityCheckCommand( if(result == FAILED) { exitWithMessage("Verdict: FAIL, backward incompatible changes were found.") } else { - println("Verdict: PASS, all changes were backward incompatible") + println("Verdict: PASS, all changes were backward compatible") } } @@ -74,11 +75,11 @@ class BackwardCompatibilityCheckCommand( val backwardCompatibilityResult = testBackwardCompatibility(older, newer) if (backwardCompatibilityResult.success()) { - println("The change to $specFilePath is backward compatible.") + println("The file $specFilePath is backward compatible.") println() SUCCESS } else { - println("*** The change to $specFilePath is NOT backward compatible. ***") + println("*** The file $specFilePath is NOT backward compatible. ***") println() FAILED } @@ -90,13 +91,20 @@ class BackwardCompatibilityCheckCommand( } } - private fun logFilesToBeCheckedForBackwardCompatibility(files : Set) { - println("Checking backward compatibility of the following files: ") - files.forEach { println(it) } + private fun logFilesToBeCheckedForBackwardCompatibility(changedFiles : Set, filesReferringToChangedFiles: Set) { + println("Checking backward compatibility of the following files: \n") + println("Files that have changed - ") + changedFiles.forEach { println(it) } + println() + println("Files referring to the changed files - ") + filesReferringToChangedFiles.forEach { println(it) } + println() + println("-".repeat(20)) println() } + private fun filesReferringToChangedSchemaFiles(schemaFiles : Set): Set { if(schemaFiles.isEmpty()) return emptySet() diff --git a/version.properties b/version.properties index 1397e23b5..eddf1020a 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=1.3.15 +version=1.3.16