Adding support for JS compilation on daemon

This commit is contained in:
Ilya Chernikov
2015-10-07 12:28:33 +02:00
parent 391c292b8d
commit 99b638a58b
7 changed files with 61 additions and 25 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 {