Skip to content

Commit

Permalink
used properly cargo-near. do not need locked parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn committed Aug 15, 2024
1 parent 1f05a86 commit 922ed7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# This specifies the version of Rust we use to build.
# Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`.
# The version specified below, should be at least as high as the maximum `rust-version` within the workspace.
channel = "1.80"
channel = "stable"
components = ["rustfmt", "clippy", "rust-analyzer"]
targets = ["wasm32-unknown-unknown"]
15 changes: 4 additions & 11 deletions workspaces/src/cargo/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::error::ErrorKind;

use cargo_near::commands::build_command::{BuildCommand, BuildContext, CliBuildCommand};

/// 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 @@ -16,12 +14,10 @@ pub async fn compile_project(project_path: &str) -> crate::Result<Vec<u8>> {
_ => ErrorKind::Io.custom(e),
})?;

// Hack to create a structure as no_docker is private in BuildCommand
let cargo_near_build_command: BuildCommand = CliBuildCommand {
let cargo_opts = cargo_near::BuildOpts {
no_release: false,
no_docker: true,
no_locked: false,
no_embed_abi: false,
no_locked: true,
no_doc: true,
color: None,
no_abi: true,
Expand All @@ -39,12 +35,9 @@ pub async fn compile_project(project_path: &str) -> crate::Result<Vec<u8>> {
),
features: None,
no_default_features: false,
}
.into();
};

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

let file = compile_artifact
.path
Expand Down

0 comments on commit 922ed7a

Please sign in to comment.