refactor: rewrite

This commit is contained in:
Kevin Yue
2023-02-17 01:21:36 -05:00
parent 7bef2ccc68
commit 19b9b757f4
194 changed files with 7885 additions and 8034 deletions

25
gpservice/build.rs Normal file
View File

@@ -0,0 +1,25 @@
use common::sha256_digest;
use std::path::Path;
use std::{env, fs};
fn main() {
let gpservice_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let profile = env::var("PROFILE").unwrap();
let gpclient_path = Path::new(&gpservice_dir)
.join("../target")
.join(profile)
.join("gpclient");
if !gpclient_path.exists() {
// error if gpclient doesn't exist
panic!("Please build gpclient first");
}
if let Ok(digest) = sha256_digest(gpclient_path) {
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = format!("{out_dir}/client_hash.rs");
fs::write(dest_path, format!("pub const GPCLIENT_HASH: &str = \"{digest}\";")).unwrap();
} else {
panic!("Error: Unable to get gpclient hash");
}
}