Skip to content

Commit

Permalink
Respect the lockfile (#948)
Browse files Browse the repository at this point in the history
* Respect the lockfile

* CHANGELOG.md
  • Loading branch information
ascjones authored Feb 3, 2023
1 parent 0a98d16 commit 3df6562
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed
- Respect the lockfile [#948](https://github.com/paritytech/cargo-contract/pull/948)

## [2.0.0-rc.1] - 2023-02-01
Second release candidate compatible with `ink! 4.0.0-rc`.

Expand Down
19 changes: 17 additions & 2 deletions crates/build/src/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl Workspace {
.tempdir()?;
tracing::debug!("Using temp workspace at '{}'", tmp_dir.path().display());
let new_paths = self.write(&tmp_dir)?;
let root_manifest_path = new_paths
let tmp_root_manifest_path = new_paths
.iter()
.find_map(|(pid, path)| {
if *pid == self.root_package {
Expand All @@ -210,6 +210,21 @@ impl Workspace {
}
})
.expect("root package should be a member of the temp workspace");
f(root_manifest_path)

// copy the `Cargo.lock` file
let src_lockfile = self.workspace_root.clone().join("Cargo.lock");
let dest_lockfile = tmp_root_manifest_path
.absolute_directory()?
.join("Cargo.lock");
if src_lockfile.exists() {
tracing::debug!(
"Copying '{}' to ' '{}'",
src_lockfile.display(),
dest_lockfile.display()
);
std::fs::copy(src_lockfile, dest_lockfile)?;
}

f(tmp_root_manifest_path)
}
}

0 comments on commit 3df6562

Please sign in to comment.