-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
278: Add versioning to cache r=lachlansneff a=MarkMcCaskey resolves #272 Co-authored-by: Mark <mark@marks-macbook-pro.local> Co-authored-by: Mark McCaskey <mark@wasmer.io> Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
- Loading branch information
Showing
5 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,5 @@ field-offset = "0.1.1" | |
[features] | ||
debug = [] | ||
|
||
[build-dependencies] | ||
blake2b_simd = "0.4.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use blake2b_simd::blake2bp; | ||
use std::{env, fs, io::Write, path::PathBuf}; | ||
|
||
const WASMER_VERSION: &'static str = env!("CARGO_PKG_VERSION"); | ||
|
||
fn main() { | ||
let mut state = blake2bp::State::new(); | ||
state.update(WASMER_VERSION.as_bytes()); | ||
|
||
let hasher = state.finalize(); | ||
let hash_string = hasher.to_hex().as_str().to_owned(); | ||
|
||
let crate_dir = env::var("OUT_DIR").unwrap(); | ||
let wasmer_version_hash_file = { | ||
let mut path = PathBuf::from(&crate_dir); | ||
path.push("wasmer_version_hash.txt"); | ||
path | ||
}; | ||
|
||
let mut f_out = fs::File::create(wasmer_version_hash_file) | ||
.expect("Could not create file for wasmer hash value"); | ||
|
||
f_out | ||
.write_all(hash_string.as_bytes()) | ||
.expect("Could not write to file for wasmer hash value"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters