Skip to content

Commit

Permalink
feat(Provenance): Add a RemoteProvenance sub-interface
Browse files Browse the repository at this point in the history
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]: oss-review-toolkit#8803 (comment)

Signed-off-by: Jens Keim <jens.keim@forvia.com>
  • Loading branch information
pepper-jk committed Nov 26, 2024
1 parent e841910 commit c8bb7b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions model/src/main/kotlin/Provenance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ data object UnknownProvenance : Provenance {

sealed interface KnownProvenance : Provenance

sealed interface RemoteProvenance : KnownProvenance

/**
* Provenance information for a source artifact.
*/
Expand All @@ -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
}

Expand All @@ -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." }
}
Expand Down

0 comments on commit c8bb7b2

Please sign in to comment.