|
6 | 6 | ./gradlew jar |
7 | 7 |
|
8 | 8 | # 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 |
10 | 17 |
|
11 | 18 | # 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 | + |
13 | 24 | javac -cp "${MYLIB_CLASSPATH}" Example.java |
14 | 25 |
|
15 | 26 | if [ "$(uname -s)" = 'Linux' ] |
|
19 | 30 | elif [ "$(uname -s)" = 'Darwin' ] |
20 | 31 | then |
21 | 32 | 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)" |
23 | 34 | fi |
| 35 | +echo "SWIFT_LIB_PATHS = ${SWIFT_LIB_PATHS}" |
24 | 36 |
|
25 | 37 | # Can we run the example? |
26 | | -SWIFTKIT_CLASSPATH="$(ls ../../SwiftKit/build/libs/*.jar)" |
27 | 38 | 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}" \ |
30 | 41 | Example |
0 commit comments