Skip to content

Commit 034f0d0

Browse files
authored
Merge pull request tree-sitter#1864 from tree-sitter/wasm-language
Add optional WASM feature to the native library, allowing it to run wasm-compiled parsers via wasmtime
2 parents 016d8c2 + 13dd76e commit 034f0d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9633
-508
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ jobs:
4141
- linux-x64 #
4242
- linux-x86 #
4343
- linux-i586 #
44-
- linux-mips #
45-
- linux-mips64 #
46-
- linux-mipsel #
47-
- linux-mips64el #
4844
- linux-powerpc #
4945
- linux-powerpc64 #
5046
- linux-powerpc64el #
@@ -67,13 +63,9 @@ jobs:
6763
- { platform: linux-armhf , target: arm-unknown-linux-gnueabihf , os: ubuntu-latest , use-cross: true }
6864
- { platform: linux-armv5te , target: armv5te-unknown-linux-gnueabi , os: ubuntu-latest , use-cross: true }
6965
- { platform: linux-armv7l , target: armv7-unknown-linux-gnueabihf , os: ubuntu-latest , use-cross: true }
70-
- { platform: linux-x64 , target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } #2272
66+
- { platform: linux-x64 , target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 , enable-wasm: true } #2272
7167
- { platform: linux-x86 , target: i686-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
7268
- { platform: linux-i586 , target: i586-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
73-
- { platform: linux-mips , target: mips-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
74-
- { platform: linux-mips64 , target: mips64-unknown-linux-gnuabi64 , os: ubuntu-latest , use-cross: true }
75-
- { platform: linux-mipsel , target: mipsel-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
76-
- { platform: linux-mips64el , target: mips64el-unknown-linux-gnuabi64 , os: ubuntu-latest , use-cross: true }
7769
- { platform: linux-powerpc , target: powerpc-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
7870
- { platform: linux-powerpc64 , target: powerpc64-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
7971
- { platform: linux-powerpc64el , target: powerpc64le-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
@@ -82,10 +74,10 @@ jobs:
8274
- { platform: linux-sparc64 , target: sparc64-unknown-linux-gnu , os: ubuntu-latest , use-cross: true }
8375
- { platform: linux-thumbv7neon , target: thumbv7neon-unknown-linux-gnueabihf , os: ubuntu-latest , use-cross: true }
8476
- { platform: windows-arm64 , target: aarch64-pc-windows-msvc , os: windows-latest }
85-
- { platform: windows-x64 , target: x86_64-pc-windows-msvc , os: windows-latest }
77+
- { platform: windows-x64 , target: x86_64-pc-windows-msvc , os: windows-latest , enable-wasm: true }
8678
- { platform: windows-x86 , target: i686-pc-windows-msvc , os: windows-latest }
87-
- { platform: macos-arm64 , target: aarch64-apple-darwin , os: macos-latest }
88-
- { platform: macos-x64 , target: x86_64-apple-darwin , os: macos-latest }
79+
- { platform: macos-arm64 , target: aarch64-apple-darwin , os: macos-latest , enable-wasm: true }
80+
- { platform: macos-x64 , target: x86_64-apple-darwin , os: macos-latest , enable-wasm: true }
8981

9082
# Cross compilers for C library
9183
- { platform: linux-arm64 , cc: aarch64-linux-gnu-gcc , ar: aarch64-linux-gnu-ar }
@@ -95,10 +87,6 @@ jobs:
9587
- { platform: linux-armv7l , cc: arm-linux-gnueabihf-gcc , ar: arm-linux-gnueabihf-ar }
9688
- { platform: linux-x86 , cc: i686-linux-gnu-gcc , ar: i686-linux-gnu-ar }
9789
- { platform: linux-i586 , cc: i686-linux-gnu-gcc , ar: i686-linux-gnu-ar }
98-
- { platform: linux-mips , cc: mips-linux-gnu-gcc , ar: mips-linux-gnu-ar }
99-
- { platform: linux-mips64 , cc: mips64-linux-gnuabi64-gcc , ar: mips64-linux-gnuabi64-ar }
100-
- { platform: linux-mipsel , cc: mipsel-linux-gnu-gcc , ar: mipsel-linux-gnu-ar }
101-
- { platform: linux-mips64el , cc: mips64el-linux-gnuabi64-gcc , ar: mips64el-linux-gnuabi64-ar }
10290
- { platform: linux-powerpc , cc: powerpc-linux-gnu-gcc , ar: powerpc-linux-gnu-ar }
10391
- { platform: linux-powerpc64 , cc: powerpc64-linux-gnu-gcc , ar: powerpc64-linux-gnu-ar }
10492
- { platform: linux-powerpc64el , cc: powerpc64le-linux-gnu-gcc , ar: powerpc64le-linux-gnu-ar }
@@ -107,12 +95,6 @@ jobs:
10795
- { platform: linux-sparc64 , cc: sparc64-linux-gnu-gcc , ar: sparc64-linux-gnu-ar }
10896
- { platform: linux-thumbv7neon , cc: arm-linux-gnueabihf-gcc , ar: arm-linux-gnueabihf-ar }
10997

110-
# Rust toolchains
111-
- { platform: linux-mips , rust-toolchain: 1.71.1 }
112-
- { platform: linux-mips64 , rust-toolchain: 1.71.1 }
113-
- { platform: linux-mipsel , rust-toolchain: 1.71.1 }
114-
- { platform: linux-mips64el , rust-toolchain: 1.71.1 }
115-
11698
# See #2041 tree-sitter issue
11799
- { platform: windows-x64 , rust-test-threads: 1 }
118100
- { platform: windows-x86 , rust-test-threads: 1 }
@@ -138,7 +120,7 @@ jobs:
138120

139121
- name: Read Emscripten version
140122
run: |
141-
echo "EMSCRIPTEN_VERSION=$(cat cli/emscripten-version)" >> $GITHUB_ENV
123+
echo "EMSCRIPTEN_VERSION=$(cat cli/loader/emscripten-version)" >> $GITHUB_ENV
142124
143125
- name: Install Emscripten
144126
if: ${{ !matrix.cli-only && !matrix.use-cross }}
@@ -184,6 +166,7 @@ jobs:
184166
CC: ${{ matrix.cc }}
185167
AR: ${{ matrix.ar }}
186168
IS_WINDOWS: ${{ contains(matrix.os, 'windows') }}
169+
ENABLE_WASM: ${{ matrix.enable-wasm }}
187170
run: |
188171
PATH="$PWD/.github/scripts:$PATH"
189172
echo "$PWD/.github/scripts" >> $GITHUB_PATH
@@ -200,6 +183,10 @@ jobs:
200183
201184
[ "$IS_WINDOWS" = "false" ] && echo "CFLAGS=-Werror" >> $GITHUB_ENV
202185
186+
if [ "$ENABLE_WASM" == "true" ]; then
187+
echo "CLI_FEATURES=wasm" >> $GITHUB_ENV
188+
fi
189+
203190
if [ "$USE_CROSS" == "true" ]; then
204191
echo "BUILD_CMD=cross" >> $GITHUB_ENV
205192
runner=$(BUILD_CMD=cross cross.sh bash -c "env | sed -nr '/^CARGO_TARGET_.*_RUNNER=/s///p'")
@@ -215,7 +202,7 @@ jobs:
215202
run: script/build-wasm
216203

217204
- name: Build CLI
218-
run: $BUILD_CMD build --release --target=${{ matrix.target }}
205+
run: $BUILD_CMD build --release --target=${{ matrix.target }} --features=${CLI_FEATURES}
219206

220207
- name: Info about CLI
221208
if: ${{ startsWith(matrix.platform, 'linux') }}

0 commit comments

Comments
 (0)