Skip to content

Commit 783c6d5

Browse files
committed
chore(spdx-utils)!: Rename exception "mapping" to "association"
These do not map values in the sense of simple and declared license mappings, but associate exceptions with the licenses they are applicable for. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 02a1c44 commit 783c6d5

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

.ort.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ curations:
163163
reason: "DATA_OF"
164164
comment: >-
165165
This file defines official SPDX.org exceptions so they can be used in OSS Review Toolkit.
166-
- path: "utils/spdx/src/main/resources/{declared-license-mapping.yml,deprecated-license-mapping.yml,exception-mapping.yml,simple-license-mapping.yml}"
166+
- path: "utils/spdx/src/main/resources/{declared-license-mapping.yml,deprecated-license-mapping.yml,exception-association.yml,simple-license-mapping.yml}"
167167
concluded_license: "Apache-2.0"
168168
reason: "DATA_OF"
169169
comment: >-

model/src/main/kotlin/utils/FindingsMatcher.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fun associateLicensesWithExceptions(
244244
val exception = i.next()
245245

246246
// Determine all licenses the exception is applicable to.
247-
val applicableLicenses = SpdxLicenseException.mapping[exception.license.toString()].orEmpty().map { it.id }
247+
val applicableLicenses = SpdxLicenseException.association[exception.license.toString()].orEmpty().map { it.id }
248248

249249
// Determine applicable license findings from the same path.
250250
val applicableLicenseFindings = licenses.filter {
@@ -312,7 +312,7 @@ fun associateLicensesWithExceptions(license: SpdxExpression): SpdxExpression {
312312
val licenseId = childLicense.toString()
313313

314314
val validLicenseExceptionCombinations = standAloneExceptionIds.mapNotNull { exceptionId ->
315-
val applicableLicenseIds = SpdxLicenseException.mapping[exceptionId].orEmpty().map { it.id }
315+
val applicableLicenseIds = SpdxLicenseException.association[exceptionId].orEmpty().map { it.id }
316316

317317
if (licenseId in applicableLicenseIds) {
318318
SpdxLicenseWithExceptionExpression(childLicense, exceptionId)

utils/spdx/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ fun Task.generateEnumClass(
269269
| /**
270270
| * The map which associates SPDX exceptions with their applicable SPDX licenses.
271271
| */
272-
| val mapping by lazy {
273-
| val resource = checkNotNull(SpdxLicenseException::class.java.getResource("/exception-mapping.yml"))
272+
| val association by lazy {
273+
| val resource = checkNotNull(SpdxLicenseException::class.java.getResource("/exception-association.yml"))
274274
| yamlMapper.readValue<Map<String, List<SpdxLicense>>>(resource)
275275
| }
276276
|

utils/spdx/src/main/kotlin/SpdxLicenseException.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ enum class SpdxLicenseException(
129129
/**
130130
* The map which associates SPDX exceptions with their applicable SPDX licenses.
131131
*/
132-
val mapping by lazy {
133-
val resource = checkNotNull(SpdxLicenseException::class.java.getResource("/exception-mapping.yml"))
132+
val association by lazy {
133+
val resource = checkNotNull(SpdxLicenseException::class.java.getResource("/exception-association.yml"))
134134
yamlMapper.readValue<Map<String, List<SpdxLicense>>>(resource)
135135
}
136136

0 commit comments

Comments
 (0)