Fix both moduleFile and destination passed to the compiler

when it is run not in daemon from Gradle; don't pass the destination in
such case.

Issue #KT-21637 Fixed
This commit is contained in:
Sergey Igushkin
2017-12-11 20:24:06 +03:00
parent 00d7150944
commit 66d3c94193
@@ -98,7 +98,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
friendDirs = args.friendPaths?.map(::File) ?: emptyList())
args.buildFile = buildFile.absolutePath
if (environment !is GradleIncrementalCompilerEnvironment) {
if (environment !is GradleIncrementalCompilerEnvironment || kotlinCompilerExecutionStrategy != "daemon") {
args.destination = null
}
@@ -151,7 +151,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
kotlinDebug { "Kotlin compiler args: ${argsArray.joinToString(" ")}" }
}
val executionStrategy = System.getProperty(KOTLIN_COMPILER_EXECUTION_STRATEGY_PROPERTY) ?: DAEMON_EXECUTION_STRATEGY
val executionStrategy = kotlinCompilerExecutionStrategy
if (executionStrategy == DAEMON_EXECUTION_STRATEGY) {
val daemonExitCode = compileWithDaemon(compilerClassName, compilerArgs, environment)
@@ -172,6 +172,9 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
}
}
private val kotlinCompilerExecutionStrategy: String
get() = System.getProperty(KOTLIN_COMPILER_EXECUTION_STRATEGY_PROPERTY) ?: DAEMON_EXECUTION_STRATEGY
override fun compileWithDaemon(compilerClassName: String, compilerArgs: CommonCompilerArguments, environment: GradleCompilerEnvironment): ExitCode? {
val connection =
try {