Comments (1)
This may be better-characterized as an issue with protoc-gen-prost, although I haven't tried replicating without involving rules_rust yet. I am getting mileage out of this patch, and haven't found any issues so far:
diff --git a/protoc-gen-prost/src/lib.rs b/protoc-gen-prost/src/lib.rs
index 2098949..d92ab0a 100644
--- a/protoc-gen-prost/src/lib.rs
+++ b/protoc-gen-prost/src/lib.rs
@@ -84,21 +84,24 @@ impl ModuleRequestSet {
let requests = proto_file.into_iter().zip(raw_protos.proto_file).fold(
BTreeMap::new(),
|mut acc, (proto, raw)| {
- let module = Module::from_protobuf_package_name(proto.package());
let proto_filename = proto.name();
- let entry = acc
- .entry(module)
- .or_insert_with(|| ModuleRequest::new(proto.package().to_owned()));
-
- if entry.output_filename().is_none() && input_protos.contains(proto_filename) {
- let filename = match proto.package() {
- "" => default_package_filename.to_owned(),
- package => format!("{package}.rs"),
- };
- entry.with_output_filename(filename);
+ if input_protos.contains(proto_filename) {
+ let module = Module::from_protobuf_package_name(proto.package());
+ let entry = acc
+ .entry(module)
+ .or_insert_with(|| ModuleRequest::new(proto.package().to_owned()));
+
+ if entry.output_filename().is_none() {
+ let filename = match proto.package() {
+ "" => default_package_filename.to_owned(),
+ package => format!("{package}.rs"),
+ };
+ entry.with_output_filename(filename);
+ }
+
+ entry.push_file_descriptor_proto(proto, raw);
}
- entry.push_file_descriptor_proto(proto, raw);
acc
},
);
This is obviously related to neoeinstein/protoc-gen-prost#70.
It's not clear to me why we would ever want to generate types for a proto file not specified as one of the direct inputs, but perhaps this is important in other situations that don't happen with rules_rust.
I will follow up with an issue on protoc-gen-prost. I'll keep this issue open since it is also relevant to rules_rust, but feel free to close if you prefer.
from rules_rust.
Related Issues (20)
- rust analyzer support doesn't handle aliases properly
- repositories.bzl:835:9: name 'json' is not defined HOT 5
- gen_rust_project triggers download of -everything- HOT 1
- [Bazel CI] rust_project_json_test test is failing at Bazel@HEAD HOT 3
- segfault in test process glue when llvm_prof missing in rust 1.79
- rust_analyzer ignores repo srcs in crates with generated srcs HOT 2
- Wrong `exec_root` for `cargo_build_script`
- Make complete bazel_env development setup possible
- gen_rust_project seems to be confused by different compilation modes. HOT 1
- Get list of manifests to use with crates_repository HOT 1
- MUSL: Target x86_64_musl resolves incorrectly to x86_64-unknown-linux-gnu toolchain HOT 5
- Build fails on windows
- Bazel Coverage failing to generate lcov with `--@rules_rust//rust/settings:experimental_use_cc_common_link=true`
- gen_rust_project not downloading/generating a .so file HOT 1
- Unable to pass apparent repo labels to `crate.annotation` attributes
- Cannot build a no_std crate that uses a proc macro that uses std HOT 1
- Revendoring all crates is broken
- Add support for toolchain version from `rust-toolchain.toml` file
- Using crate_universe forces serial fetching of host and target toolchains HOT 1
- Integration with rust-analyzer's automatic project discovery HOT 1
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 rules_rust.