Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Manually build contract using BuildInfo
  • Loading branch information
HCastano committed Oct 20, 2022
commit 85ccd7dd282ac01d5a075f8055fbc2bd4bb076fc
27 changes: 24 additions & 3 deletions crates/cargo-contract/src/cmd/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
// along with cargo-contract. If not, see <http://www.gnu.org/licenses/>.

use crate::{
cmd::metadata::BuildInfo,
cmd::{
build::{
execute,
ExecuteArgs,
},
metadata::BuildInfo,
},
workspace::ManifestPath,
BuildArtifacts,
};

use anyhow::Result;
Expand All @@ -40,7 +47,7 @@ pub struct VerifyCommand {

impl VerifyCommand {
pub fn run(&self) -> Result<()> {
let _manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?;
let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?;

// 1. Read the given metadata, and pull out the `BuildInfo`
let mut file = File::open(&self.contract)?;
Expand All @@ -54,7 +61,21 @@ impl VerifyCommand {
dbg!(&build_info);

// 2. Call `cmd::Build` with the given `BuildInfo`
//
let args = ExecuteArgs {
manifest_path,
verbosity: Default::default(),
build_mode: build_info.build_mode,
network: Default::default(),
build_artifact: BuildArtifacts::CodeOnly,
unstable_flags: Default::default(),
optimization_passes: build_info.wasm_opt_settings.optimization_passes,
keep_debug_symbols: false, /* TODO: Will either want to add this to BuildInfo or assume release (so no) */
skip_linting: true,
output_type: Default::default(),
};

let _build_result = execute(args)?;

// 3. Read output file, compare with given contract_wasm
todo!()
}
Expand Down