Skip to content

Commit d76e032

Browse files
committed
create canister and project manifest definitions
1 parent 72452ee commit d76e032

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

lib/icp-canister/src/lib.rs

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1-
struct Manifest {
2-
name: String,
1+
use serde::Deserialize;
2+
3+
/// Represents the manifest describing a single canister,
4+
/// including its name and how it should be built.
5+
#[derive(Debug, Deserialize)]
6+
pub struct CanisterManifest {
7+
/// Name of the canister described by this manifest.
8+
pub name: String,
9+
10+
/// Build configuration for producing the canister's WebAssembly.
11+
pub build: Build,
12+
}
13+
14+
/// Describes how the canister should be built into WebAssembly,
15+
/// including the adapter responsible for the build.
16+
#[derive(Debug, Deserialize)]
17+
pub struct Build {
18+
pub adapter: Adapter,
19+
}
20+
21+
/// Identifies the type of adapter used to build the canister,
22+
/// e.g. "motoko", "rust", or "custom".
23+
#[derive(Debug, Deserialize)]
24+
pub struct Adapter {
25+
#[serde(rename = "type")]
26+
pub typ: AdapterType,
27+
}
28+
29+
/// Known adapter types that can be used to build a canister.
30+
/// These correspond to the values found in `build.adapter.type` in the YAML.
31+
#[derive(Debug, Deserialize)]
32+
#[serde(rename_all = "lowercase")]
33+
pub enum AdapterType {
34+
/// A canister written in Rust.
35+
Rust,
36+
37+
/// A canister written in Motoko.
38+
Motoko,
39+
40+
/// A canister built using custom instructions,
41+
/// such as a shell script or other manual build process.
42+
Custom,
43+
44+
/// An assets canister used to serve front-end applications
45+
/// or static assets on the Internet Computer.
46+
Assets,
347
}

lib/icp-project/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use icp_network::structure::NetworkDirectoryStructure;
2+
use serde::Deserialize;
23
use std::path::PathBuf;
34

45
pub struct ProjectDirectoryStructure {
@@ -38,3 +39,16 @@ impl ProjectDirectoryStructure {
3839
NetworkDirectoryStructure::new(&network_root)
3940
}
4041
}
42+
43+
/// Represents the manifest for an ICP project, typically loaded from `icp.yaml`.
44+
/// A project is a repository or directory grouping related canisters and network definitions.
45+
#[derive(Debug, Deserialize)]
46+
pub struct ProjectManifest {
47+
/// List of canister manifests belonging to this project.
48+
/// Supports glob patterns to specify multiple canister YAML files.
49+
pub canisters: Vec<PathBuf>,
50+
51+
/// List of network definition files relevant to the project.
52+
/// Supports glob patterns to reference multiple network config files.
53+
pub networks: Vec<PathBuf>,
54+
}

0 commit comments

Comments
 (0)