-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Remove tree-sitter
dependency from tree-sitter-generate
#4117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Remove tree-sitter
dependency from tree-sitter-generate
#4117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not have parser.h
live in two spots, this makes it very easy for them to be out of sync. The main reasons being this file is a lot more likely to be updated compared to alloc.h/array.h, and because those other files are slightly different due to differences in parser code vs the core library.
I also think include_str
wouldn't work when publishing.
dad7b1e
to
a15a868
Compare
I changed it to a symlink, |
Symlinks break windows though.. |
Could it be copied on build time through |
Pretty sure you can't access files outside the crate root when publishing, but it works for local builds/installs |
Seems like this is adding maintenance complexity. Why is this change needed? |
For me the main motivation is experimenting with trading off size for performance in a non-web wasm environment which at least currently cannot compile If this is too much of a hassle I can just use a fork, but it seems like 90% of the work to separate |
I think it makes sense, and the current solution could be to use a build script for local development/installation, and in CI, before we publish our crates, ensure we run this build script beforehand (I would think |
ping @bbb651? |
It was only used to share two constants, and balloons it's dependencies. This also makes `generate_parser_for_grammar` work in wasm. (Tested in `wasm32-wasip2` in wasmtime with the json grammar, `wasm32-unknown-unknown` running in the same setup exited successfully so I'm pretty confident it works as well)
a15a868
to
ce351b3
Compare
After a bunch of trail and error I landed on a solution that passes Also I used a small hack to get the workspace root in a consistent way, that also simplifies |
c3db6d6
to
a6f8e0f
Compare
Sorry about that, I resolved the conflicts in the web editor and didn't get the formatting right |
It was only used to share two constants, and balloons it's dependencies.
This also makes
generate_parser_for_grammar
work in wasm. (Tested inwasm32-wasip2
in wasmtime with the json grammar,wasm32-unknown-unknown
running in the same setup exited successfully so I'm pretty confident it works as well).I wasn't sure what to do with
parser.h
, I could'veinclude_str!
ed it outside the crate, or symlinked it, but I didn't find a conscious if this is ok to do, and apparentlycargo publish
warns against the first one, so I ended up copying it likealloc.h
andarray.h
(I'm aware these aren't exact copies likeparser.h
). The other constant wasLANGUAGE_VERSION
,ABI_VERSION_MIN
andABI_VERSION_WITH_RESERVED_WORDS
need to be updated anyway so it's not really a problem to manually update it too.