Skip to content

Commit e582fc9

Browse files
committed
better static artefact caching
this should speedup hot builds and ci builds improves cache usage
1 parent c6f3fea commit e582fc9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

build.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ fn hashed_filename(path: &Path) -> String {
134134
}
135135

136136
fn make_url_path(url: &str) -> PathBuf {
137-
let filename = url.replace(|c: char| !c.is_ascii_alphanumeric() && c != '.', "_");
138-
Path::new(&std::env::var("OUT_DIR").unwrap()).join(filename)
137+
let manifest_dir = env!("CARGO_MANIFEST_DIR");
138+
let sqlpage_artefacts = Path::new(&manifest_dir)
139+
.join("target")
140+
.join("sqlpage_artefacts");
141+
std::fs::create_dir_all(&sqlpage_artefacts).unwrap();
142+
let filename = url.replace(
143+
|c: char| !c.is_ascii_alphanumeric() && !['.', '-'].contains(&c),
144+
"_",
145+
);
146+
sqlpage_artefacts.join(filename)
139147
}

0 commit comments

Comments
 (0)