use md5 instead
This commit is contained in:
4 files changed
+15
-16
No files matched your search
Generated
+1
@@ -2557,6 +2557,7 @@ dependencies = [
|
|||||||
"dioxus-core",
|
"dioxus-core",
|
||||||
"dioxus-html",
|
"dioxus-html",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
"md5",
|
||||||
"serde",
|
"serde",
|
||||||
"sledgehammer_bindgen",
|
"sledgehammer_bindgen",
|
||||||
"sledgehammer_utils",
|
"sledgehammer_utils",
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ serde = { version = "1.0", features = ["derive"], optional = true }
|
|||||||
dioxus-core = { workspace = true, optional = true }
|
dioxus-core = { workspace = true, optional = true }
|
||||||
dioxus-html = { workspace = true, optional = true }
|
dioxus-html = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
md5 = "0.7.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
serialize = ["serde"]
|
serialize = ["serde"]
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ fn main() {
|
|||||||
let hash = hash_ts_files();
|
let hash = hash_ts_files();
|
||||||
|
|
||||||
// If the hash matches the one on disk, we're good and don't need to update bindings
|
// If the hash matches the one on disk, we're good and don't need to update bindings
|
||||||
let expected = include_str!("src/js/hash.txt").trim();
|
let expected = include_str!("./src/js/hash.txt").trim();
|
||||||
if expected == hash.to_string() {
|
if expected == hash.to_string() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!("Hashes match, no need to update bindings. {expected} != {hash}",);
|
// panic!("Hashes match, no need to update bindings. {expected} != {hash}",);
|
||||||
|
|
||||||
// Otherwise, generate the bindings and write the new hash to disk
|
// Otherwise, generate the bindings and write the new hash to disk
|
||||||
// Generate the bindings for both native and web
|
// Generate the bindings for both native and web
|
||||||
@@ -25,24 +25,19 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Hashes the contents of a directory
|
/// Hashes the contents of a directory
|
||||||
fn hash_ts_files() -> u128 {
|
fn hash_ts_files() -> String {
|
||||||
let mut out = 0;
|
let mut out = "".to_string();
|
||||||
|
|
||||||
let files: &[&[u8]] = &[
|
let files = &[
|
||||||
include_bytes!("src/ts/common.ts"),
|
include_str!("./src/ts/common.ts"),
|
||||||
include_bytes!("src/ts/native.ts"),
|
include_str!("./src/ts/native.ts"),
|
||||||
include_bytes!("src/ts/core.ts"),
|
include_str!("./src/ts/core.ts"),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Let's make the dumbest hasher by summing the bytes of the files
|
|
||||||
// The location is multiplied by the byte value to make sure that the order of the bytes matters
|
|
||||||
let mut idx = 0;
|
|
||||||
for file in files {
|
for file in files {
|
||||||
for byte in file.iter() {
|
out = format!("{out}{:?}", md5::compute(file));
|
||||||
idx += 1;
|
|
||||||
out += (*byte as u128) * (idx as u128);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
12705686530
|
3bd5a1310ebd728bdedb486881d5ad99151cf07b0006de52240dfd757ea3353e90df122a7ae681f33ff620cf15c47a20
|
||||||
Reference in new issue
Block a user