-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathgenerate_proto.rs
More file actions
28 lines (22 loc) · 850 Bytes
/
generate_proto.rs
File metadata and controls
28 lines (22 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
use std::path::PathBuf;
pub fn generate_proto() -> anyhow::Result<()> {
let vortex_proto = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../vortex-proto");
let proto_files = vec![
vortex_proto.join("proto").join("dtype.proto"),
vortex_proto.join("proto").join("scalar.proto"),
vortex_proto.join("proto").join("expr.proto"),
];
for file in &proto_files {
if !file.exists() {
anyhow::bail!("proto file not found: {file:?}");
}
}
let out_dir = vortex_proto.join("src").join("generated");
std::fs::create_dir_all(&out_dir)?;
prost_build::Config::new()
.out_dir(out_dir)
.compile_protos(&proto_files, &[vortex_proto.join("proto")])?;
Ok(())
}