fix(cargo-miden): materialize compiled dependency packages on disk#1216
Open
greenhat wants to merge 2 commits into
Open
fix(cargo-miden): materialize compiled dependency packages on disk#1216greenhat wants to merge 2 commits into
greenhat wants to merge 2 commits into
Conversation
When `cargo miden build` compiles a project that depends on another Miden project, the dependency was only published to the in-memory package registry. A dependent crate that imports such a dependency (e.g. via `#[account(..)]`) resolves the dependency's `.masp` from disk while expanding its own Rust macros, in a separate `cargo build` process that cannot see the in-memory registry, so those builds failed unless the package had been persisted by hand first. Materialize each compiled source dependency to its own `target/miden/<profile>/` right after it is published to the registry. Dependencies are built before the dependent's `cargo build` runs, so the package is on disk in time for macro expansion. The profile sub-directory mirrors the one the macro searches: `release` for release builds and `debug` otherwise. Add a cargo-miden integration test that builds the `p2id-note` example and asserts its `basic-wallet` dependency is materialized under `target/miden/release`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement option 1 from #1214 to unblock the release.
When
cargo miden buildcompiles a project that depends on another Midenproject, the dependency was only published to the in-memory package registry.
A dependent crate that imports such a dependency (e.g. via
#[account(..)])resolves the dependency's
.maspfrom disk while expanding its own Rust macros,in a separate
cargo buildprocess that cannot see the in-memory registry, sothose builds failed unless the package had been persisted by hand first.
Materialize each compiled source dependency to its own
target/miden/<profile>/right after it is published to the registry. Dependencies are built before the
dependent's
cargo buildruns, so the package is on disk in time for macroexpansion. The profile sub-directory mirrors the one the macro searches:
releasefor release builds anddebugotherwise.