From 38d54ea84c18592d0d8812e33efd2eee61db191b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 8 Oct 2020 07:48:51 +0200 Subject: [PATCH] Make Java 8 toolchain optional --- .../platform-tooling-support-tests.gradle.kts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 9a6bd0585fd8..1f45aa624309 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.jvm.toolchain.internal.NoToolchainAvailableException + plugins { `java-library-conventions` `testing-conventions` @@ -86,8 +88,14 @@ class MavenRepo(@get:InputDirectory @get:PathSensitive(PathSensitivity.RELATIVE) class JavaHomeDir(project: Project, @Input val version: Int) : CommandLineArgumentProvider { @Internal val javaLauncher: Property = project.objects.property() - .value(project.the().launcherFor { - languageVersion.set(JavaLanguageVersion.of(version)) + .value(project.provider { + try { + project.the().launcherFor { + languageVersion.set(JavaLanguageVersion.of(version)) + }.get() + } catch (e: NoToolchainAvailableException) { + null + } }) override fun asArguments(): List {