From 22d6433cf6bceb0fee975ec637668eb55a3df830 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 16 Mar 2021 20:53:51 +0700 Subject: [PATCH] [K/N][Gradle plugin] Do not propagate user.dir property to tools In a Gradle process, the user.dir property is set to the directory where the build was started. By default, if we start a child process via project.javaexec, Gradle sets its working directory to the directory of the current project. But passing Gradle's value of user.dir to that process overrides this setting. This makes tools started in a such way sensitive to directory the build is started from. This patch fixes this issue for K/N-related tools started out-of-process by the MPP Gradle plugin. But this issue is still relevant to in-process tool execution. --- .../org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt index d6724bb575b..c78c4c7bbf8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinToolRunner.kt @@ -26,7 +26,10 @@ internal abstract class KotlinToolRunner( open val execEnvironmentBlacklist: Set = emptySet() open val execSystemProperties: Map = emptyMap() - open val execSystemPropertiesBlacklist: Set = setOf("java.endorsed.dirs") + open val execSystemPropertiesBlacklist: Set = setOf( + "java.endorsed.dirs", // Fix for KT-25887 + "user.dir" // Don't propagate the working dir of the current Gradle process + ) abstract val classpath: Set open fun checkClasspath(): Unit = check(classpath.isNotEmpty()) { "Classpath of the tool is empty: $displayName" }