From 21b0b5a4f148007dc2281cc653b2c27ee4fd4bdc Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Thu, 21 Nov 2024 13:40:36 +0100 Subject: [PATCH] feat(model): Extend `Identifier.toPurl()` with handling for `Bazel` See also [1]. [1]: https://github.com/package-url/purl-spec/pull/317 Signed-off-by: Frank Viernau --- model/src/main/kotlin/utils/PurlExtensions.kt | 1 + model/src/main/kotlin/utils/PurlUtils.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/model/src/main/kotlin/utils/PurlExtensions.kt b/model/src/main/kotlin/utils/PurlExtensions.kt index 52468d0309cd0..12d39cbfe0493 100644 --- a/model/src/main/kotlin/utils/PurlExtensions.kt +++ b/model/src/main/kotlin/utils/PurlExtensions.kt @@ -38,6 +38,7 @@ import org.ossreviewtoolkit.model.VcsType */ fun Identifier.getPurlType() = when (type.lowercase()) { + "bazel" -> PurlType.BAZEL "bower" -> PurlType.BOWER "carthage" -> PurlType.CARTHAGE "composer" -> PurlType.COMPOSER diff --git a/model/src/main/kotlin/utils/PurlUtils.kt b/model/src/main/kotlin/utils/PurlUtils.kt index 9059ccf863664..52d9038f0003a 100644 --- a/model/src/main/kotlin/utils/PurlUtils.kt +++ b/model/src/main/kotlin/utils/PurlUtils.kt @@ -32,6 +32,7 @@ import org.ossreviewtoolkit.utils.common.percentEncode enum class PurlType(private val value: String) { ALPINE("alpine"), A_NAME("a-name"), + BAZEL("bazel"), BOWER("bower"), CARGO("cargo"), CARTHAGE("carthage"),