Comments (8)
I'm just passing by to 👍 this issue.
I'm using ProtoBufs in a Rust project for work and we currently have a monorepo that holds all our protobuffers (and a very long 200+ LoC Makefile
) to build them I've spent a few hours to integrate this tool this morning and exposing a way to pass args to --proto_path
is desperately needed via the build.rs
file.
from prost.
@valarauca That's already possible, have you seen the docs in https://github.com/danburkert/prost/tree/master/prost-build README? prost_build::compile_protos
's second argument is the include paths. Note that the protobuf builtin .protos are already included (the well known types stuff).
from prost.
I'm really not sure I understand (or I misstated my issue).
I'm attempting to retrofit prost
into our my companies existing structure without breaking anything.
Structure example:
proto/
----Makefile
----build.gradle
----Gopkg.toml
----Gopkg.lock
-----team/
---------team.proto
-----another_team/
---------name1.proto
---------name2.proto
So this becomes
proto/
----Cargo.toml
----build.rs
----Makefile
----build.gradle
----Gopkg.toml
----Gopkg.lock
-----src/
---------lib.rs
---------item.rs #Hopefuly
-----team/
---------team.proto
-----another_team/
---------name1.proto
---------name2.proto
If I just do something like prost_build::compile_protos(&["agent/agent.proto"], &[], None).unwrap()
This fails as agent.proto
's package is agent.proto
So I should do prost_build::compile_protos(&[], &["agent/agent.proto"], None).unwrap()
?
I will try this but currently I cannot build prost
requires bytes = "0.1.2"
which requires nightly? I see 0.4
is called out, but 0.1.2
is always fetched by cargo
. I attempted to fully purge my ~/.cargo/registry
I've attempted to rm -rf ~/.cargo/register
and cargo update
ref neither solves the bytes = "0.1.2"
requirement. It ends up being the second crate that is fetched.
from prost.
Yes, this is currently supported. The first arg to compile_protos
is the list of .proto
s you want to compile (you can skip any that are transitively imported, you only have to include the 'root' .protos). The second arg is the include paths. What the include paths should be depends on what the package
declaration in the protobufs is, but assuming that's package team;
and package another_team;
, and we're compiling from the first source tree above, I think you want:
prost_build::compile_protos(&["src/team/team.proto"], &["src/"], None).unwrap()
from prost.
Awesome. Any clue what's up with the bytes v0.1.2
being imported?
My first attempt it didn't happen, but on the 2nd, 3rd, and 4th it crashed and burned. Currently I can't even build anything that requires prost
.
from prost.
hmm, no. My usual route for debugging issues like that is to inspect Cargo.lock and figure out where they are coming from. prost
and prost-build
have a dependency on 0.4, so it shouldn't be pulling in 0.1.
from prost.
Interesting.
I'll throw this in queue.
from prost.
A code generator config has been added in 17474e8. @valarauca if you're still having build issues feel free to open another issue.
from prost.
Related Issues (20)
- Stack overflow when decoding a recursive message with `proto2` syntax
- The `prost-build` link in the documentation is invalid HOT 1
- Follow up, implement `Name` trait implementation via `prost-build`
- Bug on codegen in ::prost::Enumeration HOT 7
- Some well-known protobuf types are missing in `prost-types` HOT 1
- Error when cross compiling using `cross build` HOT 7
- How i can get `full_name` of a Message? HOT 1
- Panic in `prost-build` with potentially unsupported `extern_path`
- Buf/ButMut bounds should be ?Sized HOT 2
- Implementing `prost::Message` externally is annoying, we need to improve it HOT 1
- bytes dependency is locked to 1.0.x
- prost_build::Config::prost_path is unusable. HOT 2
- Deserialization not working properly anymore after updating message HOT 1
- Can you clarify whether prost works with no_std? HOT 1
- How to get <T> instead of Option<T> as default representation for all user-defined message types HOT 1
- `enable_type_names` fails for multiple proto files with the same package name. Is this expected? HOT 2
- HOWTO decode a serialized protobuf (in C) within Rust (prost crate)? HOT 2
- prost-build doc link broken on docs.rs HOT 2
- `prost-types` crate missing Well Known Types from google.protobuf.wrapper HOT 1
- feature: Deterministic Serialization HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prost.