another attempt to fix parallel compilation - enabling keepalive in compiler use sites, but in jps taking parallel compilation option into account, so it should be now not set in tests

Original commit: 6313ecac1c
This commit is contained in:
Ilya Chernikov
2015-11-30 17:48:51 +01:00
parent 75e0da2461
commit 94092388a1
2 changed files with 6 additions and 6 deletions
@@ -70,7 +70,7 @@ public class CompilerRunnerUtil {
}
@Nullable
public synchronized static Object invokeExecMethod(
public static Object invokeExecMethod(
@NotNull String compilerClassName,
@NotNull String[] arguments,
@NotNull CompilerEnvironment environment,
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.compilerRunner
import com.intellij.util.xmlb.XmlSerializerUtil
import org.jetbrains.jps.api.GlobalOptions
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
@@ -117,9 +118,8 @@ public object KotlinCompilerRunner {
val stream = ByteArrayOutputStream()
val out = PrintStream(stream)
// Uncomment after resolving problems with parallel compilation and tests
// if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) == null)
// System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "")
if (java.lang.Boolean.parseBoolean(System.getProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, "false")))
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
val rc = CompilerRunnerUtil.invokeExecMethod(compilerClassName, argsArray, environment, messageCollector, out)
@@ -188,7 +188,7 @@ public object KotlinCompilerRunner {
KotlinBuilder.LOG.debug("Try to connect to daemon")
val connection = getDaemonConnection(environment, messageCollector)
if (connection?.daemon != null) {
if (connection.daemon != null) {
KotlinBuilder.LOG.info("Connected to daemon")
val compilerOut = ByteArrayOutputStream()
@@ -203,7 +203,7 @@ public object KotlinCompilerRunner {
K2JS_COMPILER -> CompileService.TargetPlatform.JS
else -> throw IllegalArgumentException("Unknown compiler type $compilerClassName")
}
val res = KotlinCompilerClient.incrementalCompile(connection!!.daemon!!, connection.sessionId, targetPlatform, argsArray, services, compilerOut, daemonOut)
val res = KotlinCompilerClient.incrementalCompile(connection.daemon!!, connection.sessionId, targetPlatform, argsArray, services, compilerOut, daemonOut)
processCompilerOutput(messageCollector, collector, compilerOut, res.toString())
BufferedReader(StringReader(daemonOut.toString())).forEachLine {