Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdoesdev committed Sep 28, 2023
1 parent 63a97b2 commit 1e72af3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/commands/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub async fn upload(
let cache_key_path = current_dir.join(".cache").join(".cache_key");
let build_dir = current_dir.join(".build");

if let Some(dot_cache_folder) = &cache_key_path.parent() {
if !dot_cache_folder.exists() {
std::fs::create_dir(dot_cache_folder)?;
}
}

if !build_dir.exists() {
println!("Build dir does not exist: {:?}", build_dir);
return Ok(());
Expand Down Expand Up @@ -52,6 +58,8 @@ pub async fn upload(
.buffer(&mut build_archive_buf, build_archive_size)
.await?;

println!("Uploaded .build");

let mut cache_put_req = remote_client.put(cache_dir_hash.clone(), None)?;

println!("Uploading .cache");
Expand All @@ -60,6 +68,8 @@ pub async fn upload(
.buffer(&mut cache_archive_buf, cache_archive_size)
.await?;

println!("Uploaded .cache");

let cache_key_content = vec![cache_dir_hash, build_archive_hash].join("\n");

std::fs::write(cache_key_path, cache_key_content)?;
Expand Down

0 comments on commit 1e72af3

Please sign in to comment.