Skip to content

Commit 6d3f19a

Browse files
committed
Patch java-tree-sitter jar with glibc .so instead of preloading
1 parent 2f0a5a6 commit 6d3f19a

2 files changed

Lines changed: 194 additions & 246 deletions

File tree

.github/workflows/build-linux-ts-native.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Install build tools
1313
run: |
1414
sudo apt-get update
15-
sudo apt-get install -y build-essential python3 git openjdk-17-jdk-headless
15+
sudo apt-get install -y build-essential python3 git openjdk-17-jdk-headless maven
1616
1717
- name: Clone java-tree-sitter
1818
run: |
@@ -21,8 +21,6 @@ jobs:
2121
- name: Init top-level grammar submodules (no nested)
2222
run: |
2323
cd java-tree-sitter
24-
# Default submodule update does NOT recurse into nested submodules.
25-
# That avoids the toptal/gitignore auth failure.
2624
git submodule update --init --depth 1 --jobs 8
2725
2826
- name: Build native library (all grammars, glibc)
@@ -33,13 +31,23 @@ jobs:
3331
file libjava-tree-sitter.so
3432
ldd libjava-tree-sitter.so
3533
36-
- name: Copy to libs/linux-x64/
34+
- name: Patch java-tree-sitter-1.9.1.jar with glibc .so
3735
run: |
38-
mkdir -p libs/linux-x64
39-
cp java-tree-sitter/libjava-tree-sitter.so libs/linux-x64/
36+
JAR="mode/java-tree-sitter-1.9.1.jar"
37+
if [ ! -f "$JAR" ]; then
38+
echo "ERROR: $JAR not found in repo"
39+
exit 1
40+
fi
41+
cp "$JAR" "$JAR.bak"
42+
# Replace the bundled musl .so with our glibc-compiled one
43+
zip -j "$JAR" java-tree-sitter/libjava-tree-sitter.so
44+
echo "Patched $JAR:"
45+
unzip -l "$JAR" | grep "\.so\|\.dylib"
4046
4147
- uses: actions/upload-artifact@v4
4248
with:
4349
name: linux-ts-native
44-
path: libs/linux-x64/libjava-tree-sitter.so
50+
path: |
51+
java-tree-sitter/libjava-tree-sitter.so
52+
mode/java-tree-sitter-1.9.1.jar
4553
retention-days: 90

0 commit comments

Comments
 (0)