Skip to content

Commit

Permalink
refactor(evalutator-command): Include package configs in input OrtResult
Browse files Browse the repository at this point in the history
Retrieve all package configurations from the provider earlier and only
once instead of twice, and integrate them into the input `OrtResult`
before passing the `OrtResult` to the evaluator. This obviously makes
it unnecessary to pass the `PackageConfigurationProvider` to the
evaluator and prepares for removing the corresponding parameters.

Until then, just pass the `OrtResult` as package configuration
provider, to avoid resolving the package configurations again.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Jan 16, 2024
1 parent 7754349 commit 2bf0203
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,15 @@ class EvaluatorCommand : OrtCommand(
val packageConfigurationProvider =
CompositePackageConfigurationProvider(*enabledPackageConfigurationProviders.toTypedArray())

ortResultInput = ortResultInput.setPackageConfigurations(packageConfigurationProvider)

val copyrightGarbage = copyrightGarbageFile.takeIf { it.isFile }?.readValue<CopyrightGarbage>().orEmpty()

val licenseInfoResolver = LicenseInfoResolver(
provider = DefaultLicenseInfoProvider(ortResultInput, packageConfigurationProvider),
provider = DefaultLicenseInfoProvider(
ortResult = ortResultInput,
packageConfigurationProvider = ortResultInput
),
copyrightGarbage = copyrightGarbage,
addAuthorsToCopyrights = ortConfig.addAuthorsToCopyrights,
archiver = ortConfig.scanner.archive.createFileArchiver(),
Expand All @@ -325,7 +330,6 @@ class EvaluatorCommand : OrtCommand(
// Note: This overwrites any existing EvaluatorRun from the input file.
val ortResultOutput = ortResultInput.copy(evaluator = evaluatorRun)
.mergeLabels(labels)
.setPackageConfigurations(packageConfigurationProvider)
.setResolutions(resolutionProvider)

outputDir?.let { absoluteOutputDir ->
Expand Down

0 comments on commit 2bf0203

Please sign in to comment.