diff --git a/evaluator/src/main/kotlin/ProjectSourceRule.kt b/evaluator/src/main/kotlin/ProjectSourceRule.kt index de06cd9e3a692..e390cb0835218 100644 --- a/evaluator/src/main/kotlin/ProjectSourceRule.kt +++ b/evaluator/src/main/kotlin/ProjectSourceRule.kt @@ -91,7 +91,7 @@ open class ProjectSourceRule( /** * Return the [VcsType] of the project's code repository. */ - fun projectSourceGetVcsType(): VcsType = ortResult.repository.vcsProcessed().type + fun projectSourceGetVcsType(): VcsType = ortResult.repository.vcsProcessed.type /** * Return the file paths matching any of the given [glob expressions][patterns] with its file content matching diff --git a/evaluator/src/main/kotlin/RuleSet.kt b/evaluator/src/main/kotlin/RuleSet.kt index 259559489840d..d90f3f2991a5d 100644 --- a/evaluator/src/main/kotlin/RuleSet.kt +++ b/evaluator/src/main/kotlin/RuleSet.kt @@ -159,7 +159,7 @@ fun ruleSet( licenseInfoResolver: LicenseInfoResolver = ortResult.createLicenseInfoResolver(), resolutionProvider: ResolutionProvider = DefaultResolutionProvider.create(), projectSourceResolver: SourceTreeResolver = SourceTreeResolver.forRemoteRepository( - ortResult.repository.vcsProcessed() + ortResult.repository.vcsProcessed ), configure: RuleSet.() -> Unit = { } ) = RuleSet(ortResult, licenseInfoResolver, resolutionProvider, projectSourceResolver).apply(configure) diff --git a/helper-cli/src/main/kotlin/utils/Extensions.kt b/helper-cli/src/main/kotlin/utils/Extensions.kt index 073d62e46e402..4d618d0f84eb0 100644 --- a/helper-cli/src/main/kotlin/utils/Extensions.kt +++ b/helper-cli/src/main/kotlin/utils/Extensions.kt @@ -691,7 +691,7 @@ internal fun OrtResult.getScanResultFor(packageConfiguration: PackageConfigurati * tree. */ internal fun OrtResult.getRepositoryPaths(): Map> { - val result = mutableMapOf(repository.vcsProcessed().url to mutableSetOf("")) + val result = mutableMapOf(repository.vcsProcessed.url to mutableSetOf("")) repository.nestedRepositories.mapValues { (path, provenance) -> if (provenance is RepositoryProvenance) { diff --git a/model/src/main/kotlin/Repository.kt b/model/src/main/kotlin/Repository.kt index 1a1ce0fb18fe6..a2468e50571e6 100644 --- a/model/src/main/kotlin/Repository.kt +++ b/model/src/main/kotlin/Repository.kt @@ -19,6 +19,7 @@ package org.ossreviewtoolkit.model +import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.annotation.JsonInclude import org.ossreviewtoolkit.model.config.RepositoryConfiguration @@ -57,14 +58,18 @@ data class Repository( ) } - fun vcs(): VcsInfo { - if (provenance is RepositoryProvenance) { return provenance.vcsInfo } - return VcsInfo.EMPTY + @JsonIgnore + val vcs = if (provenance is RepositoryProvenance) { + provenance.vcsInfo + } else { + VcsInfo.EMPTY } - fun vcsProcessed(): VcsInfo { - if (provenance is RepositoryProvenance) { return provenance.vcsInfo.normalize() } - return VcsInfo.EMPTY + @JsonIgnore + val vcsProcessed = if (provenance is RepositoryProvenance) { + provenance.vcsInfo.normalize() + } else { + VcsInfo.EMPTY } /** diff --git a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt index c98d7332bf601..575262be12551 100644 --- a/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt +++ b/plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt @@ -186,7 +186,7 @@ class CycloneDxReporter : Reporter { // distributable), just create a single BOM for all projects in that case for now. As there also is no // single correct project to pick for adding external references in that case, simply only use the global // repository VCS information here. - val vcs = input.ortResult.repository.vcsProcessed() + val vcs = input.ortResult.repository.vcsProcessed bom.addExternalReference( ExternalReference.Type.VCS, vcs.url, diff --git a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt index d3b1521827e79..a89dfc699f5ca 100644 --- a/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt +++ b/plugins/reporters/opossum/src/main/kotlin/OpossumReporter.kt @@ -499,7 +499,7 @@ class OpossumReporter : Reporter { internal fun generateOpossumInput(input: ReporterInput, maxDepth: Int = Int.MAX_VALUE): OpossumInput { val opossumInput = OpossumInput() - opossumInput.addBaseUrl("/", input.ortResult.repository.vcs()) + opossumInput.addBaseUrl("/", input.ortResult.repository.vcs) SpdxLicense.entries.forEach { val licenseText = input.licenseTextProvider.getLicenseText(it.id) diff --git a/plugins/reporters/static-html/src/main/kotlin/TablesReportModelMapper.kt b/plugins/reporters/static-html/src/main/kotlin/TablesReportModelMapper.kt index da98cdb496203..bcb13dc0c0b7a 100644 --- a/plugins/reporters/static-html/src/main/kotlin/TablesReportModelMapper.kt +++ b/plugins/reporters/static-html/src/main/kotlin/TablesReportModelMapper.kt @@ -48,7 +48,7 @@ internal object TablesReportModelMapper { .sortedBy { it.id } return TablesReport( - input.ortResult.repository.vcsProcessed(), + input.ortResult.repository.vcsProcessed, input.ortResult.repository.config, ruleViolations, getAnalyzerIssueSummaryTable(input),