From 7a5c05b72df106f61679e5d115b5e2ede5f96ad3 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 28 Sep 2018 14:31:25 +0300 Subject: [PATCH] Filter java.endorsed.dirs property in K/N runner --- .../kotlin/compilerRunner/KotlinNativeToolRunner.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinNativeToolRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinNativeToolRunner.kt index ff536872b3a..a4b48637f27 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinNativeToolRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/KotlinNativeToolRunner.kt @@ -84,6 +84,9 @@ internal abstract class KonanCliRunner( } ?: emptyList() } + protected val blacklistProperties: Set = + setOf("java.endorsed.dirs") + override val classpath: FileCollection = project.fileTree("${project.konanHome}/konan/lib/") .apply { include("*.jar") } @@ -106,7 +109,7 @@ internal abstract class KonanCliRunner( private fun String.escapeQuotes() = replace("\"", "\\\"") - private fun List>.escapeQuotesForWindows() = + private fun Sequence>.escapeQuotesForWindows() = if (HostManager.hostIsMingw) { map { (key, value) -> key.escapeQuotes() to value.escapeQuotes() } } else { @@ -119,7 +122,7 @@ internal abstract class KonanCliRunner( project.logger.info("Run tool: $toolName with args: ${args.joinToString(separator = " ")}") if (classpath.isEmpty) { throw IllegalStateException("Classpath of the tool is empty: $toolName\n" + - "Probably the 'konan.home' project property contains an incorrect path.\n" + + "Probably the '${KotlinNativeProjectProperty.KONAN_HOME_OVERRIDE}' project property contains an incorrect path.\n" + "Please change it to the compiler root directory and rerun the build.") } @@ -128,8 +131,9 @@ internal abstract class KonanCliRunner( spec.classpath = classpath spec.jvmArgs(jvmArgs) spec.systemProperties( - System.getProperties() + System.getProperties().asSequence() .map { (k, v) -> k.toString() to v.toString() } + .filter { (k, _) -> k !in blacklistProperties } .escapeQuotesForWindows() .toMap() )