-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
28 lines (24 loc) · 981 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::io::prelude::*;
use std::{fs::File, process::Command};
fn main() {
// only run this build script for generating the license information on relevant files
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=Cargo.lock");
println!("cargo:rerun-if-changed=about.toml");
println!("cargo:rerun-if-changed=about.hbs");
let out = Command::new("cargo-about")
.arg("generate")
.arg("about.hbs")
.output()
.expect("failed to execute generate license command! Is cargo-about installed?");
if !out.status.success() {
eprintln!(
"{}",
String::from_utf8(out.stderr).expect("could not parse output as text")
);
panic!("failed to generate license information");
}
let mut file = File::create("license.html").expect("could not open file for license.html");
file.write_all(&out.stdout)
.expect("could not write to license.html");
}