From fcc3aaf1331bfa1ac60fe3c55d242c4d7330f715 Mon Sep 17 00:00:00 2001 From: Kevin Cianfarini Date: Thu, 29 Feb 2024 12:59:54 -0500 Subject: [PATCH] Set proper Java target compatibility (#40) --- build.gradle.kts | 21 +++++++++++++++++++++ gradle.properties | 1 + 2 files changed, 22 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 3278ebf..d6311e9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,3 +11,24 @@ allprojects { google() } } + +val jvmVersion: Provider = providers.gradleProperty("kotlin.jvm.target") + +subprojects { + plugins.withType().configureEach { + extensions.findByType()?.apply { + jvmVersion.map { JavaVersion.toVersion(it) }.orNull?.let { + compileOptions { + sourceCompatibility = it + targetCompatibility = it + } + } + } + } + // Apply kotlinOptions.jvmTarget to subprojects + tasks.withType().configureEach { + kotlinOptions { + if (jvmVersion.isPresent) jvmTarget = jvmVersion.get() + } + } +} diff --git a/gradle.properties b/gradle.properties index 1dfbf7d..18b1d7c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,5 @@ kotlin.code.style=official +kotlin.jvm.target=11 GROUP=io.github.kevincianfarini.monarch VERSION_NAME=0.1.0-SNAPSHOT