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:
+13
-2
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user