Merge branch 'master' into index-lifecycle

This commit is contained in:
Colin Goodheart-Smithe 2018-05-09 12:10:55 +01:00
commit a6dfd06939
No known key found for this signature in database
GPG Key ID: F975E7BDD739B3C7
1 changed files with 9 additions and 4 deletions

View File

@ -535,10 +535,15 @@ class BuildPlugin implements Plugin<Project> {
}
// also apply release flag to groovy, which is used in build-tools
project.tasks.withType(GroovyCompile) {
final JavaVersion targetCompatibilityVersion = JavaVersion.toVersion(it.targetCompatibility)
options.fork = true
options.forkOptions.javaHome = new File(project.compilerJavaHome)
options.compilerArgs << '--release' << targetCompatibilityVersion.majorVersion
final compilerJavaHomeFile = new File(project.compilerJavaHome)
// we only fork if the Gradle JDK is not the same as the compiler JDK
if (compilerJavaHomeFile.canonicalPath == Jvm.current().javaHome.canonicalPath) {
options.fork = false
} else {
options.fork = true
options.forkOptions.javaHome = compilerJavaHomeFile
options.compilerArgs << '--release' << JavaVersion.toVersion(it.targetCompatibility).majorVersion
}
}
}
}