Adding support for JS compilation on daemon

Original commit: 99b638a58b
This commit is contained in:
Ilya Chernikov
2015-10-07 12:28:33 +02:00
parent 3721b5fbe9
commit 3756988fd4
2 changed files with 11 additions and 5 deletions
@@ -105,7 +105,7 @@ public object KotlinCompilerRunner {
val argsArray = argumentsList.toTypedArray()
if (!tryCompileWithDaemon(messageCollector, collector, environment, argsArray)) {
if (!tryCompileWithDaemon(compilerClassName, argsArray, environment, messageCollector, collector)) {
// otherwise fallback to in-process
val stream = ByteArrayOutputStream()
@@ -125,10 +125,10 @@ public object KotlinCompilerRunner {
}
private fun tryCompileWithDaemon(messageCollector: MessageCollector,
collector: OutputItemsCollector,
private fun tryCompileWithDaemon(compilerClassName: String,
argsArray: Array<String>,
environment: CompilerEnvironment,
argsArray: Array<String>): Boolean {
messageCollector: MessageCollector, collector: OutputItemsCollector): Boolean {
if (isDaemonEnabled()) {
val libPath = CompilerRunnerUtil.getLibPath(environment.kotlinPaths, messageCollector)
@@ -158,7 +158,12 @@ public object KotlinCompilerRunner {
val profiler = if (daemonOptions.reportPerf) WallAndThreadTotalProfiler() else DummyProfiler()
val res = KotlinCompilerClient.incrementalCompile(daemon, argsArray, services, compilerOut, daemonOut, profiler)
val targetPlatform = when (compilerClassName) {
K2JVM_COMPILER -> CompileService.TargetPlatform.JVM
K2JS_COMPILER -> CompileService.TargetPlatform.JS
else -> throw IllegalArgumentException("Unknown compiler type $compilerClassName")
}
val res = KotlinCompilerClient.incrementalCompile(daemon, targetPlatform, argsArray, services, compilerOut, daemonOut, profiler)
processCompilerOutput(messageCollector, collector, compilerOut, res.toString())
BufferedReader(StringReader(daemonOut.toString())).forEachLine {
@@ -67,6 +67,7 @@ public class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
rebuildAll()
}
// TODO: add JS tests
public fun testDaemon() {
System.setProperty(COMPILE_DAEMON_ENABLED_PROPERTY,"")
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "")