Skip to content

Commit

Permalink
Make Java 8 toolchain optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Oct 10, 2020
1 parent 8f4de76 commit 38d54ea
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.jvm.toolchain.internal.NoToolchainAvailableException

plugins {
`java-library-conventions`
`testing-conventions`
Expand Down Expand Up @@ -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<JavaLauncher> = project.objects.property<JavaLauncher>()
.value(project.the<JavaToolchainService>().launcherFor {
languageVersion.set(JavaLanguageVersion.of(version))
.value(project.provider {
try {
project.the<JavaToolchainService>().launcherFor {
languageVersion.set(JavaLanguageVersion.of(version))
}.get()
} catch (e: NoToolchainAvailableException) {
null
}
})

override fun asArguments(): List<String> {
Expand Down

0 comments on commit 38d54ea

Please sign in to comment.