Skip to content

Commit

Permalink
fix(gradle-model): Ensure compatibility by lowering the Java target
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Mar 15, 2024
1 parent 04e60c6 commit 986c762
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions plugins/package-managers/gradle-model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,26 @@
* License-Filename: LICENSE
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// Apply precompiled plugins.
id("ort-kotlin-conventions")
id("ort-publication-conventions")
}

// Classes that are sent to the build via custom build actions need to target the lowest supported Java version, which
// is Java 8 for Gradle 5 and above, see
// https://docs.gradle.org/current/userguide/third_party_integration.html#sec:embedding_compatibility
val gradleToolingApiLowestSupportedJavaVersion = JvmTarget.JVM_1_8

tasks.named<JavaCompile>("compileJava") {
targetCompatibility = gradleToolingApiLowestSupportedJavaVersion.target
}

tasks.named<KotlinCompile>("compileKotlin") {
compilerOptions {
jvmTarget = gradleToolingApiLowestSupportedJavaVersion
}
}

0 comments on commit 986c762

Please sign in to comment.