generate the hash at compile time

This commit is contained in:
Mark McCaskey
2019-03-19 10:58:58 -07:00
parent 874b613f56
commit 8e5f250ed0
6 changed files with 38 additions and 27 deletions

View File

@ -208,13 +208,5 @@ pub trait Cache {
fn store(&mut self, key: WasmHash, module: Module) -> Result<(), Self::StoreError>;
}
const WASMER_VERSION: &'static str = env!("CARGO_PKG_VERSION");
/// Returns a unique ID generated from the version of Wasmer for use with cache versioning
pub fn cache_versioned_sub_directory() -> String {
let mut state = blake2bp::State::new();
state.update(WASMER_VERSION.as_bytes());
let hasher = state.finalize();
hasher.to_hex().as_str().to_owned()
}
/// A unique ID generated from the version of Wasmer for use with cache versioning
pub const WASMER_VERSION_HASH: &'static str = include_str!("../wasmer_version_hash.txt");