feat: v0.1.11 add rebuild
This commit is contained in:
@@ -36,9 +36,10 @@ fn main() {
|
||||
|
||||
fn build_script_command(rust_script: PathBuf, script_file: &str, script_sha256: &str, cache_script_bin_name: &str) -> Command {
|
||||
let skip_cache = is_env_on("RUNRS_SKIP_CACHE");
|
||||
let rebuild = is_env_on("RUNRS_REBUILD");
|
||||
let cache_script_bin_name_exists = fs::metadata(&cache_script_bin_name).is_ok();
|
||||
debugging!("Bin name: {} {}exists", cache_script_bin_name, iff!(cache_script_bin_name_exists, "", "not "));
|
||||
if !skip_cache && cache_script_bin_name_exists {
|
||||
if !rebuild && !skip_cache && cache_script_bin_name_exists {
|
||||
Command::new(&cache_script_bin_name)
|
||||
} else {
|
||||
let mut cmd = Command::new(rust_script);
|
||||
@@ -46,6 +47,9 @@ fn build_script_command(rust_script: PathBuf, script_file: &str, script_sha256:
|
||||
information!("Cached binary not exists, RUNRS_SILENT_BUILD=1 turn off");
|
||||
cmd.arg("--cargo-output");
|
||||
}
|
||||
if rebuild {
|
||||
cmd.arg("--force");
|
||||
}
|
||||
cmd.args(&["--bin-name", &script_sha256, script_file]);
|
||||
cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user