Do not fork java compile tasks when current JDK can be used

I see the following improvements:
* `clean dist --parallel` is ~10% faster (from 3:40 to 3:20)
* incremental `dist --parallel` is ~50% faster
(adding public method to org.jetbrains.kotlin.utils.SmartList)
This commit is contained in:
Alexey Tsvetkov
2019-06-10 22:08:11 +03:00
parent 48b86bba69
commit f2021b580e
+13 -2
View File
@@ -716,12 +716,23 @@ fun jdkPath(version: String): String {
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
val currentJavaHome = File(System.getProperty("java.home")!!).canonicalPath
val shouldFork = !currentJavaHome.startsWith(File(javaHome).canonicalPath)
tasks.withType<JavaCompile> {
if (name != "compileJava9Java") {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
if (shouldFork) {
logger.info("$path will be forked with $javaHome")
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
} else {
options.isFork = false
options.forkOptions.javaHome = null
}
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}