mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-01 04:05:54 +00:00
26 lines
1.2 KiB
Rust
26 lines
1.2 KiB
Rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Use the protoc that ships with protoc-bin-vendored rather than a system
|
|
// one, so the build needs no package manager and always sees the same
|
|
// version. An explicit PROTOC still wins, for packagers supplying their own
|
|
// and for the lance crates, whose own build scripts read the same variable.
|
|
if std::env::var_os("PROTOC").is_none() {
|
|
// SAFETY: a build script's main runs single-threaded before anything
|
|
// else in this process, so no other thread can be reading the
|
|
// environment concurrently.
|
|
unsafe {
|
|
std::env::set_var("PROTOC", protoc_bin_vendored::protoc_bin_path()?);
|
|
}
|
|
}
|
|
|
|
// Compiled straight out of the Go tree, the way seaweed-volume already reads
|
|
// filer.proto, so the contract cannot drift from a vendored copy.
|
|
tonic_prost_build::configure()
|
|
// The server half is only for tests, which stand up a fake admin.
|
|
.build_server(true)
|
|
.build_client(true)
|
|
.protoc_arg("--experimental_allow_proto3_optional")
|
|
.compile_protos(&["../../../weed/pb/plugin.proto"], &["../../../weed/pb/"])?;
|
|
println!("cargo:rerun-if-changed=../../../weed/pb/plugin.proto");
|
|
Ok(())
|
|
}
|