From c70f6c06f6b735d13dc28e611e159128716fad7e Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Wed, 30 Oct 2024 15:42:09 +0100 Subject: [PATCH] feat(Provenance): Add a `RemoteProvenance` sub-interface In preparation to split the `KnownProvenance` hierarchy further, for now introduce a `RemoteProvenance` that bundles the `RepositoryProvenance` and `ArtifactProvance`. Later an additional `LocalProvance` will be introduced. See [1] for context. [1]: https://github.com/oss-review-toolkit/ort/issues/8803#issuecomment-2236958430 Signed-off-by: Jens Keim --- model/src/main/kotlin/Provenance.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/model/src/main/kotlin/Provenance.kt b/model/src/main/kotlin/Provenance.kt index 42d6174fd6881..5290e442ac5f6 100644 --- a/model/src/main/kotlin/Provenance.kt +++ b/model/src/main/kotlin/Provenance.kt @@ -43,6 +43,8 @@ data object UnknownProvenance : Provenance { sealed interface KnownProvenance : Provenance +sealed interface RemoteProvenance : KnownProvenance + /** * Provenance information for a source artifact. */ @@ -51,7 +53,7 @@ data class ArtifactProvenance( * The source artifact that was downloaded. */ val sourceArtifact: RemoteArtifact -) : KnownProvenance { +) : RemoteProvenance { override fun matches(pkg: Package): Boolean = sourceArtifact == pkg.sourceArtifact } @@ -70,7 +72,7 @@ data class RepositoryProvenance( * like a branch or tag name, but a fixed revision (e.g. the SHA1 of a Git commit). */ val resolvedRevision: String -) : KnownProvenance { +) : RemoteProvenance { init { require(resolvedRevision.isNotBlank()) { "The resolved revision must not be blank." } }