From 73f851a269686b87115807ee53c47629e1636bad Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Thu, 20 Jun 2024 15:19:14 +0200 Subject: [PATCH 1/4] refactor(VcsInfo): Replace `matches` method with `equalsDisregardingPath` Up until now the method `VcsInfo.matches(VcsInfo)` was only defined and used inside the `Repository` class. With shifting from `VcsInfo` to `RepositoryProvenance`, the matcher needs to be available inside of `RepositoryProvenance`. For that purpose, it gets moved into `VcsInfo` proper, in order to be available anywhere `VcsInfo` is used. It further gets a new name `equalsDisregardingPath`, since it disregards the path, when matching `VcsInfo`s. [1] [1] https://github.com/oss-review-toolkit/ort/pull/8764/commits/9d271b5ff4b8c925da070b31669a0d67dbd574ad#r1655333611 Signed-off-by: Jens Keim --- model/src/main/kotlin/Repository.kt | 8 ++++---- model/src/main/kotlin/VcsInfo.kt | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/model/src/main/kotlin/Repository.kt b/model/src/main/kotlin/Repository.kt index 480cb869613bd..3e9fa8c305865 100644 --- a/model/src/main/kotlin/Repository.kt +++ b/model/src/main/kotlin/Repository.kt @@ -69,12 +69,12 @@ data class Repository( * in [nestedRepositories]. */ fun getRelativePath(vcs: VcsInfo): String? { - fun VcsInfo.matches(other: VcsInfo) = type == other.type && url == other.url && revision == other.revision - val normalizedVcs = vcs.normalize() - if (vcsProcessed.matches(normalizedVcs)) return "" + if (vcsProcessed.equalsDisregardingPath(normalizedVcs)) return "" - return nestedRepositories.entries.find { (_, nestedVcs) -> nestedVcs.normalize().matches(normalizedVcs) }?.key + return nestedRepositories.entries.find { (_, nestedVcs) -> + nestedVcs.normalize().equalsDisregardingPath(normalizedVcs) + }?.key } } diff --git a/model/src/main/kotlin/VcsInfo.kt b/model/src/main/kotlin/VcsInfo.kt index 62342f06eddcd..3e8bd8050e3c5 100644 --- a/model/src/main/kotlin/VcsInfo.kt +++ b/model/src/main/kotlin/VcsInfo.kt @@ -83,6 +83,11 @@ data class VcsInfo( * Return a [VcsInfoCurationData] with the properties from this [VcsInfo]. */ fun toCuration() = VcsInfoCurationData(type, url, revision, path) + + /** + * Return true if this [VcsInfo] equals the given [VcsInfo][other], disregarding the path. + */ + fun equalsDisregardingPath(other: VcsInfo) = type == other.type && url == other.url && revision == other.revision } /** From 9ffaeb046346892d3a94ccdabd47d93ac27f3250 Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Wed, 12 Jun 2024 17:02:57 +0200 Subject: [PATCH 2/4] feat(Provenance): Add `matches(Provenance)` method In preparation of replacing `VcsInfo` in `Repository` with `KnownProvenance`, a method to match `Provenance` against each other was added. This inherited method, allows any `Provenace` to be matched against any other. Since the type is verified to be equal before matching any attributes, it can even match against `UnknownProvenance`, no need to limit it to `KnownProvenance`. Signed-off-by: Jens Keim --- model/src/main/kotlin/Provenance.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/model/src/main/kotlin/Provenance.kt b/model/src/main/kotlin/Provenance.kt index 42d6174fd6881..93aea58ca0df0 100644 --- a/model/src/main/kotlin/Provenance.kt +++ b/model/src/main/kotlin/Provenance.kt @@ -35,10 +35,16 @@ sealed interface Provenance { * True if this [Provenance] refers to the same source code as [pkg], assuming that it belongs to the package id. */ fun matches(pkg: Package): Boolean + + /** + * True if this [Provenance] matches the [Provenance][other] both in type and attributes. + */ + fun matches(other: Provenance): Boolean } data object UnknownProvenance : Provenance { override fun matches(pkg: Package): Boolean = false + override fun matches(other: Provenance): Boolean = false } sealed interface KnownProvenance : Provenance @@ -53,6 +59,8 @@ data class ArtifactProvenance( val sourceArtifact: RemoteArtifact ) : KnownProvenance { override fun matches(pkg: Package): Boolean = sourceArtifact == pkg.sourceArtifact + override fun matches(other: Provenance): Boolean = + other is ArtifactProvenance && sourceArtifact == other.sourceArtifact } /** @@ -79,6 +87,14 @@ data class RepositoryProvenance( * Return true if this provenance matches the processed VCS information of the [package][pkg]. */ override fun matches(pkg: Package): Boolean = vcsInfo == pkg.vcsProcessed + + /** + * Return true if the [Provenance][other] is a [RepositoryProvenance] and its normalized vcsInfo matches this + * provenance's normalized [VcsInfo][vcsInfo]. + */ + override fun matches(other: Provenance): Boolean = + other is RepositoryProvenance && resolvedRevision == other.resolvedRevision && + other.vcsInfo.normalize().equalsDisregardingPath(vcsInfo.normalize()) } /** From 7969f0b1fc8b75550e61acc52bd896284826d47b Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Tue, 18 Jun 2024 16:29:07 +0200 Subject: [PATCH 3/4] refactor(Provenance): Allow blank `resolvedRevision` for `VcsInfo.EMPTY` This will allow tests using `Repository` objects with `VcsInfo.EMPTY` to continue to function, even though `RepositoryProvenance` does not usually allow blank revisions. By restricting the exception to `VcsInfo.EMPTY` any other behavior of `RepositoryProvenance` should be retained. Some unrelated `OrtResultTest`s had to be given non-blank revisions: Both test cases `"fail if no vcs matches"` and `"use the correct vcs"` don't hinge on the given blank revision, so to assure they do not fail for unrelated reasons, the default Git revision "main" was added to the example repos. Signed-off-by: Jens Keim --- model/src/main/kotlin/Provenance.kt | 4 +++- model/src/test/kotlin/OrtResultTest.kt | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/model/src/main/kotlin/Provenance.kt b/model/src/main/kotlin/Provenance.kt index 93aea58ca0df0..bb7d0f9af6e3d 100644 --- a/model/src/main/kotlin/Provenance.kt +++ b/model/src/main/kotlin/Provenance.kt @@ -80,7 +80,9 @@ data class RepositoryProvenance( val resolvedRevision: String ) : KnownProvenance { init { - require(resolvedRevision.isNotBlank()) { "The resolved revision must not be blank." } + require(resolvedRevision.isNotBlank() || vcsInfo == VcsInfo.EMPTY) { + "The resolved revision must not be blank." + } } /** diff --git a/model/src/test/kotlin/OrtResultTest.kt b/model/src/test/kotlin/OrtResultTest.kt index c5065a38cd65a..a514d4e351908 100644 --- a/model/src/test/kotlin/OrtResultTest.kt +++ b/model/src/test/kotlin/OrtResultTest.kt @@ -83,9 +83,9 @@ class OrtResultTest : WordSpec({ "getDefinitionFilePathRelativeToAnalyzerRoot()" should { "use the correct vcs" { - val vcs = VcsInfo(type = VcsType.GIT, url = "https://example.com/git", revision = "") - val nestedVcs1 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git1", revision = "") - val nestedVcs2 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git2", revision = "") + val vcs = VcsInfo(type = VcsType.GIT, url = "https://example.com/git", revision = "main") + val nestedVcs1 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git1", revision = "main") + val nestedVcs2 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git2", revision = "main") val project1 = Project.EMPTY.copy( id = Identifier("Gradle:org.ossreviewtoolkit:project1:1.0"), definitionFilePath = "project1/build.gradle", @@ -123,9 +123,9 @@ class OrtResultTest : WordSpec({ } "fail if no vcs matches" { - val vcs = VcsInfo(type = VcsType.GIT, url = "https://example.com/git", revision = "") - val nestedVcs1 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git1", revision = "") - val nestedVcs2 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git2", revision = "") + val vcs = VcsInfo(type = VcsType.GIT, url = "https://example.com/git", revision = "main") + val nestedVcs1 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git1", revision = "main") + val nestedVcs2 = VcsInfo(type = VcsType.GIT, url = "https://example.com/git2", revision = "main") val project = Project.EMPTY.copy( id = Identifier("Gradle:org.ossreviewtoolkit:project1:1.0"), definitionFilePath = "build.gradle", From ba2a2a28dd39d349d109cff06ed82987fa9d0350 Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Thu, 13 Jun 2024 16:32:47 +0200 Subject: [PATCH 4/4] feat(Repository): Use `KnownProvenance` instead of `VcsInfo` In order to allow source artifacts as well as local source code to be scanned, a more generalized `Repository` class is required, which allows any type of `KnownProvenance`. While the signature of the `Repository` class is set to allow any `KnownProvenance` object, this commit focuses on accommodating `RepositoryProvenance` as the main input for now. Therefore `VcsInfo` is wrapped within `RepositoryProvenance`, whenever it is used as input, and unwraped, when it is produced as output. This results in a faster update of the now deprecated code, without the necessity to support all `KnownProvenance` types from the get go. Any related tests are also updated, mostly the expected `OrtResults`, but also some `Repository` definitions and calls. To avoid having `vcs` and `vcsProcessed` appear in the `OrtResult` output, getter properties were created and marked as `@JsonIgnore`. Signed-off-by: Jens Keim --- analyzer/src/main/kotlin/Analyzer.kt | 8 ++++- .../assets/git-repo-expected-output.yml | 17 ++++------ ...dencies-expected-result-with-curations.yml | 17 ++++------ .../funTest/assets/semver4j-ort-result.yml | 17 ++++------ .../src/test/kotlin/ProjectSourceRuleTest.kt | 2 +- evaluator/src/test/kotlin/TestData.kt | 3 +- ...r-result-from-pkg-list-expected-output.yml | 17 ++++------ ...ateAnalyzerResultFromPackageListCommand.kt | 3 +- model/src/main/kotlin/Repository.kt | 32 ++++++++++++------- .../analyzer-result-with-dependency-graph.yml | 17 ++++------ ...radle-all-dependencies-expected-result.yml | 17 ++++------ .../assets/result-with-issues-graph-old.yml | 17 ++++------ .../test/assets/result-with-issues-graph.yml | 17 ++++------ .../test/assets/result-with-issues-scopes.yml | 17 ++++------ ...-multi-project-example-expected-output.yml | 17 ++++------ .../sbt-multi-project-example-graph-old.yml | 17 ++++------ .../sbt-multi-project-example-graph.yml | 17 ++++------ model/src/test/kotlin/OrtResultTest.kt | 7 ++-- model/src/test/kotlin/licenses/TestData.kt | 3 +- .../src/test/assets/ort-analyzer-result.yml | 17 ++++------ .../assets/semver4j-analyzer-result-linux.yml | 17 ++++------ .../semver4j-analyzer-result-windows.yml | 17 ++++------ .../pnpm-workspaces-expected-output.yml | 17 ++++------ ...-multi-project-example-expected-output.yml | 17 ++++------ .../sbt-http4s-template-expected-output.yml | 17 ++++------ ...orter-test-deduplicate-expected-output.yml | 17 ++++------ ...d-model-reporter-test-expected-output.json | 19 +++++------ ...ed-model-reporter-test-expected-output.yml | 17 ++++------ .../funTest/assets/reporter-test-input.yml | 17 ++++------ .../src/test/kotlin/FossIdReporterTest.kt | 19 ++++++----- .../kotlin/FreeMarkerTemplateProcessorTest.kt | 6 ++-- .../funTest/assets/reporter-test-input.yml | 17 ++++------ .../src/test/kotlin/OpossumReporterTest.kt | 7 ++-- .../kotlin/SpdxDocumentReporterFunTest.kt | 7 ++-- .../funTest/assets/reporter-test-input.yml | 17 ++++------ .../scan-result-for-synthetic-gradle-lib.yml | 19 +++++------ reporter/src/testFixtures/kotlin/TestData.kt | 3 +- ...tegration-all-pkgs-expected-ort-result.yml | 17 ++++------ ...ration-subset-pkgs-expected-ort-result.yml | 17 ++++------ website/docs/getting-started/tutorial.md | 17 ++++------ 40 files changed, 261 insertions(+), 319 deletions(-) diff --git a/analyzer/src/main/kotlin/Analyzer.kt b/analyzer/src/main/kotlin/Analyzer.kt index f71ce022c022f..a7f5f3f1ff4d8 100644 --- a/analyzer/src/main/kotlin/Analyzer.kt +++ b/analyzer/src/main/kotlin/Analyzer.kt @@ -42,6 +42,7 @@ import org.ossreviewtoolkit.model.AnalyzerResult import org.ossreviewtoolkit.model.AnalyzerRun import org.ossreviewtoolkit.model.OrtResult import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.config.AnalyzerConfiguration import org.ossreviewtoolkit.model.config.Excludes import org.ossreviewtoolkit.model.config.RepositoryConfiguration @@ -135,11 +136,16 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma val workingTree = VersionControlSystem.forDirectory(info.absoluteProjectPath) val vcs = workingTree?.getInfo().orEmpty() + val revision = workingTree?.getRevision().orEmpty() val nestedVcs = workingTree?.getNested()?.filter { (path, _) -> // Only include nested VCS if they are part of the analyzed directory. workingTree.getRootPath().resolve(path).startsWith(info.absoluteProjectPath) }.orEmpty() - val repository = Repository(vcs = vcs, nestedRepositories = nestedVcs, config = info.repositoryConfiguration) + val repository = Repository( + provenance = RepositoryProvenance(vcs, revision), + nestedRepositories = nestedVcs, + config = info.repositoryConfiguration + ) val endTime = Instant.now() diff --git a/cli/src/funTest/assets/git-repo-expected-output.yml b/cli/src/funTest/assets/git-repo-expected-output.yml index 3b6f280282408..99752a4b2f09a 100644 --- a/cli/src/funTest/assets/git-repo-expected-output.yml +++ b/cli/src/funTest/assets/git-repo-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "GitRepo" - url: "https://github.com/oss-review-toolkit/ort-test-data-git-repo?manifest=manifest.xml" - revision: "31588aa8f8555474e1c3c66a359ec99e4cd4b1fa" - path: "" - vcs_processed: - type: "GitRepo" - url: "https://github.com/oss-review-toolkit/ort-test-data-git-repo.git?manifest=manifest.xml" - revision: "31588aa8f8555474e1c3c66a359ec99e4cd4b1fa" - path: "" + provenance: + vcs_info: + type: "GitRepo" + url: "https://github.com/oss-review-toolkit/ort-test-data-git-repo?manifest=manifest.xml" + revision: "31588aa8f8555474e1c3c66a359ec99e4cd4b1fa" + path: "" + resolved_revision: "31588aa8f8555474e1c3c66a359ec99e4cd4b1fa" nested_repositories: spdx-tools: type: "Git" diff --git a/cli/src/funTest/assets/gradle-all-dependencies-expected-result-with-curations.yml b/cli/src/funTest/assets/gradle-all-dependencies-expected-result-with-curations.yml index 5ead4c4f0d4e3..5e92476d47954 100644 --- a/cli/src/funTest/assets/gradle-all-dependencies-expected-result-with-curations.yml +++ b/cli/src/funTest/assets/gradle-all-dependencies-expected-result-with-curations.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "" - revision: "" - path: "plugins/package-managers/gradle/src/funTest/assets/projects/synthetic/gradle" - vcs_processed: - type: "Git" - url: "" - revision: "" - path: "plugins/package-managers/gradle/src/funTest/assets/projects/synthetic/gradle" + provenance: + vcs_info: + type: "Git" + url: "" + revision: "" + path: "plugins/package-managers/gradle/src/funTest/assets/projects/synthetic/gradle" + resolved_revision: "" config: excludes: paths: diff --git a/cli/src/funTest/assets/semver4j-ort-result.yml b/cli/src/funTest/assets/semver4j-ort-result.yml index 7f06ecc1c2915..694663e46bfea 100644 --- a/cli/src/funTest/assets/semver4j-ort-result.yml +++ b/cli/src/funTest/assets/semver4j-ort-result.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/vdurmont/semver4j.git" + revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" + path: "" + resolved_revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" config: excludes: scopes: diff --git a/evaluator/src/test/kotlin/ProjectSourceRuleTest.kt b/evaluator/src/test/kotlin/ProjectSourceRuleTest.kt index 1b5b270536929..b4a8fa68918a4 100644 --- a/evaluator/src/test/kotlin/ProjectSourceRuleTest.kt +++ b/evaluator/src/test/kotlin/ProjectSourceRuleTest.kt @@ -214,7 +214,7 @@ private fun createOrtResult( } return OrtResult.EMPTY.copy( - repository = Repository(vcsInfo), + repository = Repository(RepositoryProvenance(vcsInfo, vcsInfo.revision)), analyzer = AnalyzerRun.EMPTY.copy( result = AnalyzerResult.EMPTY.copy( projects = setOf( diff --git a/evaluator/src/test/kotlin/TestData.kt b/evaluator/src/test/kotlin/TestData.kt index 45d72b0c61b56..a9f22e0924273 100644 --- a/evaluator/src/test/kotlin/TestData.kt +++ b/evaluator/src/test/kotlin/TestData.kt @@ -37,6 +37,7 @@ import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.PackageLinkage import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.ScanSummary import org.ossreviewtoolkit.model.ScannerDetails @@ -180,7 +181,7 @@ val allProjects = setOf( val ortResult = OrtResult( repository = Repository( - vcs = VcsInfo.EMPTY, + provenance = RepositoryProvenance(VcsInfo.EMPTY, ""), config = RepositoryConfiguration( excludes = Excludes( paths = listOf( diff --git a/helper-cli/src/funTest/assets/create-analyzer-result-from-pkg-list-expected-output.yml b/helper-cli/src/funTest/assets/create-analyzer-result-from-pkg-list-expected-output.yml index 69d7709bb6a00..cdb580b567c65 100644 --- a/helper-cli/src/funTest/assets/create-analyzer-result-from-pkg-list-expected-output.yml +++ b/helper-cli/src/funTest/assets/create-analyzer-result-from-pkg-list-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/example/project.git" - revision: "2222222222222222222222222222222222222222" - path: "vcs-path/project" - vcs_processed: - type: "Git" - url: "https://github.com/example/project.git" - revision: "2222222222222222222222222222222222222222" - path: "vcs-path/project" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/example/project.git" + revision: "2222222222222222222222222222222222222222" + path: "vcs-path/project" + resolved_revision: "2222222222222222222222222222222222222222" config: excludes: scopes: diff --git a/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt b/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt index 7921112313610..dd7007486e075 100644 --- a/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt +++ b/helper-cli/src/main/kotlin/commands/CreateAnalyzerResultFromPackageListCommand.kt @@ -41,6 +41,7 @@ import org.ossreviewtoolkit.model.PackageReference import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.RemoteArtifact import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.Scope import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType @@ -118,7 +119,7 @@ internal class CreateAnalyzerResultFromPackageListCommand : CliktCommand( environment = Environment() ), repository = Repository( - vcs = projectVcs.normalize(), + provenance = RepositoryProvenance(projectVcs.normalize(), projectVcs.revision), config = RepositoryConfiguration( excludes = Excludes( scopes = listOf( diff --git a/model/src/main/kotlin/Repository.kt b/model/src/main/kotlin/Repository.kt index 3e9fa8c305865..3310bf394d40f 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 @@ -31,13 +32,7 @@ data class Repository( /** * Original VCS-related information from the working tree containing the analyzer root. */ - val vcs: VcsInfo, - - /** - * Processed VCS-related information from the working tree containing the analyzer root that has e.g. common - * mistakes corrected. - */ - val vcsProcessed: VcsInfo = vcs.normalize(), + val provenance: KnownProvenance, /** * A map of nested repositories, for example Git submodules or Git-Repo modules. The key is the path to the @@ -57,18 +52,33 @@ data class Repository( */ @JvmField val EMPTY = Repository( - vcs = VcsInfo.EMPTY, - vcsProcessed = VcsInfo.EMPTY, + provenance = RepositoryProvenance(VcsInfo.EMPTY, ""), nestedRepositories = emptyMap(), config = RepositoryConfiguration() ) } + @JsonIgnore + val vcs = if (provenance is RepositoryProvenance) { + provenance.vcsInfo + } else { + VcsInfo.EMPTY + } + + @JsonIgnore + val vcsProcessed = if (provenance is RepositoryProvenance) { + provenance.vcsInfo.normalize() + } else { + VcsInfo.EMPTY + } + /** - * Return the path of [vcs] relative to [Repository.vcs], or null if [vcs] is neither [Repository.vcs] nor contained - * in [nestedRepositories]. + * Return the path of [vcs] relative to [Repository.provenance], or null if [vcs] is neither + * [Repository.provenance] nor contained in [nestedRepositories]. */ fun getRelativePath(vcs: VcsInfo): String? { + if (this.provenance !is RepositoryProvenance) return null + val normalizedVcs = vcs.normalize() if (vcsProcessed.equalsDisregardingPath(normalizedVcs)) return "" diff --git a/model/src/test/assets/analyzer-result-with-dependency-graph.yml b/model/src/test/assets/analyzer-result-with-dependency-graph.yml index 15c739d4f11c4..4e834102b83c5 100644 --- a/model/src/test/assets/analyzer-result-with-dependency-graph.yml +++ b/model/src/test/assets/analyzer-result-with-dependency-graph.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/vdurmont/semver4j.git" + revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" + path: "" + resolved_revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" config: {} analyzer: start_time: "2021-04-26T05:48:05.390356Z" diff --git a/model/src/test/assets/gradle-all-dependencies-expected-result.yml b/model/src/test/assets/gradle-all-dependencies-expected-result.yml index 5812c291755e4..e963b68f268c3 100644 --- a/model/src/test/assets/gradle-all-dependencies-expected-result.yml +++ b/model/src/test/assets/gradle-all-dependencies-expected-result.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "d27a886818b8ebba8e97e914133ec3cc650a534b" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "d27a886818b8ebba8e97e914133ec3cc650a534b" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "d27a886818b8ebba8e97e914133ec3cc650a534b" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle" + resolved_revision: "d27a886818b8ebba8e97e914133ec3cc650a534b" config: excludes: paths: diff --git a/model/src/test/assets/result-with-issues-graph-old.yml b/model/src/test/assets/result-with-issues-graph-old.yml index 813f1a184b827..d6a8838443b02 100644 --- a/model/src/test/assets/result-with-issues-graph-old.yml +++ b/model/src/test/assets/result-with-issues-graph-old.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/pbassiner/sbt-multi-project-example.git" + revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" + path: "" + resolved_revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/assets/result-with-issues-graph.yml b/model/src/test/assets/result-with-issues-graph.yml index 383a2a8ba0cad..72c30a85caa1b 100644 --- a/model/src/test/assets/result-with-issues-graph.yml +++ b/model/src/test/assets/result-with-issues-graph.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/pbassiner/sbt-multi-project-example.git" + revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" + path: "" + resolved_revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/assets/result-with-issues-scopes.yml b/model/src/test/assets/result-with-issues-scopes.yml index e48882fd41e74..79dee3ede4e0d 100644 --- a/model/src/test/assets/result-with-issues-scopes.yml +++ b/model/src/test/assets/result-with-issues-scopes.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/pbassiner/sbt-multi-project-example.git" - revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/pbassiner/sbt-multi-project-example.git" + revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" + path: "" + resolved_revision: "31687c099ea6d645e819ef9d6ac9fc4c757a96bc" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/assets/sbt-multi-project-example-expected-output.yml b/model/src/test/assets/sbt-multi-project-example-expected-output.yml index 61689dfc575bd..4cc4f7d256c3b 100644 --- a/model/src/test/assets/sbt-multi-project-example-expected-output.yml +++ b/model/src/test/assets/sbt-multi-project-example-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" + revision: "3c4e434b241b1f1addc97794932043b86afc2548" + path: "" + resolved_revision: "3c4e434b241b1f1addc97794932043b86afc2548" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/assets/sbt-multi-project-example-graph-old.yml b/model/src/test/assets/sbt-multi-project-example-graph-old.yml index 75faa6da133a5..059d8e2b571bb 100644 --- a/model/src/test/assets/sbt-multi-project-example-graph-old.yml +++ b/model/src/test/assets/sbt-multi-project-example-graph-old.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" + revision: "3c4e434b241b1f1addc97794932043b86afc2548" + path: "" + resolved_revision: "3c4e434b241b1f1addc97794932043b86afc2548" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/assets/sbt-multi-project-example-graph.yml b/model/src/test/assets/sbt-multi-project-example-graph.yml index 53969a4d0d20d..270723cc2ec23 100644 --- a/model/src/test/assets/sbt-multi-project-example-graph.yml +++ b/model/src/test/assets/sbt-multi-project-example-graph.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" + revision: "3c4e434b241b1f1addc97794932043b86afc2548" + path: "" + resolved_revision: "3c4e434b241b1f1addc97794932043b86afc2548" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/model/src/test/kotlin/OrtResultTest.kt b/model/src/test/kotlin/OrtResultTest.kt index a514d4e351908..4d5ba98bad684 100644 --- a/model/src/test/kotlin/OrtResultTest.kt +++ b/model/src/test/kotlin/OrtResultTest.kt @@ -106,7 +106,7 @@ class OrtResultTest : WordSpec({ ) val ortResult = OrtResult( Repository( - vcs = vcs, + provenance = RepositoryProvenance(vcs, vcs.revision), nestedRepositories = mapOf( "path/1" to nestedVcs1, "path/2" to nestedVcs2 @@ -134,7 +134,7 @@ class OrtResultTest : WordSpec({ ) val ortResult = OrtResult( Repository( - vcs = vcs, + provenance = RepositoryProvenance(vcs, vcs.revision), nestedRepositories = mapOf( "path/1" to nestedVcs1 ) @@ -260,8 +260,7 @@ class OrtResultTest : WordSpec({ val ortResult = OrtResult.EMPTY.copy( repository = Repository.EMPTY.copy( - vcs = vcs, - vcsProcessed = vcs, + provenance = RepositoryProvenance(vcs, vcs.revision), config = RepositoryConfiguration( excludes = Excludes( paths = listOf( diff --git a/model/src/test/kotlin/licenses/TestData.kt b/model/src/test/kotlin/licenses/TestData.kt index ab2f144071a4b..5edd4bdfa5a2f 100644 --- a/model/src/test/kotlin/licenses/TestData.kt +++ b/model/src/test/kotlin/licenses/TestData.kt @@ -27,6 +27,7 @@ import org.ossreviewtoolkit.model.OrtResult import org.ossreviewtoolkit.model.Package import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.ScanSummary import org.ossreviewtoolkit.model.ScannerDetails @@ -151,7 +152,7 @@ val scanResults = listOf( val ortResult = OrtResult( repository = Repository( - vcs = VcsInfo.EMPTY, + provenance = RepositoryProvenance(VcsInfo.EMPTY, ""), config = RepositoryConfiguration( excludes = Excludes( paths = listOf( diff --git a/plugins/advisors/vulnerable-code/src/test/assets/ort-analyzer-result.yml b/plugins/advisors/vulnerable-code/src/test/assets/ort-analyzer-result.yml index 0b916212007b5..c18db71099cd4 100644 --- a/plugins/advisors/vulnerable-code/src/test/assets/ort-analyzer-result.yml +++ b/plugins/advisors/vulnerable-code/src/test/assets/ort-analyzer-result.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/tests/test-project.git" - revision: "1234567890" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle" - vcs_processed: - type: "Git" - url: "https://github.com/tests/test-project.git" - revision: "1234567890" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/tests/test-project.git" + revision: "1234567890" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle" + resolved_revision: "1234567890" config: excludes: paths: diff --git a/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-linux.yml b/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-linux.yml index 9bf93dc29067c..540c883c9bbaa 100644 --- a/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-linux.yml +++ b/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-linux.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/vdurmont/semver4j.git" + revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" + path: "" + resolved_revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" config: {} analyzer: start_time: "2023-11-22T08:58:09.135241769Z" diff --git a/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-windows.yml b/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-windows.yml index 22ce0306e48d9..6aecc69c90fcd 100644 --- a/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-windows.yml +++ b/plugins/commands/compare/src/funTest/assets/semver4j-analyzer-result-windows.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/vdurmont/semver4j.git" - revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/vdurmont/semver4j.git" + revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" + path: "" + resolved_revision: "7653e418d610ffcd2811bcb55fd72d00d420950b" config: {} analyzer: start_time: "2023-11-28T18:19:25.524660Z" diff --git a/plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces-expected-output.yml b/plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces-expected-output.yml index b1fb99c19128e..ec8d44bcd44ae 100644 --- a/plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces-expected-output.yml +++ b/plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "" - revision: "" - path: "plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces" - vcs_processed: - type: "Git" - url: "" - revision: "" - path: "" + provenance: + vcs_info: + type: "Git" + url: "" + revision: "" + path: "plugins/package-managers/node/src/funTest/assets/projects/synthetic/pnpm-workspaces" + resolved_revision: "" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/plugins/package-managers/sbt/src/funTest/assets/projects/external/sbt-multi-project-example-expected-output.yml b/plugins/package-managers/sbt/src/funTest/assets/projects/external/sbt-multi-project-example-expected-output.yml index 61689dfc575bd..4cc4f7d256c3b 100644 --- a/plugins/package-managers/sbt/src/funTest/assets/projects/external/sbt-multi-project-example-expected-output.yml +++ b/plugins/package-managers/sbt/src/funTest/assets/projects/external/sbt-multi-project-example-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" - revision: "3c4e434b241b1f1addc97794932043b86afc2548" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/sbt-multi-project-example.git" + revision: "3c4e434b241b1f1addc97794932043b86afc2548" + path: "" + resolved_revision: "3c4e434b241b1f1addc97794932043b86afc2548" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template-expected-output.yml b/plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template-expected-output.yml index e024c4d9dbada..8df93f67572bc 100644 --- a/plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template-expected-output.yml +++ b/plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template-expected-output.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "Git" - url: "" - revision: "" - path: "plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template" - vcs_processed: - type: "Git" - url: "" - revision: "" - path: "plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template" + provenance: + vcs_info: + type: "Git" + url: "" + revision: "" + path: "plugins/package-managers/sbt/src/funTest/assets/projects/synthetic/sbt-http4s-template" + resolved_revision: "" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-deduplicate-expected-output.yml b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-deduplicate-expected-output.yml index 1d0483d199459..a3c16dab726ef 100644 --- a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-deduplicate-expected-output.yml +++ b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-deduplicate-expected-output.yml @@ -1159,16 +1159,13 @@ statistics: MIT: 1 execution_duration_in_seconds: 3125 repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "master" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "master" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "master" nested_repositories: sub/module: type: "Git" diff --git a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.json b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.json index 1ec5d8c80740c..1d7672a58911c 100644 --- a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.json +++ b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.json @@ -1256,17 +1256,14 @@ "execution_duration_in_seconds" : 3125 }, "repository" : { - "vcs" : { - "type" : "", - "url" : "", - "revision" : "", - "path" : "" - }, - "vcs_processed" : { - "type" : "Git", - "url" : "https://github.com/oss-review-toolkit/ort.git", - "revision" : "master", - "path" : "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + "provenance" : { + "vcs_info" : { + "type" : "Git", + "url" : "https://github.com/oss-review-toolkit/ort.git", + "revision" : "master", + "path" : "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + }, + "resolved_revision" : "master" }, "nested_repositories" : { "sub/module" : { diff --git a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.yml b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.yml index 1d0483d199459..a3c16dab726ef 100644 --- a/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.yml +++ b/plugins/reporters/evaluated-model/src/funTest/assets/evaluated-model-reporter-test-expected-output.yml @@ -1159,16 +1159,13 @@ statistics: MIT: 1 execution_duration_in_seconds: 3125 repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "master" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "master" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "master" nested_repositories: sub/module: type: "Git" diff --git a/plugins/reporters/evaluated-model/src/funTest/assets/reporter-test-input.yml b/plugins/reporters/evaluated-model/src/funTest/assets/reporter-test-input.yml index 0c9d1923ccd06..b226a0a8ae4d0 100644 --- a/plugins/reporters/evaluated-model/src/funTest/assets/reporter-test-input.yml +++ b/plugins/reporters/evaluated-model/src/funTest/assets/reporter-test-input.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "master" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "master" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "master" nested_repositories: sub/module: type: "Git" diff --git a/plugins/reporters/fossid/src/test/kotlin/FossIdReporterTest.kt b/plugins/reporters/fossid/src/test/kotlin/FossIdReporterTest.kt index 359925c6eddef..f003ddaedf75c 100644 --- a/plugins/reporters/fossid/src/test/kotlin/FossIdReporterTest.kt +++ b/plugins/reporters/fossid/src/test/kotlin/FossIdReporterTest.kt @@ -44,6 +44,7 @@ import org.ossreviewtoolkit.clients.fossid.model.report.SelectionType import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.model.OrtResult import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.ScanSummary import org.ossreviewtoolkit.model.ScannerDetails @@ -279,11 +280,14 @@ private fun createReporterMock(): Pair { } private fun createReporterInput(vararg scanCodes: String): ReporterInput { - val analyzedVcs = VcsInfo( - type = VcsType.GIT, - revision = "master", - url = "https://github.com/path/first-project.git", - path = "sub/path" + val analyzedProvenance = RepositoryProvenance( + VcsInfo( + type = VcsType.GIT, + revision = "master", + url = "https://github.com/path/first-project.git", + path = "sub/path" + ), + resolvedRevision = "master" ) val results = scanCodes.associateByTo( @@ -302,6 +306,7 @@ private fun createReporterInput(vararg scanCodes: String): ReporterInput { return ReporterInput( OrtResult( repository = Repository( + provenance = analyzedProvenance, config = RepositoryConfiguration( excludes = Excludes( scopes = listOf( @@ -312,9 +317,7 @@ private fun createReporterInput(vararg scanCodes: String): ReporterInput { ) ) ) - ), - vcs = analyzedVcs, - vcsProcessed = analyzedVcs + ) ), scanner = scannerRunOf(*results.toList().toTypedArray()) ) diff --git a/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt b/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt index ec1b097ff68cf..ca31b7bea7255 100644 --- a/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt +++ b/plugins/reporters/freemarker/src/test/kotlin/FreeMarkerTemplateProcessorTest.kt @@ -90,10 +90,11 @@ private fun scanResults(vcsInfo: VcsInfo, findingsPaths: Collection): Li ) } +private const val PROJECT_REVISION = "deadbeaf44444444333333332222222211111111" private val PROJECT_VCS_INFO = VcsInfo( type = VcsType.GIT_REPO, url = "ssh://git@host/manifests/repo?manifest=path/to/manifest.xml", - revision = "deadbeaf44444444333333332222222211111111" + revision = PROJECT_REVISION ) private val NESTED_VCS_INFO = VcsInfo( type = VcsType.GIT, @@ -108,8 +109,7 @@ private val idNestedProject = Identifier("SpdxDocumentFile:@ort:project-in-neste private val ORT_RESULT = OrtResult( repository = Repository( - vcs = PROJECT_VCS_INFO, - config = RepositoryConfiguration(), + provenance = RepositoryProvenance(PROJECT_VCS_INFO, PROJECT_REVISION), nestedRepositories = mapOf("nested-vcs-dir" to NESTED_VCS_INFO) ), analyzer = AnalyzerRun.EMPTY.copy( diff --git a/plugins/reporters/opossum/src/funTest/assets/reporter-test-input.yml b/plugins/reporters/opossum/src/funTest/assets/reporter-test-input.yml index 0c9d1923ccd06..b226a0a8ae4d0 100644 --- a/plugins/reporters/opossum/src/funTest/assets/reporter-test-input.yml +++ b/plugins/reporters/opossum/src/funTest/assets/reporter-test-input.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "master" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "master" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "master" nested_repositories: sub/module: type: "Git" diff --git a/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt b/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt index 2ef18843f3596..b1797ca38f955 100644 --- a/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt +++ b/plugins/reporters/opossum/src/test/kotlin/OpossumReporterTest.kt @@ -251,11 +251,14 @@ private fun createOrtResult(): OrtResult { url = "https://github.com/path/first-project.git", path = "sub/path" ) + val analyzedProvenance = RepositoryProvenance( + analyzedVcs, + "master" + ) return OrtResult( repository = Repository( - vcs = analyzedVcs, - vcsProcessed = analyzedVcs + provenance = analyzedProvenance ), analyzer = AnalyzerRun.EMPTY.copy( config = AnalyzerConfiguration(allowDynamicVersions = true), diff --git a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt index 75b67fe8d4f1a..6dafc3b9050bc 100644 --- a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt +++ b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt @@ -159,8 +159,11 @@ private val analyzedVcs = VcsInfo( path = "" ) +private val analyzedProvenance = RepositoryProvenance(analyzedVcs, "master") + private val ortResult = OrtResult( repository = Repository( + provenance = analyzedProvenance, config = RepositoryConfiguration( excludes = Excludes( scopes = listOf( @@ -171,9 +174,7 @@ private val ortResult = OrtResult( ) ) ) - ), - vcs = analyzedVcs, - vcsProcessed = analyzedVcs + ) ), analyzer = AnalyzerRun.EMPTY.copy( result = AnalyzerResult( diff --git a/plugins/reporters/static-html/src/funTest/assets/reporter-test-input.yml b/plugins/reporters/static-html/src/funTest/assets/reporter-test-input.yml index 0c9d1923ccd06..b226a0a8ae4d0 100644 --- a/plugins/reporters/static-html/src/funTest/assets/reporter-test-input.yml +++ b/plugins/reporters/static-html/src/funTest/assets/reporter-test-input.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/oss-review-toolkit/ort.git" - revision: "master" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/oss-review-toolkit/ort.git" + revision: "master" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "master" nested_repositories: sub/module: type: "Git" diff --git a/plugins/reporters/web-app/src/funTest/assets/scan-result-for-synthetic-gradle-lib.yml b/plugins/reporters/web-app/src/funTest/assets/scan-result-for-synthetic-gradle-lib.yml index 7226d7d26b56a..0ac9634aee3c1 100644 --- a/plugins/reporters/web-app/src/funTest/assets/scan-result-for-synthetic-gradle-lib.yml +++ b/plugins/reporters/web-app/src/funTest/assets/scan-result-for-synthetic-gradle-lib.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "Git" - url: "" - revision: "" - path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + provenance: + vcs_info: + type: "Git" + url: "" + revision: "main" + path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" + resolved_revision: "main" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" @@ -40,7 +37,7 @@ analyzer: vcs_processed: type: "Git" url: "" - revision: "" + revision: "main" path: "analyzer/src/funTest/assets/projects/synthetic/gradle/lib" homepage_url: "" scopes: diff --git a/reporter/src/testFixtures/kotlin/TestData.kt b/reporter/src/testFixtures/kotlin/TestData.kt index 52fea88318446..34c91bff2b0ff 100644 --- a/reporter/src/testFixtures/kotlin/TestData.kt +++ b/reporter/src/testFixtures/kotlin/TestData.kt @@ -42,6 +42,7 @@ import org.ossreviewtoolkit.model.PackageReference import org.ossreviewtoolkit.model.Project import org.ossreviewtoolkit.model.RemoteArtifact import org.ossreviewtoolkit.model.Repository +import org.ossreviewtoolkit.model.RepositoryProvenance import org.ossreviewtoolkit.model.ScanResult import org.ossreviewtoolkit.model.ScanSummary import org.ossreviewtoolkit.model.ScannerDetails @@ -66,7 +67,7 @@ import org.ossreviewtoolkit.utils.test.scannerRunOf // TODO: Create a way to reduce the code required to prepare an OrtResult for testing. val ORT_RESULT = OrtResult( repository = Repository( - vcs = VcsInfo.EMPTY, + provenance = RepositoryProvenance(VcsInfo.EMPTY, ""), config = RepositoryConfiguration( excludes = Excludes( paths = listOf( diff --git a/scanner/src/funTest/assets/scanner-integration-all-pkgs-expected-ort-result.yml b/scanner/src/funTest/assets/scanner-integration-all-pkgs-expected-ort-result.yml index 6b163eccd77e2..b8cb63ff5fc16 100644 --- a/scanner/src/funTest/assets/scanner-integration-all-pkgs-expected-ort-result.yml +++ b/scanner/src/funTest/assets/scanner-integration-all-pkgs-expected-ort-result.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "" - url: "" - revision: "" - path: "" + provenance: + vcs_info: + type: "" + url: "" + revision: "" + path: "" + resolved_revision: "" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/scanner/src/funTest/assets/scanner-integration-subset-pkgs-expected-ort-result.yml b/scanner/src/funTest/assets/scanner-integration-subset-pkgs-expected-ort-result.yml index f1627ba9c618e..625fd9c4f1d9e 100644 --- a/scanner/src/funTest/assets/scanner-integration-subset-pkgs-expected-ort-result.yml +++ b/scanner/src/funTest/assets/scanner-integration-subset-pkgs-expected-ort-result.yml @@ -1,15 +1,12 @@ --- repository: - vcs: - type: "" - url: "" - revision: "" - path: "" - vcs_processed: - type: "" - url: "" - revision: "" - path: "" + provenance: + vcs_info: + type: "" + url: "" + revision: "" + path: "" + resolved_revision: "" config: {} analyzer: start_time: "1970-01-01T00:00:00Z" diff --git a/website/docs/getting-started/tutorial.md b/website/docs/getting-started/tutorial.md index 5746053d2095a..3dfa28db9936e 100644 --- a/website/docs/getting-started/tutorial.md +++ b/website/docs/getting-started/tutorial.md @@ -136,16 +136,13 @@ Following is an overview of the structure of the `analyzer-result.yml` file (com ```yaml # VCS information about the input directory. repository: - vcs: - type: "Git" - url: "https://github.com/jshttp/mime-types.git" - revision: "7c4ce23d7354fbf64c69d7b7be8413c4ba2add78" - path: "" - vcs_processed: - type: "Git" - url: "https://github.com/jshttp/mime-types.git" - revision: "7c4ce23d7354fbf64c69d7b7be8413c4ba2add78" - path: "" + provenance: + vcs_info: + type: "Git" + url: "https://github.com/jshttp/mime-types.git" + revision: "7c4ce23d7354fbf64c69d7b7be8413c4ba2add78" + path: "" + resolved_revision: "7c4ce23d7354fbf64c69d7b7be8413c4ba2add78" # Will only be present if an '.ort.yml' configuration file with scope excludes was provided. Otherwise, this is an empty object. config: excludes: