2024-02-02 08:18:09 +03:00
|
|
|
use std::{fs, io::copy};
|
2024-02-02 07:43:13 +03:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if std::env::var("SKIP_BUILD_SCRIPT").is_ok() {
|
|
|
|
println!("Skipping build script");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let pwd = std::env::current_dir().unwrap();
|
|
|
|
|
|
|
|
// Pull wit from git repo
|
|
|
|
let wit_dir = pwd.join("wit");
|
|
|
|
fs::create_dir_all(&wit_dir).unwrap();
|
|
|
|
let wit_file = wit_dir.join("kinode.wit");
|
|
|
|
if !wit_file.exists() {
|
|
|
|
// TODO: cache in better way
|
|
|
|
let mut wit_file = fs::File::create(&wit_file).unwrap();
|
|
|
|
let kinode_wit_url =
|
2024-02-05 20:06:38 +03:00
|
|
|
"https://raw.githubusercontent.com/kinode-dao/kinode-wit/master/kinode.wit";
|
2024-02-02 07:43:13 +03:00
|
|
|
let mut response = reqwest::blocking::get(kinode_wit_url).unwrap();
|
|
|
|
copy(&mut response, &mut wit_file).unwrap();
|
|
|
|
}
|
|
|
|
}
|