From ab39b4d0cc662d909596f8d5fd882fe1b0a3bd5c Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 13 Sep 2024 12:57:51 +0200 Subject: [PATCH] build(gradle)!: Build with Java 21 As fcfab20 decoupled the Java version to use for analysis of Gradle projects from the Java version running ORT, finally update the Java version from 11 / 17 to 21. See [1] for context. Also stop using the deprecated `Thread.id` in favor of `Thread.threadId()` and ensure to run with Java 21 when generating completion scripts. [1]: https://github.com/oss-review-toolkit/ort/issues/8249 Signed-off-by: Sebastian Schuberth --- .github/workflows/static-analysis.yml | 5 +++++ docker/versions.dockerfile | 2 +- gradle.properties | 2 +- gradle/gradle-daemon-jvm.properties | 2 +- plugins/scanners/scanoss/src/main/kotlin/ScanOss.kt | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b6766d0b82250..2bfef408da5ae 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -37,6 +37,11 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - name: Setup Java + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + with: + distribution: temurin + java-version: 21 - name: Setup Gradle uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 - name: Generate completions diff --git a/docker/versions.dockerfile b/docker/versions.dockerfile index 850d9449ffa8c..87c7573888ca6 100644 --- a/docker/versions.dockerfile +++ b/docker/versions.dockerfile @@ -10,7 +10,7 @@ ARG DART_VERSION=2.18.4 ARG DOTNET_VERSION=6.0 ARG GO_VERSION=1.23.0 ARG HASKELL_STACK_VERSION=2.13.1 -ARG JAVA_VERSION=17 +ARG JAVA_VERSION=21 ARG LICENSEE_VERSION=9.15.3 ARG NODEJS_VERSION=20.14.0 ARG NPM_VERSION=10.8.3 diff --git a/gradle.properties b/gradle.properties index 178b55e8c0d12..df27565a0a415 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ ksp.useKSP2 = true # The version of the JDK to use for building ORT. # Keep this aligned with `toolchainVersion` in `gradle/gradle-daemon-jvm.properties`. -javaLanguageVersion = 11 +javaLanguageVersion = 21 # The version of the SPDX license list which is used to import license texts and generate SPDX enums. Must be a valid # tag, see https://github.com/spdx/license-list-data/tags. diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties index 647a0a5e98708..58b210e4d6485 100644 --- a/gradle/gradle-daemon-jvm.properties +++ b/gradle/gradle-daemon-jvm.properties @@ -1,4 +1,4 @@ # The version of the JDK to use for building ORT. # Keep this aligned with `javaLanguageVersion` in `gradle.properties`. -toolchainVersion = 11 +toolchainVersion = 21 toolchainVendor = Adoptium diff --git a/plugins/scanners/scanoss/src/main/kotlin/ScanOss.kt b/plugins/scanners/scanoss/src/main/kotlin/ScanOss.kt index aede5691541e9..91d6df147ba34 100644 --- a/plugins/scanners/scanoss/src/main/kotlin/ScanOss.kt +++ b/plugins/scanners/scanoss/src/main/kotlin/ScanOss.kt @@ -98,7 +98,7 @@ class ScanOss internal constructor( val result = service.scan( wfpString, context.labels["scanOssContext"], - context.labels["scanOssId"]?.toIntOrNull() ?: Thread.currentThread().id.toInt() + context.labels["scanOssId"]?.toIntOrNull() ?: Thread.currentThread().threadId().toInt() ) // Replace the anonymized UUIDs by their file paths.