-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (26 loc) · 813 Bytes
/
Copy pathbuild.rs
File metadata and controls
28 lines (26 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
/// Files whose logic affects the cached index. When any of these change,
/// the cache version changes automatically and stale caches are discarded.
const INDEX_FILES: &[&str] = &[
"src/entity.rs",
"src/analyzer.rs",
"src/parser.rs",
"src/cache.rs",
"src/tokenizer.rs",
"src/types.rs",
"src/logic.rs",
"src/centrality.rs",
"src/pipeline.rs",
];
fn main() {
let mut hasher = DefaultHasher::new();
for path in INDEX_FILES {
println!("cargo:rerun-if-changed={path}");
if let Ok(contents) = std::fs::read_to_string(path) {
contents.hash(&mut hasher);
}
}
let hash = hasher.finish();
println!("cargo:rustc-env=ONTOMICS_CACHE_VERSION={hash}");
}