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 7
7
- name : Install System Dependencies
8
8
run : apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
9
9
shell : bash
10
- - name : Cache JDK
10
+ - name : Cache JDKs
11
11
id : cache-jdk
12
12
uses : actions/cache@v4
13
13
continue-on-error : true
14
14
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/*') }}
17
17
restore-keys : |
18
- ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}
18
+ ${{ runner.os }}-jdk-
19
19
- name : Install JDK
20
20
if : steps.cache-jdk.outputs.cache-hit != 'true'
21
21
run : " bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
Original file line number Diff line number Diff line change 3
3
set -e
4
4
set -x
5
5
6
- export PATH=" ${PATH} :${JAVA_HOME} /bin"
7
-
8
6
./gradlew jar
9
7
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
+
10
11
# 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
12
14
13
15
if [ " $( uname -s) " = ' Linux' ]
14
16
then
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
16
18
SWIFT_LIB_PATHS=" ${SWIFT_LIB_PATHS} :$( find . | grep libMySwiftLibrary.so$ | sort | head -n1 | xargs dirname) "
17
19
elif [ " $( uname -s) " = ' Darwin' ]
18
20
then
19
- # - find libswiftCore.dylib
20
21
SWIFT_LIB_PATHS=$( find " $( swiftly use --print-location) " | grep dylib$ | grep libswiftCore | grep macos | xargs dirname)
21
- # - find our library dylib
22
22
SWIFT_LIB_PATHS=" ${SWIFT_LIB_PATHS} :$( find . | grep libMySwiftLibrary.dylib$ | sort | head -n1 | xargs dirname) "
23
23
fi
24
24
25
25
# Can we run the example?
26
+ SWIFTKIT_CLASSPATH=" $( ls ../../SwiftKit/build/libs/* .jar) "
26
27
java --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} " \
28
30
Example
You can’t perform that action at this time.
0 commit comments