@@ -21,5 +21,6 @@
|
|||||||
<orderEntry type="module" module-name="daemon-common" />
|
<orderEntry type="module" module-name="daemon-common" />
|
||||||
<orderEntry type="library" scope="TEST" name="kotlin-test" level="project" />
|
<orderEntry type="library" scope="TEST" name="kotlin-test" level="project" />
|
||||||
<orderEntry type="module" module-name="daemon" />
|
<orderEntry type="module" module-name="daemon" />
|
||||||
|
<orderEntry type="library" name="cli-parser" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -33,7 +33,20 @@ import java.rmi.server.UnicastRemoteObject
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
||||||
override val log: KotlinLogger = JpsKotlinLogger(KotlinBuilder.LOG)
|
override val log: KotlinLogger = JpsKotlinLogger(KotlinBuilder.LOG)
|
||||||
|
|
||||||
|
private var compilerSettings: CompilerSettings? = null
|
||||||
|
|
||||||
|
private inline fun withCompilerSettings(settings: CompilerSettings, fn: ()->Unit) {
|
||||||
|
val old = compilerSettings
|
||||||
|
try {
|
||||||
|
compilerSettings = settings
|
||||||
|
fn()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
compilerSettings = old
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private @Volatile var jpsDaemonConnection: DaemonConnection? = null
|
private @Volatile var jpsDaemonConnection: DaemonConnection? = null
|
||||||
@@ -48,10 +61,9 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
|||||||
) {
|
) {
|
||||||
val arguments = mergeBeans(commonArguments, k2jvmArguments)
|
val arguments = mergeBeans(commonArguments, k2jvmArguments)
|
||||||
setupK2JvmArguments(moduleFile, arguments)
|
setupK2JvmArguments(moduleFile, arguments)
|
||||||
val additionalArguments = compilerSettings.additionalArguments.split(" ").toTypedArray()
|
withCompilerSettings(compilerSettings) {
|
||||||
parseArguments(additionalArguments, arguments)
|
runCompiler(K2JVM_COMPILER, arguments, environment)
|
||||||
|
}
|
||||||
runCompiler(K2JVM_COMPILER, arguments, environment)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runK2JsCompiler(
|
fun runK2JsCompiler(
|
||||||
@@ -65,10 +77,9 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
|||||||
) {
|
) {
|
||||||
val arguments = mergeBeans(commonArguments, k2jsArguments)
|
val arguments = mergeBeans(commonArguments, k2jsArguments)
|
||||||
setupK2JsArguments(outputFile, sourceFiles, libraryFiles, arguments)
|
setupK2JsArguments(outputFile, sourceFiles, libraryFiles, arguments)
|
||||||
val additionalArguments = compilerSettings.additionalArguments.split(" ").toTypedArray()
|
withCompilerSettings(compilerSettings) {
|
||||||
parseArguments(additionalArguments, arguments)
|
runCompiler(K2JS_COMPILER, arguments, environment)
|
||||||
|
}
|
||||||
runCompiler(K2JS_COMPILER, arguments, environment)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun compileWithDaemonOrFallback(
|
override fun compileWithDaemonOrFallback(
|
||||||
@@ -104,7 +115,9 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
|||||||
val compilerMode = CompilerMode.JPS_COMPILER
|
val compilerMode = CompilerMode.JPS_COMPILER
|
||||||
val verbose = compilerArgs.verbose
|
val verbose = compilerArgs.verbose
|
||||||
val options = CompilationOptions(compilerMode, targetPlatform, reportCategories(verbose), reportSeverity(verbose), requestedCompilationResults = emptyArray())
|
val options = CompilationOptions(compilerMode, targetPlatform, reportCategories(verbose), reportSeverity(verbose), requestedCompilationResults = emptyArray())
|
||||||
daemon.compile(sessionId, compilerArgs, options, JpsCompilerServicesFacadeImpl(environment), null)
|
val allArgs = ArgumentUtils.convertArgumentsToStringList(compilerArgs) +
|
||||||
|
(compilerSettings?.additionalArguments?.split(" ") ?: emptyList())
|
||||||
|
daemon.compile(sessionId, allArgs.toTypedArray(), options, JpsCompilerServicesFacadeImpl(environment), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res?.get()?.let { exitCodeFromProcessExitCode(it) }
|
return res?.get()?.let { exitCodeFromProcessExitCode(it) }
|
||||||
|
|||||||
Reference in New Issue
Block a user