-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a stand-alone Kotlin script to check license classifications
Replace the check via the ORT helper-cli command with a custom stand-alone Kotlin script that uses ORT programmatically. This offers more flexibility going forward, like checking that all classified licenses are valid SPDX IDs. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
- Loading branch information
1 parent
7f24316
commit e0a30af
Showing
2 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env kotlin | ||
|
||
// SPDX-FileCopyrightText: 2023 Double Open Oy <support@doubleopen.org> | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
@file:CompilerOptions("-jvm-target", "17") | ||
@file:DependsOn("org.ossreviewtoolkit:model:10.0.0") | ||
|
||
import java.io.File | ||
|
||
import kotlin.system.exitProcess | ||
|
||
import org.ossreviewtoolkit.model.licenses.LicenseClassifications | ||
import org.ossreviewtoolkit.model.readValue | ||
|
||
val scriptsDir = __FILE__.parentFile | ||
val licenseClassificationsFile = scriptsDir.resolve("../license-classifications.yml").canonicalFile | ||
|
||
val licenseClassifications = runCatching { | ||
licenseClassificationsFile.readValue<LicenseClassifications>() | ||
}.onFailure { | ||
println("Unable to read '$licenseClassificationsFile': ${it.message}") | ||
}.getOrElse { | ||
exitProcess(1) | ||
} | ||
|
||
println("Check passed for '$licenseClassificationsFile'.") |