Skip to content

Commit

Permalink
Revert "build: Skip empty protobuf files (#605)" (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco committed May 4, 2022
1 parent e74e220 commit b0cbe9c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 0 additions & 4 deletions prost-build/src/lib.rs
Expand Up @@ -880,10 +880,6 @@ impl Config {

let modules = self.generate(requests)?;
for (module, content) in &modules {
if content.is_empty() {
continue;
}

let file_name = file_names
.get(module)
.expect("every module should have a filename");
Expand Down
12 changes: 12 additions & 0 deletions tests/src/build.rs
Expand Up @@ -109,6 +109,18 @@ fn main() {
.compile_protos(&[src.join("well_known_types.proto")], includes)
.unwrap();

let out = std::env::var("OUT_DIR").unwrap();
let out_path = PathBuf::from(out).join("wellknown_include");

std::fs::create_dir_all(&out_path).unwrap();

prost_build::Config::new()
.bytes(&["."])
.out_dir(out_path)
.include_file("wellknown_include.rs")
.compile_protos(&[src.join("well_known_types.proto")], includes)
.unwrap();

config
.compile_protos(
&[src.join("packages/widget_factory.proto")],
Expand Down
8 changes: 8 additions & 0 deletions tests/src/well_known_types.rs
Expand Up @@ -61,3 +61,11 @@ fn test_timestamp() {
"hash for normalized should match and not inserted"
);
}

#[cfg(feature = "std")]
mod include {
include!(concat!(
env!("OUT_DIR"),
"/wellknown_include/wellknown_include.rs"
));
}

0 comments on commit b0cbe9c

Please sign in to comment.