Skip to content

Commit

Permalink
chore: update tree-sitter to official version (#6237)
Browse files Browse the repository at this point in the history
Turns out tree-sitter is releasing stuff much faster nowadays!

While doing this, I noticed we no longer need to hack the C build as much. Removed that the whole sysroot thing. I could remove the locked CC and AR but it has actually been pretty nice having that locked to not worry about what contributors have installed. I'd be nice to one day use zig instead.

This new tree-sitter version also seems to compile a litter faster, so that's a nice bonus.

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
MarkMcCulloh authored Apr 14, 2024
1 parent 952327c commit c6fccec
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 28 deletions.
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[env]
WASI_SDK = { value = ".cargo/wasi-sdk-21.0", relative = true }
# tree-sitter build fails with newer version of clang unless implicit-function-declaration is ignored
CC_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/clang -Wno-error=implicit-function-declaration", relative = true }
AR_wasm32_wasi = { value = ".cargo/wasi-sdk-21.0/bin/ar", relative = true }
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions libs/tree-sitter-wing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
path = "bindings/rust/lib.rs"

[dependencies]
# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" }
tree-sitter = "0.22.5"

[build-dependencies]
cc = "1.0.87"
12 changes: 0 additions & 12 deletions libs/tree-sitter-wing/bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,5 @@ fn main() {
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());

if cfg!(target_arch = "wasm32") {
// This parser is used in a WASI context, so it needs to be compiled with
// the sysroot and other tools needed for WASI-compatible C
c_config.flag(
format!(
"--sysroot={}/share/wasi-sysroot",
env!("WASI_SDK", "WASI_SDK env not set")
)
.as_str(),
);
}

c_config.compile("tree-sitter-wing");
}
2 changes: 1 addition & 1 deletion libs/tree-sitter-wing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
},
"devDependencies": {
"nodemon": "^3.1.0",
"tree-sitter-cli": "0.22.4"
"tree-sitter-cli": "0.22.5"
}
}
2 changes: 1 addition & 1 deletion libs/tree-sitter-wing/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build:generate": {
"inputs": ["!*.wasm", "*", "grammar.js", "src/scanner.c"],
"outputs": ["src/**", "!src/scanner.c", "bindings/**", "binding.gyp"]
"outputs": ["src/**", "!src/scanner.c"]
},
"build:wasm": {
"dependsOn": ["build:generate"],
Expand Down
3 changes: 1 addition & 2 deletions libs/wingc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ version = "0.0.0"
edition = "2021"

[dependencies]
# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" }
tree-sitter = "0.22.5"
derivative = "2.2"
tree-sitter-wing = { path = "../tree-sitter-wing" }
wingii = { path = "../wingii" }
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c6fccec

Please sign in to comment.