You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Reference any GitHub issues resolved by this PR -->
-> * Extract build from declare
-- * Add support for --package flag
(#1569)
-- * Add workspace tests
(#1572)
todo:
-- * cleanup scarb_utils, use things from scarb_api/scarb_ui
## Introduced changes
Closes#1474
<!-- A brief description of the changes -->
- Extracts build logic from declare to avoid multiple artifact builds
## Checklist
<!-- Make sure all of these are complete -->
- [X] Linked relevant issue
- [X] Updated relevant documentation
- [X] Added relevant tests
- [X] Performed self-review of the code
- [X] Added changes to `CHANGELOG.md`
let contract_name:String = contract_name.to_string();
54
-
let manifest_path = match build_config.scarb_toml_path.clone(){
55
-
Some(path) => path,
56
-
None => get_scarb_manifest().context("Failed to obtain manifest path from Scarb")?,
57
-
};
58
-
59
-
letmut cmd = ScarbCommand::new_with_stdio();
60
-
cmd.arg("build").manifest_path(&manifest_path);
61
-
if build_config.json{
62
-
cmd.json();
63
-
}
64
-
cmd.run().context("Failed to build contracts with Scarb")?;
65
-
66
-
let metadata = scarb_metadata::MetadataCommand::new()
67
-
.manifest_path(&manifest_path)
68
-
.inherit_stderr()
69
-
.exec()
70
-
.context("Failed to get scarb metadata")?;
71
-
72
-
let package = get_package_metadata(&metadata,&manifest_path)
73
-
.with_context(|| anyhow!("Failed to find package for contract = {contract_name}"))?;
74
-
let contracts = get_contracts_map(&metadata,&package.id)?;
75
-
76
-
let contract_artifacts = contracts
46
+
let contract_artifacts = artifacts
77
47
.get(&contract_name)
78
48
.ok_or(anyhow!("Failed to find artifacts in starknet_artifacts.json file. Please ensure you have enabled sierra and casm code generation in Scarb.toml"))?;
0 commit comments