2021-06-06 14:48:48 -07:00
|
|
|
use std::error::Error;
|
2021-07-09 14:32:00 -07:00
|
|
|
use std::process::Command;
|
2021-06-06 14:48:48 -07:00
|
|
|
|
2021-06-06 15:17:42 -07:00
|
|
|
use vergen::{vergen, Config, ShaKind};
|
2021-06-06 14:48:48 -07:00
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
2021-07-09 14:32:00 -07:00
|
|
|
// Initialize vergen stuff
|
2021-06-06 15:17:42 -07:00
|
|
|
let mut config = Config::default();
|
|
|
|
*config.git_mut().sha_kind_mut() = ShaKind::Short;
|
|
|
|
vergen(config)?;
|
2021-07-09 14:32:00 -07:00
|
|
|
|
|
|
|
// Initialize SQL stuff
|
|
|
|
let project_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
|
|
Command::new("mkdir")
|
|
|
|
.args(["cache", "--parents"])
|
|
|
|
.current_dir(&project_root)
|
|
|
|
.output()?;
|
|
|
|
|
|
|
|
Command::new("sqlite3")
|
|
|
|
.args(["cache/metadata.sqlite", include_str!("db_queries/init.sql")])
|
|
|
|
.current_dir(&project_root)
|
|
|
|
.output()?;
|
|
|
|
|
2021-06-06 14:48:48 -07:00
|
|
|
Ok(())
|
|
|
|
}
|