Skip to content

Commit e7d3b29

Browse files
authored
Merge pull request tree-sitter#1180 from CyberShadow/pull-20210618-110411
Pin emscripten/emsdk Docker version
2 parents 2b83500 + b14ea51 commit e7d3b29

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
env:
1414
CARGO_TERM_COLOR: always
1515
CARGO_INCREMENTAL: 0
16-
EMSCRIPTEN_VERSION: 2.0.11
1716

1817
jobs:
1918
tests:
@@ -35,6 +34,10 @@ jobs:
3534
run: |
3635
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
3736
37+
- name: Read Emscripten version
38+
run: |
39+
printf 'EMSCRIPTEN_VERSION=%s\n' "$(cat emscripten-version)" >> $GITHUB_ENV
40+
3841
- name: Cache artifacts
3942
id: cache
4043
uses: actions/cache@v2

cli/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ fn main() {
99
if wasm_files_present() {
1010
println!("cargo:rustc-cfg={}", "TREE_SITTER_EMBED_WASM_BINDING");
1111
}
12+
13+
let emscripten_version = fs::read_to_string("../emscripten-version").unwrap();
14+
println!(
15+
"cargo:rustc-env={}={}",
16+
"EMSCRIPTEN_VERSION", emscripten_version
17+
);
1218
}
1319

1420
fn wasm_files_present() -> bool {

cli/src/wasm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::path::Path;
66
use std::process::Command;
77
use which::which;
88

9+
const EMSCRIPTEN_TAG: &'static str = concat!("emscripten/emsdk:", env!("EMSCRIPTEN_VERSION"));
10+
911
pub fn get_grammar_name(src_dir: &Path) -> Result<String> {
1012
let grammar_json_path = src_dir.join("grammar.json");
1113
let grammar_json = fs::read_to_string(&grammar_json_path)
@@ -61,7 +63,7 @@ pub fn compile_language_to_wasm(language_dir: &Path, force_docker: bool) -> Resu
6163
}
6264

6365
// Run `emcc` in a container using the `emscripten-slim` image
64-
command.args(&["emscripten/emsdk", "emcc"]);
66+
command.args(&[EMSCRIPTEN_TAG, "emcc"]);
6567
} else {
6668
return Err(anyhow!(
6769
"You must have either emcc or docker on your PATH to run this command"

emscripten-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.11

script/build-wasm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ web_dir=lib/binding_web
3333
emscripten_flags="-O3"
3434
minify_js=1
3535
force_docker=0
36+
emscripen_version=$(cat "$(dirname "$0")"/../emscripten-version)
3637

3738
while [[ $# > 0 ]]; do
3839
case "$1" in
@@ -63,11 +64,11 @@ emcc=
6364
if which emcc > /dev/null && [[ "$force_docker" == "0" ]]; then
6465
emcc=emcc
6566
elif which docker > /dev/null; then
66-
emcc="docker run \
67-
--rm \
68-
-v $(pwd):/src:Z \
69-
-u $(id -u) \
70-
emscripten/emsdk \
67+
emcc="docker run \
68+
--rm \
69+
-v $(pwd):/src:Z \
70+
-u $(id -u) \
71+
emscripten/emsdk:$emscripen_version \
7172
emcc"
7273
else
7374
echo 'You must have either `docker` or `emcc` on your PATH to run this script'

script/fetch-emscripten

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
EMSCRIPTEN_VERSION=2.0.9
5+
EMSCRIPTEN_VERSION=$(cat "$(dirname "$0")/../emscripten-version")
66

77
mkdir -p target
88
EMSDK_DIR="./target/emsdk"

0 commit comments

Comments
 (0)