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:
@@ -70,7 +70,7 @@ public class CompilerRunnerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public synchronized static Object invokeExecMethod(
|
public static Object invokeExecMethod(
|
||||||
@NotNull String compilerClassName,
|
@NotNull String compilerClassName,
|
||||||
@NotNull String[] arguments,
|
@NotNull String[] arguments,
|
||||||
@NotNull CompilerEnvironment environment,
|
@NotNull CompilerEnvironment environment,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.compilerRunner
|
package org.jetbrains.kotlin.compilerRunner
|
||||||
|
|
||||||
import com.intellij.util.xmlb.XmlSerializerUtil
|
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.ExitCode
|
||||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||||
@@ -117,9 +118,8 @@ public object KotlinCompilerRunner {
|
|||||||
val stream = ByteArrayOutputStream()
|
val stream = ByteArrayOutputStream()
|
||||||
val out = PrintStream(stream)
|
val out = PrintStream(stream)
|
||||||
|
|
||||||
// Uncomment after resolving problems with parallel compilation and tests
|
if (java.lang.Boolean.parseBoolean(System.getProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, "false")))
|
||||||
// if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) == null)
|
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
|
||||||
// System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "")
|
|
||||||
|
|
||||||
val rc = CompilerRunnerUtil.invokeExecMethod(compilerClassName, argsArray, environment, messageCollector, out)
|
val rc = CompilerRunnerUtil.invokeExecMethod(compilerClassName, argsArray, environment, messageCollector, out)
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ public object KotlinCompilerRunner {
|
|||||||
KotlinBuilder.LOG.debug("Try to connect to daemon")
|
KotlinBuilder.LOG.debug("Try to connect to daemon")
|
||||||
val connection = getDaemonConnection(environment, messageCollector)
|
val connection = getDaemonConnection(environment, messageCollector)
|
||||||
|
|
||||||
if (connection?.daemon != null) {
|
if (connection.daemon != null) {
|
||||||
KotlinBuilder.LOG.info("Connected to daemon")
|
KotlinBuilder.LOG.info("Connected to daemon")
|
||||||
|
|
||||||
val compilerOut = ByteArrayOutputStream()
|
val compilerOut = ByteArrayOutputStream()
|
||||||
@@ -203,7 +203,7 @@ public object KotlinCompilerRunner {
|
|||||||
K2JS_COMPILER -> CompileService.TargetPlatform.JS
|
K2JS_COMPILER -> CompileService.TargetPlatform.JS
|
||||||
else -> throw IllegalArgumentException("Unknown compiler type $compilerClassName")
|
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())
|
processCompilerOutput(messageCollector, collector, compilerOut, res.toString())
|
||||||
BufferedReader(StringReader(daemonOut.toString())).forEachLine {
|
BufferedReader(StringReader(daemonOut.toString())).forEachLine {
|
||||||
|
|||||||
Reference in New Issue
Block a user