Skip to content

Commit

Permalink
adding to the package-template dir
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-ant committed Dec 17, 2024
1 parent 5a07d0f commit d3698d6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions package-templates/rust/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::fs;
use std::io::Path;
use std::io::Write;

use std::process::Command;

fn main() {
if !Path::new("./ui").exists() {
// no UI to build
return;
}
// Touch a marker file to ensure that cargo reruns this build script no matter what
// unless it may decide in appropriately that it doesn't need to run the script.
fs::File::create("./ui_build")
.unwrap()
.write_all(b"")
.unwrap();

Command::new("yarn")
.current_dir("./ui")
.status()
.expect("Failed to run `yarn`");
Command::new("yarn")
.args(&["build"])
.current_dir("./ui")
.status()
.expect("Failed to run build project");
}

0 comments on commit d3698d6

Please sign in to comment.