diff options
Diffstat (limited to 'kittybox-rs/templates/build.rs')
-rw-r--r-- | kittybox-rs/templates/build.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kittybox-rs/templates/build.rs b/kittybox-rs/templates/build.rs new file mode 100644 index 0000000..1140060 --- /dev/null +++ b/kittybox-rs/templates/build.rs @@ -0,0 +1,26 @@ +fn main() { + use std::env; + let out_dir = std::path::PathBuf::from(env::var("OUT_DIR").unwrap()); + println!("cargo:rerun-if-changed=assets/"); + let assets = std::fs::read_dir("assets").unwrap(); + for file in assets.map(|a| a.unwrap()) { + std::fs::copy( + file.path(), + out_dir.join(file.file_name()) + ) + .unwrap(); + } + println!("cargo::rerun-if-changed=javascript/"); + if let Ok(exit) = std::process::Command::new("tsc") + .arg("--outDir") + .arg(&out_dir) + .current_dir("javascript") + .spawn() + .unwrap() + .wait() + { + if !exit.success() { + std::process::exit(exit.code().unwrap_or(1)) + } + } +} |