Simple test with daemon compilation, minor fixes mostly for easier testing
This commit is contained in:
@@ -157,19 +157,33 @@ public class KotlinCompilerClient {
|
||||
return connectToService(compilerId, daemonOptions, errStream)
|
||||
}
|
||||
|
||||
public fun shutdownCompileService(): Unit {
|
||||
KotlinCompilerClient.connectToCompileService(CompilerId(), DaemonLaunchingOptions(), DaemonOptions(), System.out, autostart = false, checkId = false)
|
||||
public fun shutdownCompileService(daemonOptions: DaemonOptions): 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 {
|
||||
public fun shutdownCompileService(): Unit {
|
||||
shutdownCompileService(DaemonOptions())
|
||||
}
|
||||
|
||||
public fun compile(compiler: CompileService, args: Array<out String>, out: OutputStream): Int {
|
||||
|
||||
val outStrm = RemoteOutputStreamServer(out)
|
||||
try {
|
||||
return compiler.remoteCompile(args, outStrm, CompileService.OutputFormat.PLAIN)
|
||||
}
|
||||
finally {
|
||||
outStrm.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
public fun incrementalCompile(compiler: CompileService, args: Array<out String>, caches: Map<String, IncrementalCache>, out: OutputStream): Int {
|
||||
|
||||
val outStrm = RemoteOutputStreamServer(out)
|
||||
val cacheServers = hashMapOf<String, RemoteIncrementalCacheServer>()
|
||||
try {
|
||||
caches.forEach { cacheServers.put( it.getKey(), RemoteIncrementalCacheServer( it.getValue())) }
|
||||
val res = compiler.remoteIncrementalCompile(args, cacheServers, outStrm, CompileService.OutputFormat.XML)
|
||||
return res
|
||||
return compiler.remoteIncrementalCompile(args, cacheServers, outStrm, CompileService.OutputFormat.XML)
|
||||
}
|
||||
finally {
|
||||
cacheServers.forEach { it.getValue().disconnect() }
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface CompileService : Remote {
|
||||
|
||||
throws(RemoteException::class)
|
||||
public fun remoteIncrementalCompile(
|
||||
args: Array<String>,
|
||||
args: Array<out String>,
|
||||
caches: Map<String, RemoteIncrementalCache>,
|
||||
outputStream: RemoteOutputStream,
|
||||
outputFormat: OutputFormat): Int
|
||||
|
||||
@@ -126,7 +126,7 @@ class CompileServiceImpl<Compiler: CLICompiler<*>>(
|
||||
val res = body()
|
||||
val endTime = System.nanoTime()
|
||||
val endMem = usedMemory() / 1024
|
||||
log.info("Done")
|
||||
log.info("Done with result " + res.toString())
|
||||
log.info("Elapsed time: " + TimeUnit.NANOSECONDS.toMillis(endTime - startTime) + " ms")
|
||||
log.info("Used memory: $endMem kb (${"%+d".format(endMem - startMem)} kb)")
|
||||
return res
|
||||
@@ -178,7 +178,7 @@ class CompileServiceImpl<Compiler: CLICompiler<*>>(
|
||||
}
|
||||
}
|
||||
|
||||
override fun remoteIncrementalCompile(args: Array<String>, caches: Map<String, CompileService.RemoteIncrementalCache>, errStream: RemoteOutputStream, outputFormat: CompileService.OutputFormat): Int =
|
||||
override fun remoteIncrementalCompile(args: Array<out String>, caches: Map<String, CompileService.RemoteIncrementalCache>, errStream: RemoteOutputStream, outputFormat: CompileService.OutputFormat): Int =
|
||||
ifAlive {
|
||||
checkedCompile(args) {
|
||||
val strm = RemoteOutputStreamClient(errStream)
|
||||
|
||||
Reference in New Issue
Block a user