From bd464556b6ac43e57a3a3c13c79683916f3280fc Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 24 May 2023 01:53:12 +0530 Subject: feat(build): use JVM toolchains to enforce Java 17 usage This simplifies project setup in both CI and for individual contributors --- build-logic/build.gradle.kts | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'build-logic/build.gradle.kts') 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().configureEach { - sourceCompatibility = JavaVersion.VERSION_17.toString() - targetCompatibility = JavaVersion.VERSION_17.toString() +private val jvmToolchainAction = Action { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.ADOPTIUM) } -tasks.withType().configureEach { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - freeCompilerArgs = - freeCompilerArgs + - listOf( - "-opt-in=kotlin.RequiresOptIn", - ) - } -} +java.toolchain(jvmToolchainAction) +kotlin.jvmToolchain(jvmToolchainAction) gradlePlugin { plugins { -- cgit v1.2.3