-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
21 lines (18 loc) · 874 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern crate vergen;
use vergen::ConstantsFlags;
fn main() {
// Generate flags about build information
let flags = ConstantsFlags::BUILD_TIMESTAMP
| ConstantsFlags::SEMVER
| ConstantsFlags::BUILD_DATE
| ConstantsFlags::SHA_SHORT;
vergen::gen(flags).expect("Unable to generate the cargo keys!");
// Download vue file
let vue_url = "https://unpkg.com/vue@3.0.5/dist/vue.global.js";
let mut resp = reqwest::blocking::get(vue_url)
.expect(&format!("Failed to download vue file: {}", &vue_url));
let vue_file_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/html/vue.js");
let mut output_file = std::fs::File::create(&vue_file_path)
.expect(&format!("Failed to create vue file: {:?}", &vue_file_path));
std::io::copy(&mut resp, &mut output_file).expect("Failed to copy content.");
}