Skip to content
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

parser: move code generation into a test #901

Merged
merged 2 commits into from Apr 28, 2022

Conversation

djc
Copy link
Contributor

@djc djc commented Apr 25, 2022

Move the pest parser code generation step into a test. Makes it so that downstream users don't have to spend the time compiling some of the dependencies (in this case, pest_meta and its sha-1 dependency).

Inspired by steveklabnik/semver-parser#50. It's not as big an improvement here because we still depend on serde's Serialize and Deserialize macros, but seems like a nice improvement anyway.

@sunli829
Copy link
Collaborator

LGTM 🙂

@sunli829 sunli829 changed the base branch from master to actix-web-v4-beta April 27, 2022 01:06
@sunli829 sunli829 changed the base branch from actix-web-v4-beta to async-graphql-v4 April 27, 2022 01:07
@sunli829 sunli829 merged commit aa93485 into async-graphql:async-graphql-v4 Apr 28, 2022
@sunli829
Copy link
Collaborator

@djc An absolute path will be generated here, do you know how to solve it? 😁

include_str!("/Users/sunli/work/async-graphql/parser/src/graphql.pest");

@djc
Copy link
Contributor Author

djc commented Apr 28, 2022

Ah, so I guess the pest derive macro expands the relative path to the grammar to an absolute path? I guess you can just patch up the generated code in the code generation test, by generating the same absolute path and replacing it with a relative path?

Also, what's the reason for merging this into the v4 branch? It seems semver-compatible, so could just go in v3, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants