Giter Club home page Giter Club logo

Comments (1)

william-smith-skydio avatar william-smith-skydio commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.