From 5057a18335f38ac55714bef9bce4863b4c7ad9e9 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..aa4f5f17433cb 100644 --- a/scanner/src/main/kotlin/ScanContext.kt +++ b/scanner/src/main/kotlin/ScanContext.kt @@ -24,6 +24,7 @@ import org.ossreviewtoolkit.model.OrtResult import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.PackageType import org.ossreviewtoolkit.model.config.Excludes +import org.ossreviewtoolkit.model.config.PackageSnippetChoice import org.ossreviewtoolkit.model.config.ScannerConfiguration 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 [PackageSnippetChoice] of the project to scan. + */ + val packageSnippetChoices: List = emptyList() ) diff --git a/scanner/src/main/kotlin/Scanner.kt b/scanner/src/main/kotlin/Scanner.kt index 594d1543a319f..f125d91119c5a 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, + packageSnippetChoices = ortResult.repository.config.packageSnippetChoices ) ) @@ -127,7 +128,8 @@ class Scanner( ortResult.labels, PackageType.PACKAGE, ortResult.repository.config.excludes, - scannerConfig.detectedLicenseMapping + scannerConfig.detectedLicenseMapping, + packageSnippetChoices = ortResult.repository.config.packageSnippetChoices ) )