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)
#KT-32955 Fixed
This commit is contained in:
+4
-1
@@ -720,11 +720,14 @@ fun jdkPath(version: String): String {
|
|||||||
|
|
||||||
|
|
||||||
fun Project.configureJvmProject(javaHome: String, javaVersion: 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> {
|
tasks.withType<JavaCompile> {
|
||||||
if (name != "compileJava9Java") {
|
if (name != "compileJava9Java") {
|
||||||
sourceCompatibility = javaVersion
|
sourceCompatibility = javaVersion
|
||||||
targetCompatibility = javaVersion
|
targetCompatibility = javaVersion
|
||||||
options.isFork = true
|
options.isFork = shouldFork
|
||||||
options.forkOptions.javaHome = file(javaHome)
|
options.forkOptions.javaHome = file(javaHome)
|
||||||
options.compilerArgs.add("-proc:none")
|
options.compilerArgs.add("-proc:none")
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
|
|||||||
Reference in New Issue
Block a user