Get rid of java.library.path when running the K/N compiler

This commit is contained in:
Ilya Matveev
2020-04-27 16:28:01 +07:00
committed by Ilya Matveev
parent 903d780194
commit a99c22fbcf
8 changed files with 6 additions and 25 deletions
+3 -6
View File
@@ -192,13 +192,11 @@ final List<File> stdLibSrc = [
] ]
// These files are built before the 'dist' is complete, // These files are built before the 'dist' is complete,
// so we provide custom values for // so we provide custom values for konan.home, --runtime etc
// konan.home, --runtime, -Djava.library.path etc
targetList.each { target -> targetList.each { target ->
def konanJvmArgs = [*HostManager.regularJvmArgs, def konanJvmArgs = [*HostManager.regularJvmArgs,
"-Dkonan.home=${rootProject.projectDir}/dist", "-Dkonan.home=${rootProject.projectDir}/dist"
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
] ]
def defaultArgs = ['-nopack', '-nostdlib', '-no-default-libs', '-no-endorsed-libs'] def defaultArgs = ['-nopack', '-nostdlib', '-no-default-libs', '-no-endorsed-libs']
@@ -295,8 +293,7 @@ task debugCompiler(type: JavaExec) {
classpath = project.fileTree("${distDir.canonicalPath}/konan/lib/") { classpath = project.fileTree("${distDir.canonicalPath}/konan/lib/") {
include '*.jar' include '*.jar'
} }
jvmArgs "-Dorg.jetbrains.kotlin.native.home=${distDir.canonicalPath}", jvmArgs "-Dorg.jetbrains.kotlin.native.home=${distDir.canonicalPath}"
"-Djava.library.path=${distDir.canonicalPath}/konan/nativelib"
enableAssertions = true enableAssertions = true
args = findProperty("konan.debug.args").toString().tokenize() ?: [] args = findProperty("konan.debug.args").toString().tokenize() ?: []
} }
+1 -2
View File
@@ -13,8 +13,7 @@ test {
def dist = project.rootProject.file("dist").canonicalPath def dist = project.rootProject.file("dist").canonicalPath
systemProperties = [ systemProperties = [
'org.jetbrains.kotlin.native.home': dist, 'org.jetbrains.kotlin.native.home': dist
'java.library.path': "$dist/konan/nativelib"
] ]
} }
test.dependsOn ':dist' test.dependsOn ':dist'
@@ -79,8 +79,7 @@ class RunExternalTestGroup extends JavaExec {
classpath = project.fileTree("$dist.canonicalPath/konan/lib/") { classpath = project.fileTree("$dist.canonicalPath/konan/lib/") {
include '*.jar' include '*.jar'
} }
jvmArgs "-Dkonan.home=${dist.canonicalPath}", "-Xmx4G", jvmArgs "-Dkonan.home=${dist.canonicalPath}", "-Xmx4G"
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib"
enableAssertions = true enableAssertions = true
def sources = File.createTempFile(name,".lst") def sources = File.createTempFile(name,".lst")
sources.deleteOnExit() sources.deleteOnExit()
@@ -307,15 +307,5 @@ class NativeInteropPlugin implements Plugin<Project> {
interopStubGenerator project(path: ":Interop:StubGenerator") interopStubGenerator project(path: ":Interop:StubGenerator")
interopStubGenerator project(path: ":endorsedLibraries:kotlinx.cli", configuration: "jvmRuntimeElements") interopStubGenerator project(path: ":endorsedLibraries:kotlinx.cli", configuration: "jvmRuntimeElements")
} }
// FIXME: choose tasks more wisely
prj.tasks.withType(JavaExec) {
if (!name.endsWith("InteropStubs")) {
systemProperties "java.library.path": prj.files(
nativeLibsDir,
runtimeNativeLibsDir
).asPath
}
}
} }
} }
-1
View File
@@ -67,7 +67,6 @@ NATIVE_LIB="${KONAN_HOME}/konan/nativelib"
java_opts=(-ea \ java_opts=(-ea \
-Xmx3G \ -Xmx3G \
-XX:TieredStopAtLevel=1 \ -XX:TieredStopAtLevel=1 \
"-Djava.library.path=${NATIVE_LIB}" \
"-Dkonan.home=${KONAN_HOME}" \ "-Dkonan.home=${KONAN_HOME}" \
-Dfile.encoding=UTF-8 \ -Dfile.encoding=UTF-8 \
${JAVA_OPTS}) ${JAVA_OPTS})
-1
View File
@@ -62,7 +62,6 @@ set "KONAN_CLASSPATH=%KONAN_JAR%;%TROVE_JAR%"
set JAVA_OPTS=-ea ^ set JAVA_OPTS=-ea ^
-Xmx3G ^ -Xmx3G ^
-XX:TieredStopAtLevel=1 ^ -XX:TieredStopAtLevel=1 ^
"-Djava.library.path=%NATIVE_LIB%" ^
"-Dkonan.home=%_KONAN_HOME%" ^ "-Dkonan.home=%_KONAN_HOME%" ^
-Dfile.encoding=UTF-8 ^ -Dfile.encoding=UTF-8 ^
%JAVA_OPTS% %JAVA_OPTS%
@@ -74,7 +74,6 @@ def nativeSrc = new File("$projectDir/src/main/kotlin-native")
targetList.each { target -> targetList.each { target ->
def konanJvmArgs = [*HostManager.regularJvmArgs, def konanJvmArgs = [*HostManager.regularJvmArgs,
"-Dkonan.home=${rootProject.projectDir}/dist", "-Dkonan.home=${rootProject.projectDir}/dist",
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
] ]
def defaultArgs = ['-nopack', '-no-default-libs', '-no-endorsed-libs'] def defaultArgs = ['-nopack', '-no-default-libs', '-no-endorsed-libs']
@@ -71,8 +71,7 @@ internal abstract class KonanCliRunner(
} }
override val additionalSystemProperties = mutableMapOf( override val additionalSystemProperties = mutableMapOf(
"konan.home" to konanHome, "konan.home" to konanHome
"java.library.path" to "$konanHome/konan/nativelib"
) )
override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1") override val environment = mutableMapOf("LIBCLANG_DISABLE_CRASH_RECOVERY" to "1")