diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-09 22:00:59 +0200 |
| commit | 620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39 (patch) | |
| tree | e97e54ff112c8e3fa9f88335bfd1275420a4d69f /crates/daemon/build.rs | |
| parent | chore: Separate daemon, client, server, and lib into crates (diff) | |
| download | atuin-620cf8fa33835c1ce1e56b1028ff6e2a6fbe0f39.zip | |
chore: Add more things
Diffstat (limited to 'crates/daemon/build.rs')
| -rw-r--r-- | crates/daemon/build.rs | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/crates/daemon/build.rs b/crates/daemon/build.rs index ad4bc3c8..646b8588 100644 --- a/crates/daemon/build.rs +++ b/crates/daemon/build.rs @@ -1,48 +1,34 @@ -use std::process::Command; use std::{env, fs, path::PathBuf}; use protox::Compiler; use protox::prost::Message; fn main() -> Result<(), std::io::Error> { - { - let output = Command::new("git").args(["rev-parse", "HEAD"]).output(); + let proto_paths = [ + "proto/history.proto", + "proto/search.proto", + "proto/control.proto", + "proto/semantic.proto", + ]; + let proto_include_dirs = ["proto"]; - let sha = match output { - Ok(sha) => String::from_utf8(sha.stdout).unwrap(), - Err(_) => String::from("NO_GIT"), - }; + let file_descriptor_set = Compiler::new(proto_include_dirs) + .map_err(std::io::Error::other)? + .include_source_info(true) + .include_imports(true) + .open_files(proto_paths) + .map_err(std::io::Error::other)? + .file_descriptor_set(); - println!("cargo:rustc-env=GIT_HASH={sha}"); - } + 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_descriptor_set.encode_to_vec()).unwrap(); - { - let proto_paths = [ - "proto/history.proto", - "proto/search.proto", - "proto/control.proto", - "proto/semantic.proto", - ]; - let proto_include_dirs = ["proto"]; - - let file_descriptor_set = Compiler::new(proto_include_dirs) - .map_err(std::io::Error::other)? - .include_source_info(true) - .include_imports(true) - .open_files(proto_paths) - .map_err(std::io::Error::other)? - .file_descriptor_set(); - - 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_descriptor_set.encode_to_vec()).unwrap(); - - tonic_prost_build::configure() - .build_server(true) - .file_descriptor_set_path(&file_descriptor_path) - .skip_protoc_run() - .compile_protos(&proto_paths, &proto_include_dirs)?; - } + tonic_prost_build::configure() + .build_server(true) + .file_descriptor_set_path(&file_descriptor_path) + .skip_protoc_run() + .compile_protos(&proto_paths, &proto_include_dirs)?; Ok(()) } |
