From e56ac775ca58ddab22028a8abcfe48adee838fa6 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 16 Mar 2021 20:35:25 +0700 Subject: [PATCH] [K/N][tests] Do not propagate user.dir property to compiler/cinterop 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. Thus a test using relative paths may fail if it is started from a wrong directory. This patch fixes this issue for Kotlin/Native tests. --- .../interop/embedStaticLibraries/embedStaticLibraries.def | 2 +- .../backend.native/tests/interop/kt43502/kt43502.def | 2 +- .../jetbrains/kotlin/gradle/plugin/konan/KonanToolRunner.kt | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kotlin-native/backend.native/tests/interop/embedStaticLibraries/embedStaticLibraries.def b/kotlin-native/backend.native/tests/interop/embedStaticLibraries/embedStaticLibraries.def index da241a53021..15f734d660a 100644 --- a/kotlin-native/backend.native/tests/interop/embedStaticLibraries/embedStaticLibraries.def +++ b/kotlin-native/backend.native/tests/interop/embedStaticLibraries/embedStaticLibraries.def @@ -1,2 +1,2 @@ -libraryPaths = kotlin-native/backend.native/tests/build/embedStaticLibraries +libraryPaths = build/embedStaticLibraries staticLibraries = 3.a 4.a diff --git a/kotlin-native/backend.native/tests/interop/kt43502/kt43502.def b/kotlin-native/backend.native/tests/interop/kt43502/kt43502.def index 80d7119aac0..8eb28428103 100644 --- a/kotlin-native/backend.native/tests/interop/kt43502/kt43502.def +++ b/kotlin-native/backend.native/tests/interop/kt43502/kt43502.def @@ -1,2 +1,2 @@ -libraryPaths = kotlin-native/backend.native/tests/build/kt43502 +libraryPaths = build/kt43502 staticLibraries = kt43502.a \ No newline at end of file diff --git a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KonanToolRunner.kt b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KonanToolRunner.kt index d08a93970e2..a9ec7f0b1ef 100644 --- a/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KonanToolRunner.kt +++ b/kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/KonanToolRunner.kt @@ -58,7 +58,10 @@ internal abstract class KonanCliRunner( } protected val blacklistProperties: Set = - setOf("java.endorsed.dirs") + setOf( + "java.endorsed.dirs", // Fix for KT-25887 + "user.dir" // Don't propagate the working dir of the current Gradle process + ) override val classpath: FileCollection = project.fileTree("$konanHome/konan/lib/")