2023-09-22 02:57:26 +02:00
|
|
|
fn main() {
|
|
|
|
println!("cargo:rerun-if-changed=api/lua");
|
2024-01-14 06:15:14 +01:00
|
|
|
println!("cargo:rerun-if-changed=api/lua_grpc");
|
2024-01-13 04:48:07 +01:00
|
|
|
println!("cargo:rerun-if-changed=api/protocol");
|
|
|
|
|
|
|
|
let xdg = xdg::BaseDirectories::with_prefix("pinnacle").unwrap();
|
|
|
|
|
|
|
|
let data_dir = xdg.create_data_directory("").unwrap();
|
|
|
|
|
2024-01-15 06:38:05 +01:00
|
|
|
let remove_protos = format!("rm -r {data_dir:?}/protobuf");
|
2024-01-13 04:48:07 +01:00
|
|
|
let copy_protos = format!("cp -r ./api/protocol {data_dir:?}/protobuf");
|
|
|
|
|
2024-01-15 06:38:05 +01:00
|
|
|
std::process::Command::new("/bin/sh")
|
|
|
|
.arg("-c")
|
|
|
|
.arg(&remove_protos)
|
|
|
|
.spawn()
|
|
|
|
.unwrap()
|
|
|
|
.wait()
|
|
|
|
.unwrap();
|
|
|
|
|
2024-01-13 04:48:07 +01:00
|
|
|
std::process::Command::new("/bin/sh")
|
|
|
|
.arg("-c")
|
|
|
|
.arg(©_protos)
|
|
|
|
.spawn()
|
2024-01-15 06:38:05 +01:00
|
|
|
.unwrap()
|
|
|
|
.wait()
|
2024-01-13 04:48:07 +01:00
|
|
|
.unwrap();
|
|
|
|
|
2023-09-22 02:57:26 +02:00
|
|
|
std::process::Command::new("/bin/sh")
|
|
|
|
.arg("install_libs.sh")
|
|
|
|
.spawn()
|
2024-01-15 06:38:05 +01:00
|
|
|
.unwrap()
|
|
|
|
.wait()
|
2023-09-22 02:57:26 +02:00
|
|
|
.unwrap();
|
2024-01-16 04:53:13 +01:00
|
|
|
|
|
|
|
std::env::set_current_dir("api/lua_grpc").unwrap();
|
|
|
|
std::process::Command::new("/bin/sh")
|
|
|
|
.arg("luarocks")
|
|
|
|
.arg("make")
|
|
|
|
.arg("--local")
|
|
|
|
.spawn()
|
|
|
|
.expect("Luarocks is not installed");
|
2023-09-22 02:57:26 +02:00
|
|
|
}
|