mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-29 03:34:44 +01:00
9fa223eaaf
* chore(build): compile protobufs with protox protox is a pure-rust implementation of the protobuf compiler. Therefore, it can be managed by cargo. This removes the implicit dependency on protoc being available in the environment for the build. * fix(build): replace copypasta in build script The paths passed to `compile` aren't actually used by the build. `skip_protoc_run` prevents that. That's why a clean build succeeds even with this mistake. However, the paths are passed to a `cargo:rerun-if-changed` directive. So this mistake would've caused a failed incremental build if the protobuf definitions were changed.
18 lines
594 B
Rust
18 lines
594 B
Rust
use std::{env, fs, path::PathBuf};
|
|
|
|
use protox::prost::Message;
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
let file_descriptors = protox::compile(["history.proto"], ["./proto/"]).unwrap();
|
|
|
|
let file_descriptor_path = PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR not set"))
|
|
.join("file_descriptor_set.bin");
|
|
fs::write(&file_descriptor_path, file_descriptors.encode_to_vec()).unwrap();
|
|
|
|
tonic_build::configure()
|
|
.build_server(true)
|
|
.file_descriptor_set_path(&file_descriptor_path)
|
|
.skip_protoc_run()
|
|
.compile(&["history.proto"], &["."])
|
|
}
|