Skip to content

Commit 4351262

Browse files
authored
Merge pull request #4 from processing-cpp/add-linux-ts-native
Add build-linux-ts-native workflow
2 parents 9c0f4b6 + 9e58109 commit 4351262

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build Linux java-tree-sitter native (.so)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Install build tools
13+
run: |
14+
sudo apt-get update
15+
sudo apt-get install -y build-essential cmake git openjdk-17-jdk-headless
16+
17+
- name: Clone java-tree-sitter 1.9.1
18+
run: |
19+
git clone --depth 1 --branch 1.9.1 \
20+
https://github.com/seart-group/java-tree-sitter.git java-tree-sitter
21+
22+
- name: Build native library
23+
run: |
24+
cd java-tree-sitter
25+
# The native CMake target produces libjava-tree-sitter.so
26+
cmake -B build \
27+
-DCMAKE_BUILD_TYPE=Release \
28+
-DCMAKE_C_FLAGS="-O2" \
29+
-DJTREESITTER_BUILD_SHARED_LIBS=ON
30+
cmake --build build --target java-tree-sitter -- -j$(nproc)
31+
# Find the .so wherever CMake placed it
32+
find build -name "libjava-tree-sitter.so"
33+
34+
- name: Copy to libs/linux-x64/
35+
run: |
36+
mkdir -p libs/linux-x64
37+
find java-tree-sitter/build -name "libjava-tree-sitter.so" \
38+
-exec cp {} libs/linux-x64/ \;
39+
echo "Built:"
40+
file libs/linux-x64/libjava-tree-sitter.so
41+
ldd libs/linux-x64/libjava-tree-sitter.so
42+
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: linux-ts-native
46+
path: libs/linux-x64/libjava-tree-sitter.so
47+
retention-days: 90

0 commit comments

Comments
 (0)