[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.
This commit is contained in:
Ilya Matveev
2021-03-16 20:53:51 +07:00
committed by TeamCityServer
parent e56ac775ca
commit 22d6433cf6
@@ -26,7 +26,10 @@ internal abstract class KotlinToolRunner(
open val execEnvironmentBlacklist: Set<String> = emptySet()
open val execSystemProperties: Map<String, String> = emptyMap()
open val execSystemPropertiesBlacklist: Set<String> = setOf("java.endorsed.dirs")
open val execSystemPropertiesBlacklist: Set<String> = 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<File>
open fun checkClasspath(): Unit = check(classpath.isNotEmpty()) { "Classpath of the tool is empty: $displayName" }