Skip to content

Commit df75e74

Browse files
committed
correct jdk caching, now that we have to cache two JDKs
1 parent d81c735 commit df75e74

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

.github/actions/prepare_env/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ runs:
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'"

Samples/SwiftAndJavaJarSampleLib/ci-validate.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@
33
set -e
44
set -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

1315
if [ "$(uname -s)" = 'Linux' ]
1416
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
1618
SWIFT_LIB_PATHS="${SWIFT_LIB_PATHS}:$(find . | grep libMySwiftLibrary.so$ | sort | head -n1 | xargs dirname)"
1719
elif [ "$(uname -s)" = 'Darwin' ]
1820
then
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)"
2323
fi
2424

2525
# Can we run the example?
26+
SWIFTKIT_CLASSPATH="$(ls ../../SwiftKit/build/libs/*.jar)"
2627
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}" \
2830
Example

0 commit comments

Comments
 (0)