Skip to content

Commit

Permalink
updated cargo-near to "0.5.1"
Browse files Browse the repository at this point in the history
  • Loading branch information
FroVolod committed Jan 25, 2024
1 parent 5628eec commit 8acdb61
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion workspaces/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async-trait = "0.1"
base64 = "0.21"
bs58 = "0.5"
cargo_metadata = { version = "0.18", optional = true }
cargo-near = "0.3.1"
cargo-near = "0.5.1"
chrono = "0.4.19"
fs2 = "0.4"
rand = "0.8.4"
Expand Down
18 changes: 10 additions & 8 deletions workspaces/src/cargo/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::convert::TryInto;
use std::str::FromStr;

use crate::error::ErrorKind;

use cargo_near::commands::build_command::{build, BuildCommand};

/// Builds the cargo project located at `project_path` and returns the generated wasm file contents.
///
/// NOTE: This function does not check whether the resulting wasm file is a valid smart
Expand All @@ -15,23 +17,23 @@ pub async fn compile_project(project_path: &str) -> crate::Result<Vec<u8>> {
_ => ErrorKind::Io.custom(e),
})?;

let cargo_near_build_command = cargo_near::BuildCommand {
let cargo_near_build_command = BuildCommand {
release: true,
embed_abi: true,
doc: false,
color: cargo_near::ColorPreference::Always,
color: None,
no_abi: true,
out_dir: None,
manifest_path: Some(
project_path
.join("Cargo.toml")
.try_into()
.map_err(|e| ErrorKind::Io.custom(e))?,
cargo_near::types::utf8_path_buf::Utf8PathBufInner::from_str(
&project_path.join("Cargo.toml").to_string_lossy(),
)
.map_err(|e| ErrorKind::Io.custom(e))?,
),
};

let compile_artifact =
cargo_near::build::run(cargo_near_build_command).map_err(|e| ErrorKind::Io.custom(e))?;
build::run(cargo_near_build_command).map_err(|e| ErrorKind::Io.custom(e))?;

let file = compile_artifact
.path
Expand Down

0 comments on commit 8acdb61

Please sign in to comment.