cardano-rpc | Use buf for code generation instead of cabal/protoc integration #963
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.
Changelog
Context
Current state
In the previous version of
cardano-rpcpackage, the code was generated during cabal-build which was prolonging build process and was pullingproto-lens-protocinto the dependency tree. This was prone to breakage and was causing complicated issues with cabal's dependency resolution.The proposed solution
This PR changes that by using an external tool buf which allows to generate code from protobuf definitions for various languages. This should be extended for typescript/javascript code generation later.
The caveat here is that it includes generated files in the repository which have following effects:
The end goal is to not use generated code in the production code (or minimal amount of it), and rely on the packages provided by utxorpc:
The ultimate purpose of keeping the generated code in the repository is the ease of work on proto files when one would like to introduce changes to proto definitions without having to go through utxorpc upstream, which is a time consuming process.
Alternatives
An alternative is to move the generated code using
bufto a separate repository. The separate repository would be integrated by SRP only when it's needed.Pros
More separation, smaller diffs. We would only have to rely on SRP for the period of working on new changes to proto files.
Cons
More detached work, changes to proto files less visible. Process of updating a separate repo is more time consuming.
Checklist