aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/build.rs
diff options
context:
space:
mode:
authorHenrik Tjäder <henrik@tjaders.com>2023-02-04 16:47:17 +0100
committerHenrik Tjäder <henrik@tjaders.com>2023-03-01 00:35:13 +0100
commit9e445b3583c15c7701f3167eaa8dfe4afd541691 (patch)
tree167565d51598f42c0454d60b34e1170589ae1056 /xtask/src/build.rs
parent4124fbdd61ff823c6217a2a16ebb4d813146116c (diff)
Move rtic macros to repo root, tune xtask
Diffstat (limited to 'xtask/src/build.rs')
-rw-r--r--xtask/src/build.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/xtask/src/build.rs b/xtask/src/build.rs
new file mode 100644
index 0000000..a11b4e0
--- /dev/null
+++ b/xtask/src/build.rs
@@ -0,0 +1,13 @@
+use std::{fs, path::Path};
+
+const HEX_BUILD_ROOT: &str = "ci/builds";
+
+/// Make sure we're starting with a clean, but existing slate
+pub fn init_build_dir() -> anyhow::Result<()> {
+ if Path::new(HEX_BUILD_ROOT).exists() {
+ fs::remove_dir_all(HEX_BUILD_ROOT)
+ .map_err(|_| anyhow::anyhow!("Could not clear out directory: {}", HEX_BUILD_ROOT))?;
+ }
+ fs::create_dir_all(HEX_BUILD_ROOT)
+ .map_err(|_| anyhow::anyhow!("Could not create directory: {}", HEX_BUILD_ROOT))
+}