Skip to content

Add build_package convenience function to cargo-miden #1034

@Keinberger

Description

@Keinberger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions