mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Make wasm-builder check before copy/write files if the content is the same (#6149)
* Make `wasm-builder` check before copy/write files if the content is the same * Update utils/wasm-builder/src/lib.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -185,6 +185,17 @@ fn write_file_if_changed(file: PathBuf, content: String) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy `src` to `dst` if the `dst` does not exist or is different.
|
||||
fn copy_file_if_changed(src: PathBuf, dst: PathBuf) {
|
||||
let src_file = fs::read_to_string(&src).ok();
|
||||
let dst_file = fs::read_to_string(&dst).ok();
|
||||
|
||||
if src_file != dst_file {
|
||||
fs::copy(&src, &dst)
|
||||
.expect(&format!("Copying `{}` to `{}` can not fail; qed", src.display(), dst.display()));
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a cargo command that compiles with nightly
|
||||
fn get_nightly_cargo() -> CargoCommand {
|
||||
let env_cargo = CargoCommand::new(
|
||||
|
||||
Reference in New Issue
Block a user