Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ tasks.test {
"--enable-native-access=ALL-UNNAMED",

// Include the library paths where our dylibs are that we want to load and call
"-Djava.library.path=" +
(javaLibraryPaths(rootDir) + javaLibraryPaths(project.projectDir))
.joinToString(File.pathSeparator)
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(File.pathSeparator)
)
}

Expand Down
9 changes: 3 additions & 6 deletions BuildLogic/src/main/kotlin/utilities/javaLibraryPaths.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ fun Project.javaLibraryPaths(rootDir: File?): List<String> {
"${arch}-apple-macosx"
}

val paths: List<String> = listOf("release", "debug").flatMap { configuration ->
listOf(
"${base}.build/${triple}/$configuration/",
"${base}../../.build/${triple}/$configuration/",
)
val paths: List<String> = listOf("release", "debug").map { configuration ->
"${base}.build/${triple}/$configuration/"
}
val swiftRuntimePaths = swiftRuntimeLibraryPaths()

return paths + swiftRuntimePaths
}
}
4 changes: 2 additions & 2 deletions Samples/SwiftJavaExtractFFMSampleApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ application {
applicationDefaultJvmArgs = listOf(
"--enable-native-access=ALL-UNNAMED",
// Include the library paths where our dylibs are that we want to load and call
"-Djava.library.path=" + (javaLibraryPaths(rootDir) + javaLibraryPaths(project.projectDir)).joinToString(":"),
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(":"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's cleanup the : while we're here and use File.pathSeparator?

Suggested change
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(":"),
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(File.pathSeparator),

// Enable tracing downcalls (to Swift)
"-Djextract.trace.downcalls=true"
)
Expand All @@ -95,7 +95,7 @@ jmh {

jvmArgsAppend = listOf(
"--enable-native-access=ALL-UNNAMED",
"-Djava.library.path=" + (javaLibraryPaths(rootDir) + javaLibraryPaths(project.projectDir)).joinToString(":"),
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(":"),
// Enable tracing downcalls (to Swift)
"-Djextract.trace.downcalls=false"
)
Expand Down
6 changes: 3 additions & 3 deletions Samples/SwiftJavaExtractJNISampleApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ application {
applicationDefaultJvmArgs = listOf(
"--enable-native-access=ALL-UNNAMED",
// Include the library paths where our dylibs are that we want to load and call
"-Djava.library.path=" + (javaLibraryPaths(rootDir) + javaLibraryPaths(project.projectDir)).joinToString(":"),
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(":"),
// Enable tracing downcalls (to Swift)
"-Djextract.trace.downcalls=true"
)
Expand All @@ -107,7 +107,7 @@ jmh {

jvmArgsAppend = listOf(
"--enable-native-access=ALL-UNNAMED",
"-Djava.library.path=" + (javaLibraryPaths(rootDir) + javaLibraryPaths(project.projectDir)).joinToString(":"),
"-Djava.library.path=" + javaLibraryPaths(project.projectDir).joinToString(":"),
// Enable tracing downcalls (to Swift)
"-Djextract.trace.downcalls=false"
)
Expand All @@ -119,4 +119,4 @@ tasks.register("printGradleHome") {
println("Gradle Version: ${gradle.gradleVersion}")
println("Gradle User Home: ${gradle.gradleUserHomeDir}")
}
}
}
Loading