about summary refs log tree commit diff
path: root/kittybox-rs/build.rs
blob: c639cf8a79aa5725c16745f0c97a1c9051f6d1c9 (plain) (blame)
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
fn main() {
    use std::env;
    let out_dir = env::var("OUT_DIR").unwrap();

    println!("cargo:rerun-if-changed=companion-lite/");
    let companion_out = std::path::Path::new(&out_dir).join("companion");

    if let Ok(exit) = std::process::Command::new("tsc")
        .arg("--outDir")
        .arg(companion_out.as_os_str())
        .current_dir("companion-lite")
        .spawn()
        .unwrap()
        .wait()
    {
        if !exit.success() {
            std::process::exit(exit.code().unwrap_or(1))
        }
    }
    let companion_in = std::path::Path::new("companion-lite");
    for file in ["index.html", "style.css"] {
        std::fs::copy(
            companion_in.join(file),
            &companion_out.join(file)
        ).unwrap();
    }
}