-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(cli)!: add a separate build command to compile parsers #3174
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
Conversation
671e588
to
16d2bc9
Compare
Nice, this is great. |
e55cda2
to
a9eea46
Compare
|
||
You can specify where to output the shared object file (native or WASM) with the `--output`/`-o` flag, which accepts either an absolute path or relative path. Note that if you don't supply this flag, the CLI will attempt to figure out what the language name is based on the parent directory (so building in `tree-sitter-javascript` will resolve to `javascript`) to use for the output file. If it can't figure it out, it will default to `parser`, thus generating `parser.so` or `parser.wasm` in the current working directory. | ||
|
||
Lastly, you can also specify a path to the actual grammar directory, in case you are not currently in one. This is done by providing a path as the first *positional* argument. |
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.
Can this be a list of paths? It'd be nice to be able to build multi-language parsers in one go.
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.
how would this work with -o
?
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.
Good question. 🤔
Is there a support matrix for cc-rust (platforms, compilers) we can link to? (Would be nice to have something similar for the |
Not exactly, though this would be nice. All I've found is this https://docs.rs/cc/latest/cc/#compile-time-requirements |
9dbdaba
to
ba50037
Compare
This allows users to build parsers without having to run `test` or `parse` to invoke the compilation process, and allows them to output the object file to wherever they like. The `build-wasm` command was merged into this by just specifying the `--wasm` flag.
It seems by "merged" what was meant was that the Assuming so... Is it possible to keep the old subcommand method of invocation available [1]? There are likely scripts and documentation that reference For reference, I believe the [1] So the old invocation method might use the new code underneath? |
This allows users to build parsers without having to run
test
orparse
to invoke the compilation process, and allows them to output the object file to wherever they like. Thebuild-wasm
command was merged into this by just specifying the--wasm
flag.