Skip to content

Commit

Permalink
Fix another publish issue with maelstrom-web
Browse files Browse the repository at this point in the history
Don't create a .lock file in the build script, this causes issues with
publishing
  • Loading branch information
bobbobbio committed Jan 22, 2024
1 parent 74f9862 commit a4596a6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/maelstrom-web/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,20 @@ fn main() {
#[cfg(debug_assertions)]
let profile = "dev";

let metadata = cargo_metadata::MetadataCommand::new().exec().unwrap();

if std::env::var("TARGET").unwrap() != "wasm32-unknown-unknown" {
let crate_root_cargo_lock = Path::new("Cargo.lock");
let cargo_lock_existed_at_crate_root = crate_root_cargo_lock.exists();

let metadata = cargo_metadata::MetadataCommand::new().exec().unwrap();
create_web_tar(
&format!("wasm_{profile}"),
metadata.target_directory.as_std_path(),
);

// this should only be the case when publishing, and at that point we can't be the ones
// creating the Cargo.lock file
if !cargo_lock_existed_at_crate_root && crate_root_cargo_lock.exists() {
fs::remove_file("Cargo.lock").unwrap();
}
}
}

0 comments on commit a4596a6

Please sign in to comment.