-
Notifications
You must be signed in to change notification settings - Fork 21
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
Simplify proto gen #52
Simplify proto gen #52
Conversation
Wow awesome I'll take a look! |
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.
This is an amazing improvement. I was hunting for the reference to our protos, but it's in build.rs pointing at https://buf.build/xmtp/proto right?
Having a separate crate for protos is probably a better idea too!
@@ -0,0 +1,25 @@ | |||
// @generated | |||
pub mod xmtp { |
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.
I feel like a moron for having to handwrite this file myself in the original branch. I felt like a genius at the time for figuring out how to deal with our package names though 😅
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.
Oh man, I never would have figured that out on my own.
Feel free to merge whenever! |
* feat: get gRPC compiling into networking crate * fix: attempt to fix weird package name nesting situation * fix: actually got it right * feat: add silly grpc client test * feat: added crappy grpc test * wip: need to run local node to test * wip: checkpoint, getting connection error detected: frame with invalid size, trying to add tls now * feat: rountrip publish/query in Rust * docs: fix up comments * feat: do a full grpc roundtrip as a Swift test * docs: remove warnings * fix: return uint16 status code for grpc test too * fix: chunk up auth token to avoid false positives in secret detection * feat: everything builds, Generated code is populated, now need to hook up to xmtp-ios * feat: Swift-Bridge, manually copy headers into include * fix: strip out corecrypto for now, framework down to 230MB * feat: add library size optimizations * feat: refactor into publish and query with serialized versions * feat: cleaned up and implemented query and publish * style: ran clippy * feat: full e2e build working, if jank * test: added a failing base64 bytes encoding test * fix: do a serde encoding override to base64 encode bytes fields in MessageApi * feat: implement subscribe_once api * Simplify proto gen (#52) * Initial commit * Include lib * Add features * Correct import * Add feature * Add pbjson * Almost passing * Add build.rs * Add .gitignore * Rename folder * Remove generated code * Gitignore generated * Automatically install required dependency * fix: Makefile change target dir to ./target workaround Cargo workspace * Update gitignore * Delete .gitmodules * Delete Cargo.lock * fix: remove bindings/xmtp_rust_swift from cargo workspace * fix: remove xmtp_rust_swift from workspace to use size-optimized profiles --------- Co-authored-by: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Co-authored-by: Nicholas Molnar <nicholas@xmtp.com>
* feat: get gRPC compiling into networking crate * fix: attempt to fix weird package name nesting situation * fix: actually got it right * feat: add silly grpc client test * feat: added crappy grpc test * wip: need to run local node to test * wip: checkpoint, getting connection error detected: frame with invalid size, trying to add tls now * feat: rountrip publish/query in Rust * docs: fix up comments * feat: do a full grpc roundtrip as a Swift test * docs: remove warnings * fix: return uint16 status code for grpc test too * fix: chunk up auth token to avoid false positives in secret detection * feat: everything builds, Generated code is populated, now need to hook up to xmtp-ios * feat: Swift-Bridge, manually copy headers into include * fix: strip out corecrypto for now, framework down to 230MB * feat: add library size optimizations * feat: refactor into publish and query with serialized versions * feat: cleaned up and implemented query and publish * style: ran clippy * feat: full e2e build working, if jank * test: added a failing base64 bytes encoding test * fix: do a serde encoding override to base64 encode bytes fields in MessageApi * feat: implement subscribe_once api * Simplify proto gen (#52) * Initial commit * Include lib * Add features * Correct import * Add feature * Add pbjson * Almost passing * Add build.rs * Add .gitignore * Rename folder * Remove generated code * Gitignore generated * Automatically install required dependency * fix: Makefile change target dir to ./target workaround Cargo workspace * Update gitignore * Delete .gitmodules * Delete Cargo.lock * fix: remove bindings/xmtp_rust_swift from cargo workspace * fix: remove xmtp_rust_swift from workspace to use size-optimized profiles * Rename repo * Streaming support * Rename back to subscription * Make tests pass * Update bindings * Fix merge conflicts * Include libxmtp-core and wasm bindings * Make poll_subscription non-async * Re-pin --------- Co-authored-by: Michael Xu <michaeljxu11@gmail.com> Co-authored-by: Michael Xu <michaelx@xmtp.com>
Summary
Trying a different approach to generating protobuf code.
Advantages are:
build.rs
config with no special overrides needed for serialization.Notes
Some things to watch out for:
.serde.rs
file for all the protos. One side effect of this is that zero'd proto fields are no longer present in JSON output. I had to update one of your tests to accomodate the change.bytes
fields are serialized as base64 strings, which this generated Serde setup seems to do by default. But there may be other less desirable changes that I haven't noticed yet.xmtp-networking
, but my knowledge of Rust modules is just not there to debug the issue. If you can make it work, that's probably better.