Right now, using cargo-miden as a library to compile a project and get a Package back requires a fair amount of boilerplate: calling run(), matching on CommandOutput::BuildCommandOutput, then on BuildOutput::Masm, reading the artifact bytes from disk, and finally deserializing with Package::read_from_bytes().
The compiler's own test harness already wraps this internally (build_package() in test-harness, compile_rust_package() in integration-network helpers), so the pattern is well established.
I think it would be worth exposing a simple public function on the cargo-miden crate that wraps this entire pipeline:
pub fn build_package(manifest_path: &Path, release: bool) -> Result<Package>
Happy to work on implementing this!
Context: these helpers currently live in the project template which we provide to pioneer teams as a starting point for building with the Rust compiler. The goal is to extract and standardize helpers that right now temporarily exist there, so that they're available to all developers natively.
Right now, using
cargo-midenas a library to compile a project and get aPackageback requires a fair amount of boilerplate: callingrun(), matching onCommandOutput::BuildCommandOutput, then onBuildOutput::Masm, reading the artifact bytes from disk, and finally deserializing withPackage::read_from_bytes().The compiler's own test harness already wraps this internally (
build_package()in test-harness,compile_rust_package()in integration-network helpers), so the pattern is well established.I think it would be worth exposing a simple public function on the
cargo-midencrate that wraps this entire pipeline:Happy to work on implementing this!
Context: these helpers currently live in the project template which we provide to pioneer teams as a starting point for building with the Rust compiler. The goal is to extract and standardize helpers that right now temporarily exist there, so that they're available to all developers natively.