icepick: change where it puts workflows, same spot as the bin

This commit is contained in:
Ryan Heywood 2025-02-07 20:35:53 -05:00
parent 7d2909bada
commit e5d2cab12c
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 13 additions and 2 deletions

View File

@ -10,8 +10,19 @@ fn track_path(path: &Path) {
println!("cargo::rerun-if-changed={}", path.to_str().unwrap());
}
fn out_dir() -> PathBuf {
// example: [("OUT_DIR", "/tmp/cargo-target/debug/build/wat-c321129a1ce97284/out")]
// this gives us: /tmp/cargo-target/debug
let out_dir = env_var("OUT_DIR");
let mut out_dir_path = PathBuf::from(out_dir);
out_dir_path.pop();
out_dir_path.pop();
out_dir_path.pop();
out_dir_path
}
fn main() {
let out_dir = env_var("CARGO_TARGET_DIR");
let out_dir = out_dir();
let crate_dir = env_var("CARGO_MANIFEST_DIR");
let workflows_dir = PathBuf::from(crate_dir).join("workflows");
track_path(&workflows_dir);
@ -44,7 +55,7 @@ fn main() {
workflows,
);
}
let out_path = PathBuf::from(out_dir).join("workflows.yaml");
let out_path = out_dir.join("workflows.yaml");
let out_file = std::fs::File::create(&out_path).unwrap();
serde_yaml::to_writer(out_file, &workflows_by_module).unwrap();
}