Skip to content

Commit 954072b

Browse files
committed
enable complete validation of SwiftAndJavaJarSampleLib on linux
1 parent 9d4fd1b commit 954072b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Samples/SwiftAndJavaJarSampleLib/ci-validate.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ set -x
88
# check if we can compile a plain Example file that uses the generated Java bindings that should be in the generated jar
99
javac -cp bin/default/build/libs/*jar Example.java
1010

11-
1211
if [ "$(uname -s)" = 'Linux' ]
1312
then
14-
exit 1 # not implemented yet
13+
SWIFT_LIB_PATHS=$HOME/.local/share/swiftly/toolchains/6.2-snapshot-2025-06-17/usr/lib/swift/linux/
14+
SWIFT_LIB_PATHS="${SWIFT_LIB_PATHS}:$(find . | grep libMySwiftLibrary.so$ | sort | head -n1 | xargs dirname)"
1515
elif [ "$(uname -s)" = 'Darwin' ]
1616
then
17-
# Can we run the example?
1817
# - find libswiftCore.dylib
19-
SWIFT_DYLIB_PATHS=$(find "$(swiftly use --print-location)" | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
18+
SWIFT_LIB_PATHS=$(find "$(swiftly use --print-location)" | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
2019
# - find our library dylib
21-
SWIFT_DYLIB_PATHS="${SWIFT_DYLIB_PATHS}:$(find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname)"
22-
java -Djava.library.path="${SWIFT_DYLIB_PATHS}" -cp ".:bin/default/build/libs/*jar:../../SwiftKit/build/libs/*jar" Example
23-
fi
20+
SWIFT_LIB_PATHS="${SWIFT_LIB_PATHS}:$(find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname)"
21+
fi
22+
23+
# Can we run the example?
24+
java --enable-native-access=ALL-UNNAMED \
25+
-Djava.library.path="${SWIFT_LIB_PATHS}" -cp ".:bin/default/build/libs/*:../../SwiftKit/build/libs/*" \
26+
Example

0 commit comments

Comments
 (0)