diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-05-24 01:53:12 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-05-24 01:53:12 +0530 |
commit | bd464556b6ac43e57a3a3c13c79683916f3280fc (patch) | |
tree | 6e1213ef42b0ff0f3f61d5091eb2dba8e41d633c /build-logic/build.gradle.kts | |
parent | 5f1a429029b6322ac9971ecce3ef282d558134dc (diff) |
feat(build): use JVM toolchains to enforce Java 17 usage
This simplifies project setup in both CI and for individual contributors
Diffstat (limited to 'build-logic/build.gradle.kts')
-rw-r--r-- | build-logic/build.gradle.kts | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 0f3d9342..6f7a78c0 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -2,28 +2,16 @@ * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. * SPDX-License-Identifier: GPL-3.0-only */ -import org.gradle.api.JavaVersion -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `kotlin-dsl` } -tasks.withType<JavaCompile>().configureEach { - sourceCompatibility = JavaVersion.VERSION_17.toString() - targetCompatibility = JavaVersion.VERSION_17.toString() +private val jvmToolchainAction = Action<JavaToolchainSpec> { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.ADOPTIUM) } -tasks.withType<KotlinCompile>().configureEach { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - freeCompilerArgs = - freeCompilerArgs + - listOf( - "-opt-in=kotlin.RequiresOptIn", - ) - } -} +java.toolchain(jvmToolchainAction) +kotlin.jvmToolchain(jvmToolchainAction) gradlePlugin { plugins { |