From 66d3c94193bc098d75e39ad60e8ffb34ee716359 Mon Sep 17 00:00:00 2001 From: Sergey Igushkin Date: Mon, 11 Dec 2017 20:24:06 +0300 Subject: [PATCH] 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 --- .../kotlin/compilerRunner/GradleKotlinCompilerRunner.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt index dfdc63a7899..8cf153d7d49 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt @@ -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 {