Adding support for JS compilation on daemon
Original commit: 99b638a58b
This commit is contained in:
@@ -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, "")
|
||||
|
||||
Reference in New Issue
Block a user