@@ -28,7 +28,6 @@ import org.ossreviewtoolkit.model.Project
2828import org.ossreviewtoolkit.model.Provenance
2929import org.ossreviewtoolkit.model.RepositoryProvenance
3030import org.ossreviewtoolkit.model.SourceCodeOrigin
31- import org.ossreviewtoolkit.model.UnknownProvenance
3231import org.ossreviewtoolkit.model.VcsInfo
3332import org.ossreviewtoolkit.model.VcsType
3433import org.ossreviewtoolkit.utils.common.replaceCredentialsInUri
@@ -77,9 +76,9 @@ data class PackageConfiguration(
7776) {
7877 init {
7978 require(
80- listOfNotNull(sourceArtifactUrl, vcs, sourceCodeOrigin).size = = 1
79+ listOfNotNull(sourceArtifactUrl, vcs, sourceCodeOrigin).size < = 1
8180 ) {
82- " A package configuration must set exactly one of 'sourceArtifactUrl', 'vcs' or 'sourceCodeOrigin'."
81+ " A package configuration must contain at most one of 'sourceArtifactUrl', 'vcs' or 'sourceCodeOrigin'."
8382 }
8483 }
8584
@@ -100,11 +99,15 @@ data class PackageConfiguration(
10099 }
101100 }
102101
103- return when (provenance) {
104- is UnknownProvenance -> false
105- is ArtifactProvenance -> sourceArtifactUrl != null && sourceArtifactUrl == provenance.sourceArtifact.url
106- is RepositoryProvenance -> vcs != null && vcs.matches(provenance)
102+ if (sourceArtifactUrl != null ) {
103+ return provenance is ArtifactProvenance && sourceArtifactUrl == provenance.sourceArtifact.url
107104 }
105+
106+ if (vcs != null ) {
107+ return provenance is RepositoryProvenance && vcs.matches(provenance)
108+ }
109+
110+ return true
108111 }
109112}
110113
0 commit comments