feat: Support single-canister project definitions#11
Merged
Conversation
ghost
suggested changes
Jun 9, 2025
4e693e7 to
0101cba
Compare
…le and multiple commands cases
bcc0a63 to
ac8776d
Compare
ac8776d to
1eb02f7
Compare
…i-canister projects
1eb02f7 to
e03ffd9
Compare
2d66a9b to
fbbbd14
Compare
ghost
approved these changes
Jun 16, 2025
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.
Summary:
This PR enhances the project manifest (
icp.yaml) to support a simplified configuration for single-canister projects. Previously, only acanisterslist was supported. Now, a project with a single canister can be defined directly using a top-levelcanisterkey, improving developer experience for simpler projects. The existingcanisterskey for multi-canister projects remains fully supported.Detailed Changes:
Flexible Project Manifest (
lib/icp-project/src/model.rs):RawProjectManifeststruct was modified to use#[serde(flatten)]on anOption<RawCanistersField>. This allowsserdeto deserialize from either acanisterkey (for a single canister) or acanisterskey (for multiple canisters) at the top level oficp.yaml.ProjectManifest::loadfunction was updated to handle thisOption. If neithercanisternorcanistersis present in the manifest, it now correctly falls back to the default behavior of searching for canisters with thecanisters/*glob pattern.Unified Build Logic (
bin/icp-cli/src/commands/build.rs):buildcommand's execution logic was updated to normalize the canister configuration. It now uses amatchstatement to handle both the single-canister (CanistersField::Canister) and multi-canister (CanistersField::Canisters) variants, creating a unified list of canisters to be built.Configuration Examples:
This change makes both of the following
icp.yamlformats valid:Single-Canister Project (New):
Multi-Canister Project (Existing):
This PR description was generated by Roo.