Skip to content

Commit af6b313

Browse files
committed
fixing classpaths and library paths...
1 parent df75e74 commit af6b313

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ let javaIncludePath = "\(javaHome)/include"
8686
let package = Package(
8787
name: "SwiftJava",
8888
platforms: [
89-
.macOS(.v13)
89+
.macOS(.v15)
9090
],
9191
products: [
9292
// ==== JavaKit (i.e. calling Java directly Swift utilities)

Samples/JavaDependencySampleApp/ci-validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ swift run --disable-sandbox
88

99
# explicitly invoke resolve without explicit path or dependency
1010
# the dependencies should be uses from the --swift-module
11-
.build/plugins/tools/debug/SwiftJavaTool-tool resolve \
11+
swift run swift-java resolve \
1212
Sources/JavaCommonsCSV/swift-java.config \
1313
--swift-module JavaCommonsCSV \
1414
--output-directory .build/plugins/outputs/javadependencysampleapp/JavaCommonsCSV/destination/SwiftJavaPlugin/

Samples/SwiftAndJavaJarSampleLib/ci-validate.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@ set -x
66
./gradlew jar
77

88
# we make sure to build and run with JDK 24 because the runtime needs latest JDK, unlike Gradle which needed 21.
9-
export PATH="${PATH}:/usr/lib/jvm/jdk-24/bin"
9+
if [ "$(uname -s)" = 'Darwin' ]
10+
then
11+
export OS='osx'
12+
elif [ "$(uname -s)" = 'Linux' ]
13+
then
14+
export OS='linux'
15+
export PATH="${PATH}:/usr/lib/jvm/jdk-24/bin" # we need to make sure to use the latest JDK to actually compile/run the executable
16+
fi
1017

1118
# check if we can compile a plain Example file that uses the generated Java bindings that should be in the generated jar
12-
MYLIB_CLASSPATH="$(ls bin/default/build/libs/*.jar)"
19+
SWIFTKIT_CLASSPATH="$(pwd)/$(find ../../SwiftKit/build/libs/*${OS}*jar | head -n1 | xargs dirname)"
20+
MYLIB_CLASSPATH="$(pwd)/$(find build/libs/*${OS}*jar | head -n1 | xargs dirname)"
21+
CLASSPATH="$(pwd):${SWIFTKIT_CLASSPATH}:${MYLIB_CLASSPATH}"
22+
echo "CLASSPATH = ${CLASSPATH}"
23+
1324
javac -cp "${MYLIB_CLASSPATH}" Example.java
1425

1526
if [ "$(uname -s)" = 'Linux' ]
@@ -19,12 +30,12 @@ then
1930
elif [ "$(uname -s)" = 'Darwin' ]
2031
then
2132
SWIFT_LIB_PATHS=$(find "$(swiftly use --print-location)" | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
22-
SWIFT_LIB_PATHS="${SWIFT_LIB_PATHS}:$(find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname)"
33+
SWIFT_LIB_PATHS="${SWIFT_LIB_PATHS}:$(pwd)/$(find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname)"
2334
fi
35+
echo "SWIFT_LIB_PATHS = ${SWIFT_LIB_PATHS}"
2436

2537
# Can we run the example?
26-
SWIFTKIT_CLASSPATH="$(ls ../../SwiftKit/build/libs/*.jar)"
2738
java --enable-native-access=ALL-UNNAMED \
28-
-Djava.library.path="${SWIFT_LIB_PATHS}" \
29-
-cp ".:${MYLIB_CLASSPATH}:${SWIFTKIT_CLASSPATH}" \
39+
-Djava.library.path="${SWIFT_LIB_PATHSSWIFT_LIB_PATHS}" \
40+
-cp "${CLASSPATH}" \
3041
Example

Samples/SwiftKitSampleApp/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let javaIncludePath = "\(javaHome)/include"
4343
let package = Package(
4444
name: "SwiftKitSampleApp",
4545
platforms: [
46-
.macOS(.v10_15)
46+
.macOS(.v15)
4747
],
4848
products: [
4949
.library(

0 commit comments

Comments
 (0)