-
-
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
Generating protobufs in the repo #30
Conversation
Thanks for the PR @clayrosenthal , that's a good start, but it will need some work:
Sorry if this could sound like too much, it is totally fine to leave it to someone else, but if you decide to pursue the goal I will be glad to continue reviews and giving the feedback. |
3128f15
to
0a072d2
Compare
Whoops, I meant to include the generated output in the PR, but I think the submodule renaming borked it. Reworked this to not rename the submodule.
Edit: Did some research, I put the generation behind the |
Yeah, exactly, just like it's done in https://github.com/tikv/rust-prometheus/blob/master/build.rs for example - when |
Why not to have updating behind |
Hmm good point. I'll just have |
0a072d2
to
b9148ce
Compare
b9148ce
to
00af9d0
Compare
Ok squashed the commits to try and keep the history prettier, should be good now |
Looks good! The only thing which puzzles me is why is there |
Couple of nitpicks:
|
it comes from |
Yeah in my project I just renamed the package in the build script, to my understanding that proto file is generated by some third party library nanopb/nanopb, but I don't quite get its use. |
The primary consumer of these proto files is the device firmware, and it uses the nanopb bindings. it's a very slim implementation of a protobuf subset. Most other consumers (e.g. apps and libs) use stock protoc with one or two flags to be compatible with the nanopb stuff we use. |
So if you're using the full protobuf directory you don't need the smaller nanopb? |
Nanopb also uses the full protobuf directory. The protobuf definitions are the same, with a few quirks needed to be performant on embedded systems. Nanopb is the interface library for the generated code. It needs the nanopb.proto to work but if you generate protoc code for other languages you don't need it and you can ignore errors from that file. |
Thanks for the effort @clayrosenthal, I've gave it run locally and it looks good to me. The only thing I noticed is that if I re-gen meshtastic.rs it differs from git version, I suppose it is because of different order of files in protobufs dir. Could you please add P.S. Sorry, one more thing - delete |
Ok, added a sort and removed the nanopb file with a description in the gitignore. Thanks for the guidance @krant |
Thanks a lot @clayrosenthal, now when run |
@lukipuki would you mind to review this and merge if it looks good to you? |
thanks lukipuki Co-authored-by: Lukáš Poláček <lukas@polacek.email>
Generating the protobufs in the build script, then storing them in
src/generated
to avoid name conflict. Only generate it with thegen
feature flag.