Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a stand-alone Kotlin script to check license classifications #63

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
branches:
- "main"

env:
ORT_VERSION: 9.0.0

jobs:
Check:
runs-on: ubuntu-latest
Expand All @@ -27,12 +24,8 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- name: Setup ORT helper-cli
run: |
wget https://github.com/oss-review-toolkit/ort/releases/download/$ORT_VERSION/orth-$ORT_VERSION.zip
unzip orth-$ORT_VERSION.zip -d /opt
- name: Check license-classifications.yml
run: /opt/orth-$ORT_VERSION/bin/orth list-license-categories -i license-classifications.yml
- name: Check license classifications
run: ./scripts/check-license-classifications.main.kts

Lint:
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions scripts/check-license-classifications.main.kts
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'.")
Loading