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 d9846b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- sig-approvers
- sig-approvers
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 d9846b0

Please sign in to comment.