Skip to content

Commit

Permalink
Do not canonicalize a target dir if it does not exist yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
abizjak committed Oct 27, 2023
1 parent 3634014 commit b766888
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cargo-concordium/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-concordium/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-concordium"
version = "3.1.2"
version = "3.1.3"
authors = ["Concordium <[email protected]>"]
edition = "2021"
license-file = "../LICENSE"
Expand Down
1 change: 1 addition & 0 deletions cargo-concordium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ of the package root subject to the following
- the package build directory (typically `target`) will be ignored
- additional files listed in any `.ignore` files will be ignored. The format
of this file should be the same as a `.gitignore` file.
- hidden files are ignored.

Information about the sources and the build will be embedded into
`contract.wasm.v1` file. This information includes
Expand Down
15 changes: 9 additions & 6 deletions cargo-concordium/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn create_archive(
.git_global(true)
.git_ignore(true)
.parents(true)
.hidden(false)
.hidden(true)
.sort_by_file_path(std::cmp::Ord::cmp)
.build();
let mut lock_file_found = false;
Expand Down Expand Up @@ -488,18 +488,21 @@ pub fn build_contract(
tar_filename.push(".tar");
tar_filename.into()
};
let mut package_target_dir = metadata.target_directory.as_std_path().to_path_buf();
if package_target_dir
.try_exists()
.context("Unable to check if target directory exists.")?
{
package_target_dir = package_target_dir.canonicalize()?;
};
let ContainerBuildOutput {
output_wasm,
build_info,
tar_archive,
} = build_in_container(
image,
PackageData {
package_target_dir: metadata
.target_directory
.as_std_path()
.canonicalize()?
.as_path(),
package_target_dir: package_target_dir.as_path(),
package_root_path: package_root_path.as_path(),
package_version_string: &package_version_string,
},
Expand Down
2 changes: 1 addition & 1 deletion cargo-concordium/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ const WARNING_STYLE: ansi_term::Color = ansi_term::Color::Yellow;
pub fn main() -> anyhow::Result<()> {
#[cfg(target_os = "windows")]
{
ansi_term::enable_ansi_support();
let _ = ansi_term::enable_ansi_support();
}
let cmd = {
let app = CargoCommand::clap()
Expand Down

0 comments on commit b766888

Please sign in to comment.