Skip to content

Commit

Permalink
ci: fix build.rs
Browse files Browse the repository at this point in the history
ignore the no proto files
  • Loading branch information
wuhuizuo committed Apr 1, 2024
1 parent 644d774 commit 3dddeca
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,27 @@
// limitations under the License.

use protobuf_build::Builder;
use std::fs;

fn main() {
let proto_dir = "proto";
let mut proto_files = Vec::new();

// Walk the proto directory and collect all .proto files.
for entry in fs::read_dir(proto_dir).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.is_file() {
if let Some(ext) = path.extension() {
if ext == "proto" {
proto_files.push(path.to_string_lossy().into_owned());
}
}
}
}

Builder::new()
.search_dir_for_protos("proto")
.files(&proto_files)
.append_to_black_list("eraftpb")
.generate()
}

0 comments on commit 3dddeca

Please sign in to comment.