Move xdrgen Rust generator into this repository #449
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Move the Rust xdrgen generator, currently embedded in xdrgen, into this repository. Use xdrgen the library with the generator located here as a custom generator to generate the Rust code for the XDR.
Why
The Rust generator is tightly coupled with the code in this repository. It would be pretty painful to use the generator in isolation of this code. The workflow we use when updating the generated code is to change xdrgen then test it with rs-stellar-xdr. The tight coupling makes that pretty awkward.
I think looking forward it's more ideal that generators live near the SDKs they generate code for. Maybe one day the Rust generator becomes so unstable we aren't changing it anymore, and then it could move back into xdrgen as a built-in generator. But at the moment this move will make iterating on rs-stellar-xdr much more convenient and faster.
The change bringing the generator into this repository creates new opportunities. We could rewrite some of the generator to share common types between curr and next, which would probably make the stellar-xdr crate smaller / faster to build and easier to use. But this PR focused just on moving the generator over. Improvements can follow separately.
Merging
Dependent on:
Related: