Skip to content

Commit eb7eae2

Browse files
committed
feat(model): Sort SpdxExpressions in more places on serialization
This eases comparison of serialized files. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
1 parent b11bc50 commit eb7eae2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

model/src/main/kotlin/Package.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import org.ossreviewtoolkit.model.utils.requireNotEmptyNoDuplicates
2727
import org.ossreviewtoolkit.model.utils.toPurl
2828
import org.ossreviewtoolkit.utils.ort.DeclaredLicenseProcessor
2929
import org.ossreviewtoolkit.utils.ort.ProcessedDeclaredLicense
30+
import org.ossreviewtoolkit.utils.ort.SpdxExpressionSortedConverter
3031
import org.ossreviewtoolkit.utils.ort.StringSortedSetConverter
3132
import org.ossreviewtoolkit.utils.spdx.SpdxExpression
3233
import org.ossreviewtoolkit.utils.spdx.SpdxOperator
@@ -85,6 +86,7 @@ data class Package(
8586
* ORT itself does not set this field, it needs to be set by the user using a [PackageCuration].
8687
*/
8788
@JsonInclude(JsonInclude.Include.NON_NULL)
89+
@JsonSerialize(converter = SpdxExpressionSortedConverter::class)
8890
val concludedLicense: SpdxExpression? = null,
8991

9092
/**

model/src/main/kotlin/config/LicenseFindingCuration.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
2424
import com.fasterxml.jackson.databind.annotation.JsonSerialize
2525
import com.fasterxml.jackson.databind.util.StdConverter
2626

27+
import org.ossreviewtoolkit.utils.ort.SpdxExpressionSortedConverter
2728
import org.ossreviewtoolkit.utils.spdx.SpdxExpression
2829

2930
/**
@@ -57,12 +58,14 @@ data class LicenseFindingCuration(
5758
* [detectedLicense] or if [detectedLicense] is null.
5859
*/
5960
@JsonInclude(JsonInclude.Include.NON_NULL)
61+
@JsonSerialize(converter = SpdxExpressionSortedConverter::class)
6062
val detectedLicense: SpdxExpression? = null,
6163

6264
/**
6365
* The concluded license as SPDX expression or [org.ossreviewtoolkit.utils.spdx.SpdxConstants.NONE] for no license,
6466
* see https://spdx.dev/spdx-specification-21-web-version#h.jxpfx0ykyb60.
6567
*/
68+
@JsonSerialize(converter = SpdxExpressionSortedConverter::class)
6669
val concludedLicense: SpdxExpression,
6770

6871
/**

0 commit comments

Comments
 (0)