From 3d163d9231c5051e64b82a9d2e8c2e27d577a2f6 Mon Sep 17 00:00:00 2001 From: Nicolas Nobelis Date: Mon, 12 Feb 2024 11:02:39 +0100 Subject: [PATCH] feat(scanner): Expose the snippet choices to the scanner Signed-off-by: Nicolas Nobelis --- scanner/src/main/kotlin/ScanContext.kt | 8 +++++++- scanner/src/main/kotlin/Scanner.kt | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scanner/src/main/kotlin/ScanContext.kt b/scanner/src/main/kotlin/ScanContext.kt index 4f37dd963d857..4959282410718 100644 --- a/scanner/src/main/kotlin/ScanContext.kt +++ b/scanner/src/main/kotlin/ScanContext.kt @@ -25,6 +25,7 @@ import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.PackageType import org.ossreviewtoolkit.model.config.Excludes import org.ossreviewtoolkit.model.config.ScannerConfiguration +import org.ossreviewtoolkit.model.config.SnippetChoices import org.ossreviewtoolkit.utils.spdx.SpdxExpression /** @@ -60,5 +61,10 @@ data class ScanContext( * The packages known to be covered in the context of this scan. For package scanners, this is the list of packages * that have the same provenance as the reference package. */ - val coveredPackages: List = emptyList() + val coveredPackages: List = emptyList(), + + /** + * The [SnippetChoices] of the project to scan. + */ + val snippetChoices: List = emptyList() ) diff --git a/scanner/src/main/kotlin/Scanner.kt b/scanner/src/main/kotlin/Scanner.kt index 594d1543a319f..0abb797769d60 100644 --- a/scanner/src/main/kotlin/Scanner.kt +++ b/scanner/src/main/kotlin/Scanner.kt @@ -115,7 +115,8 @@ class Scanner( ortResult.labels + labels, PackageType.PROJECT, ortResult.repository.config.excludes, - scannerConfig.detectedLicenseMapping + scannerConfig.detectedLicenseMapping, + snippetChoices = ortResult.repository.config.snippetChoices ) ) @@ -127,7 +128,8 @@ class Scanner( ortResult.labels, PackageType.PACKAGE, ortResult.repository.config.excludes, - scannerConfig.detectedLicenseMapping + scannerConfig.detectedLicenseMapping, + snippetChoices = ortResult.repository.config.snippetChoices ) )