From 2df66b350c2ad1554aa9ca128f761d1bcce4a15b Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Tue, 15 Oct 2024 22:30:35 +0200 Subject: [PATCH] Added application plugin for validation --- csaf-validation/build.gradle.kts | 5 +++++ .../kotlin/io/github/csaf/sbom/validation/tests/Tests.kt | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/csaf-validation/build.gradle.kts b/csaf-validation/build.gradle.kts index 9a70e3a9..036c8c71 100644 --- a/csaf-validation/build.gradle.kts +++ b/csaf-validation/build.gradle.kts @@ -1,5 +1,10 @@ plugins { id("buildlogic.kotlin-library-conventions") + application +} + +application { + mainClass = "io.github.csaf.sbom.validation.MainKt" } mavenPublishing { diff --git a/csaf-validation/src/main/kotlin/io/github/csaf/sbom/validation/tests/Tests.kt b/csaf-validation/src/main/kotlin/io/github/csaf/sbom/validation/tests/Tests.kt index b3cedac6..a5d35380 100644 --- a/csaf-validation/src/main/kotlin/io/github/csaf/sbom/validation/tests/Tests.kt +++ b/csaf-validation/src/main/kotlin/io/github/csaf/sbom/validation/tests/Tests.kt @@ -27,6 +27,10 @@ object Test611MissingDefinitionOfProductID : Test { val definitions = doc.product_tree?.gatherProductIds() ?: setOf() val references = gatherProductReferences(doc) + println( + "Gathered ${definitions.size} product ID definitions and ${references.size} product ID references" + ) + val notDefined = references.subtract(definitions) return if (notDefined.isEmpty()) { @@ -44,6 +48,10 @@ object Test621UnusedDefinitionOfProductID : Test { val definitions = doc.product_tree?.gatherProductIds() ?: setOf() val references = gatherProductReferences(doc) + println( + "Gathered ${definitions.size} product ID definitions and ${references.size} product ID references" + ) + val notUsed = definitions.subtract(references) return if (notUsed.isEmpty()) { ValidationSuccessful