cli, lib: inline grammar definitions into .rs files#4336
Conversation
When building Jujutsu crates as a dependency in a Buck project, the usage of
`#[grammar]` requires the `.pest` files in the code to be in the `$PWD` relative
to where the Rust compiler is invoked on the crate; which isn't identical to how
it is done by Cargo, causing a build failure ("file not found").
Rather than special case a Buck build path into the codebase for this (only used
by downstream consumers in other projects), inlining the grammar definition into
a new Rust file makes this go away.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
When building Jujutsu crates as a dependency in a Buck project, the usage of
`#[grammar]` requires the `.pest` files in the code to be in the `$PWD` relative
to where the Rust compiler is invoked on the crate; which isn't identical to how
it is done by Cargo, causing a build failure ("file not found").
Rather than special case a Buck build path into the codebase for this (only used
by downstream consumers in other projects), inlining the grammar definition into
a new Rust file makes this go away.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
To be clear: I mean when I try to use |
|
@yuja I know you work a lot on the parsers, more than anyone else, so I'm particularly keen on your feedback. I can maybe keep trying to find workarounds on my side so we don't need this patch, but if this doesn't make your life too much worse or you're ok with it, it would be nice. |
|
For ease of maintenance, I prefer a separate
Apparently the search paths are:
https://github.com/pest-parser/pest/blob/master/generator/src/lib.rs#L68 I don't know buck or bazel, but maybe cargo environment variables could be faked? |
|
Aha, I was in fact holding it wrong and was able to diagnose it; there is a flag for setting |
When building Jujutsu crates as a dependency in a Buck project, the usage of
#[grammar]requires the.pestfiles in the code to be in the$PWDrelative to where the Rust compiler is invoked on the crate; which isn't identical to how it is done by Cargo, causing a build failure ("file not found").Rather than special case a Buck build path into the codebase for this (only used by downstream consumers in other projects), inlining the grammar definition into a new Rust file makes this go away.
Checklist
If applicable:
CHANGELOG.md