Shutting down daemon from kotlin plugin on idea exit, passing jvm params to daemon launch

This commit is contained in:
ligee
2015-08-19 15:36:26 +02:00
committed by Ilya Chernikov
parent 5fee180d09
commit 6e3ce69faa
6 changed files with 22 additions and 1 deletions
@@ -157,6 +157,11 @@ public class KotlinCompilerClient {
return connectToService(compilerId, daemonOptions, errStream)
}
public fun shutdownCompileService(): Unit {
KotlinCompilerClient.connectToCompileService(CompilerId(), DaemonLaunchingOptions(), DaemonOptions(), System.out, autostart = false, checkId = false)
?.shutdown()
}
public fun incrementalCompile(compiler: CompileService, args: Array<String>, caches: Map<String, IncrementalCache>, out: OutputStream): Int {
val outStrm = RemoteOutputStreamServer(out)
@@ -174,6 +179,13 @@ public class KotlinCompilerClient {
public fun isDaemonEnabled(): Boolean = System.getProperty(COMPILE_DAEMON_ENABLED_PROPERTY) != null
public fun configureDaemonLaunchingOptions(opts: DaemonLaunchingOptions) {
System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)?.let {
// TODO: find better way to pass and parse jvm options for daemon
opts.jvmParams = it.split("##")
}
}
data class ClientOptions(
public var stop: Boolean = false
) :CmdlineParams {
@@ -30,6 +30,7 @@ public val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService"
public val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.rmi.service.CompileDaemon"
public val COMPILE_DAEMON_DEFAULT_PORT: Int = 17031
public val COMPILE_DAEMON_ENABLED_PROPERTY: String ="kotlin.daemon.enabled"
public val COMPILE_DAEMON_JVM_OPTIONS_PROPERTY: String ="kotlin.daemon.jvm.options"
fun<C, V, P: KProperty1<C,V>> C.propToParams(p: P, conv: ((v: V) -> String) = { it.toString() } ) =