Skip to content

Commit

Permalink
Special case another license name
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Oct 4, 2024
1 parent fbfc38d commit 04d8c2c
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ private fun SpdxLicenses.generate(): FileSpec {
private val SpdxId: ClassName = ClassName("app.cash.licensee", "SpdxId")
private val SpdxIdCompanion: ClassName = SpdxId.nestedClass("Companion")

private val SpdxLicenseJson.identifier: String get() = if (id == "0BSD") {
"ZeroBSD" // hardcoded because it is the only id starting with a digit.
} else {
id
.replace("-", "_")
.replace(".", "")
.replace("+", "Plus")
}
private val SpdxLicenseJson.identifier: String
get() = when (id) {
// Special-case IDs which start with a digit:
"0BSD" -> "ZeroBSD"
"3D_Slicer_10" -> "ThreeD_Slicer_10"
else -> {
id
.replace("-", "_")
.replace(".", "")
.replace("+", "Plus")
}
}

private fun SpdxLicenses.addSpdxIdInterface(): TypeSpec = TypeSpec.classBuilder("SpdxId").apply {
primaryConstructor(
Expand Down

0 comments on commit 04d8c2c

Please sign in to comment.