aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/build.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
commit5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8 (patch)
treec64baa8d5866c8e339eaf660dd3f94f30a3f7d8a /crates/turtle/build.rs
parentchore: Somewhat simplify sync code (diff)
downloadatuin-5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8.zip
chore: Move everything into one big crate
That helps remove duplicated code and rustc/cargo will now also show dead code correctly.
Diffstat (limited to 'crates/turtle/build.rs')
-rw-r--r--crates/turtle/build.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/turtle/build.rs b/crates/turtle/build.rs
new file mode 100644
index 00000000..5f26e26c
--- /dev/null
+++ b/crates/turtle/build.rs
@@ -0,0 +1,39 @@
+use std::process::Command;
+use std::{env, fs, path::PathBuf};
+
+use protox::prost::Message;
+
+fn main() -> Result<(), std::io::Error> {
+ {
+ let output = Command::new("git").args(["rev-parse", "HEAD"]).output();
+
+ let sha = match output {
+ Ok(sha) => String::from_utf8(sha.stdout).unwrap(),
+ Err(_) => String::from("NO_GIT"),
+ };
+
+ println!("cargo:rustc-env=GIT_HASH={sha}");
+ }
+
+ {
+ let proto_paths = [
+ "proto/history.proto",
+ "proto/search.proto",
+ "proto/control.proto",
+ "proto/semantic.proto",
+ ];
+ let proto_include_dirs = ["proto"];
+
+ let file_descriptors = protox::compile(proto_paths, proto_include_dirs).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_prost_build::configure()
+ .build_server(true)
+ .file_descriptor_set_path(&file_descriptor_path)
+ .skip_protoc_run()
+ .compile_protos(&proto_paths, &proto_include_dirs)
+ }
+}