File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
.github/actions/prepare_env
Samples/SwiftAndJavaJarSampleLib Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 77 - name : Install System Dependencies
88 run : apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
99 shell : bash
10- - name : Cache JDK
10+ - name : Cache JDKs
1111 id : cache-jdk
1212 uses : actions/cache@v4
1313 continue-on-error : true
1414 with :
15- path : /usr/lib/jvm/default-jdk/
16- key : ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/ *') }}
15+ path : /usr/lib/jvm/
16+ key : ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/*') }}
1717 restore-keys : |
18- ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}
18+ ${{ runner.os }}-jdk-
1919 - name : Install JDK
2020 if : steps.cache-jdk.outputs.cache-hit != 'true'
2121 run : " bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
Original file line number Diff line number Diff line change 33set -e
44set -x
55
6- export PATH=" ${PATH} :${JAVA_HOME} /bin"
7-
86./gradlew jar
97
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"
10+
1011# check if we can compile a plain Example file that uses the generated Java bindings that should be in the generated jar
11- javac -cp bin/default/build/libs/* jar Example.java
12+ MYLIB_CLASSPATH=" $( ls bin/default/build/libs/* .jar) "
13+ javac -cp " ${MYLIB_CLASSPATH} " Example.java
1214
1315if [ " $( uname -s) " = ' Linux' ]
1416then
15- SWIFT_LIB_PATHS=$HOME /.local/share/swiftly/toolchains/6.2-snapshot-2025-06-17/ usr/lib/swift/linux/
17+ SWIFT_LIB_PATHS=/ usr/lib/swift/linux
1618 SWIFT_LIB_PATHS=" ${SWIFT_LIB_PATHS} :$( find . | grep libMySwiftLibrary.so$ | sort | head -n1 | xargs dirname) "
1719elif [ " $( uname -s) " = ' Darwin' ]
1820then
19- # - find libswiftCore.dylib
2021 SWIFT_LIB_PATHS=$( find " $( swiftly use --print-location) " | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
21- # - find our library dylib
2222 SWIFT_LIB_PATHS=" ${SWIFT_LIB_PATHS} :$( find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname) "
2323fi
2424
2525# Can we run the example?
26+ SWIFTKIT_CLASSPATH=" $( ls ../../SwiftKit/build/libs/* .jar) "
2627java --enable-native-access=ALL-UNNAMED \
27- -Djava.library.path=" ${SWIFT_LIB_PATHS} " -cp " .:bin/default/build/libs/*:../../SwiftKit/build/libs/*" \
28+ -Djava.library.path=" ${SWIFT_LIB_PATHS} " \
29+ -cp " .:${MYLIB_CLASSPATH} :${SWIFTKIT_CLASSPATH} " \
2830 Example
You can’t perform that action at this time.
0 commit comments