diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index f01c677cc..8779ead8e 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -21,18 +21,57 @@ cargo fmt && cargo clippy # Run after changes pass tests ### Workspace Structure - **`crates/icp-cli`**: Main CLI binary (`icp`): argument parsing, command implementations, and all terminal presentation -- **`crates/icp`**: Core library with project model, manifest loading, canister management, network configuration, and the operations that do the work +- **`crates/icp-app`**: Everything about the machine the tool runs on: identities and the keyring, user settings, the global directory layout, the package cache, local networks and the launcher that runs them, telemetry, offline message signing, and the operations that act on a canister by principal +- **`crates/icp-project`**: Everything about a project: the project model, manifest loading and consolidation, canister management, and the operations that build, install, sync and deploy - **`crates/icp-events`**: Typed progress events passed from operations to the CLI's renderers - **`crates/icp-canister-interfaces`**: Canister interface definitions for ICP system canisters - **`crates/schema-gen`**: JSON schema generation for manifest validation +### The app/project boundary + +`icp-app` depends on `icp-project`, and never the other way round. `icp-cli` +depends on both directly — `icp-app` re-exports nothing, so a command reaches +for the crate that owns what it needs. + +Which side a thing belongs on is decided by its inputs: anything driven by the +project model (a `Canister`, an `Environment`, a manifest) is `icp-project`; +anything keyed by a bare `Principal`, or by global state on this machine, is +`icp-app`. Low-level primitives sink rather than float: a management-canister +wrapper lives in `icp-project` whenever `icp-project` itself has to issue it, +even though it takes a principal, and `icp-app` calls down into it. + +`icp-project` is meant to end up runnable inside a canister, so it must not +reach the host directly. What it needs from the machine it asks for through a +trait declared there and implemented in `icp-app`: + +- `network::Access` — a network's endpoints, root key and friendly domains +- `canister::wasm::Fetch` — a wasm module a manifest names by URL +- `canister::recipe::Resolve` — a recipe's Handlebars template +- `host::Observe` — what resolution turned up, for telemetry + +Because those are implemented across a crate boundary, their error types carry +their cause boxed and pass it through with `#[snafu(transparent)]`, which leaves +the wrapper out of the source chain so the cause is reported once rather than +both restated as the wrapper's message and reported beneath it. + +This is the one exception to the error-handling rule below, and to both of its +halves: on a trait whose implementation the crate cannot name there is no +variant to write, and what `transparent` passes through here is a boxed foreign +error rather than one of this repo's. + ### Command Structure -Commands are in `crates/icp-cli/src/commands/`, each as a module with an `exec()` function receiving a `Context` (from `crates/icp/src/context/`). Dispatched via `clap` in `main.rs`. Traits like `ProjectLoad` and `ProjectRootLocate` enable dependency injection for testing. +Commands are in `crates/icp-cli/src/commands/`, each as a module with an `exec()` function receiving a `Context` (from `crates/icp-app/src/context/`). Dispatched via `clap` in `main.rs`. Traits like `ProjectLoad` and `ProjectRootLocate` enable dependency injection for testing. ### Commands vs. operations -Commands own the user experience: parsing arguments, choosing a renderer, and printing results. The real work lives in `crates/icp/src/operations/` — building, syncing, installing, and so on. Operations never print or draw: they report progress as [`icp-events`](crates/icp-events) events through a `Reporter` and return typed errors, and `crates/icp-cli/src/render/` decides how any of it looks. Anything a command needs to display comes back as event data or a return value, never as a formatted string from an operation. +Commands own the user experience: parsing arguments, choosing a renderer, and printing results. The real work lives in `crates/icp-project/src/operations/` (and `crates/icp-app/src/operations/` for the principal-keyed ones) — building, syncing, installing, and so on. Operations never print or draw: they report progress as [`icp-events`](crates/icp-events) events through a `Reporter` and return typed errors, and `crates/icp-cli/src/render/` decides how any of it looks. Anything a command needs to display comes back as event data or a return value, never as a formatted string from an operation. + +An operation takes `&icp_project::host::Host` — the project-side seams and the +environment/canister-id resolution built on them — plus whatever its caller +resolved for it (an agent, install arguments). It does not take `Context`: +identities, the keyring and the global directories are no business of an +operation's. See `.claude/architecture.md` for detailed subsystem documentation (manifests, build adapters, recipes, networks, identity). @@ -54,14 +93,14 @@ The `icp-cli-network-launcher` (wraps PocketIC) is automatically downloaded on f All paths are UTF-8. `PathBuf` and `Path` are the types from `camino`. - You do not need to add `.display()` to use them in format strings -- Do not import `Path` or `PathBuf` from `std`; if those names are not available, glob-import `icp::prelude::*` (or `crate::prelude::*` if in `icp`). +- Do not import `Path` or `PathBuf` from `std`; if those names are not available, glob-import `icp_project::prelude::*` (or `crate::prelude::*` if in `icp-project`). ### Error handling This project uses Snafu for error handling. - Every new *primary erroring action* gets its own error variant. There is no `MyError::Io { source: io::Error }`, instead (hypothetically) `OpenSocket` and `WriteSocket` should be separate. `snafu(context(false))` is not permitted. `snafu(transparent)` should *only* be used for source error types defined elsewhere in this repo, *not* for foreign error types. -- Every error regarding a file in some way (processing, creating, etc.) should contain the file path of the error. It is okay to add 'dummy' file path parameters only used in error handling routes. For 'basic' file ops and JSON/YML loading use the functions in `icp::fs`, whose errors include the file path and can be made `snafu(transparent)`. +- Every error regarding a file in some way (processing, creating, etc.) should contain the file path of the error. It is okay to add 'dummy' file path parameters only used in error handling routes. For 'basic' file ops and JSON/YML loading use the functions in `icp_project::fs`, whose errors include the file path and can be made `snafu(transparent)`. ## Documentation & Examples diff --git a/.claude/architecture.md b/.claude/architecture.md index 9f3a45690..1fa51fed5 100644 --- a/.claude/architecture.md +++ b/.claude/architecture.md @@ -8,7 +8,7 @@ The project model is built hierarchically through manifest consolidation: 2. **Canister Manifest** (`canister.yaml`): Per-canister configuration for build and sync steps 3. **Consolidated Project**: Final `Project` struct combining all manifests into a unified view -Key types in `crates/icp/src/lib.rs`: +Key types in `crates/icp-project/src/lib.rs`: - `Project`: Contains all canisters, networks, and environments - `Environment`: Links a network with a set of canisters - `Network`: Configuration for local (managed) or remote (connected) networks @@ -22,21 +22,21 @@ Manifests are YAML files that define project structure. The system supports: - **Path references**: Reference external manifest files - **Glob patterns**: For canisters, use globs like `canisters/*` to auto-discover -The `consolidate_manifest` function in `crates/icp/src/project.rs` transforms raw manifests into the final `Project` structure. The serde structs in the `icp::manifest` module represent the format that the user's YAML files can be written in, while the serde structs with identical meaning outside `icp::manifest` are instead the canonical form, with defaults filled in and normalizations applied. Code should always deal with the canonical form. +The `consolidate_manifest` function in `crates/icp-project/src/project.rs` transforms raw manifests into the final `Project` structure. The serde structs in the `icp_project::manifest` module represent the format that the user's YAML files can be written in, while the serde structs with identical meaning outside `icp_project::manifest` are instead the canonical form, with defaults filled in and normalizations applied. Code should always deal with the canonical form. ## Build Adapters -Canisters are built using adapter pipelines defined in `crates/icp/src/manifest/adapter/`: +Canisters are built using adapter pipelines defined in `crates/icp-project/src/manifest/adapter/`: - **Script Adapter**: Runs shell commands with environment variables (e.g., `$ICP_WASM_OUTPUT_PATH`) - **Prebuilt Adapter**: Uses pre-compiled WASM from local files, URLs, or registry - **Assets Adapter**: Packages static assets for frontend canisters -Build steps are executed sequentially in `crates/icp/src/canister/build/`. +Build steps are executed sequentially in `crates/icp-project/src/canister/build/`. ## Recipe System -Recipes are Handlebars templates that generate build/sync configuration. Implementation in `crates/icp/src/canister/recipe/`: +Recipes are Handlebars templates that generate build/sync configuration. Implementation in `crates/icp-project/src/canister/recipe/`: - **Registry recipes**: `@dfinity/rust@v3.0.0` resolves to GitHub releases URL - **Local recipes**: `file://path/to/recipe.hbs` @@ -46,7 +46,7 @@ The `@dfinity` prefix is hardcoded to `https://github.com/dfinity/icp-cli-recipe ## Network Management -Two network types in `crates/icp/src/network/`: +Two network types, modelled in `crates/icp-project/src/network/` and run from `crates/icp-app/src/network/`: - **Managed Networks**: Local test networks launched via `icp-cli-network-launcher` (wraps PocketIC) - **Connected Networks**: Remote networks (mainnet, testnets) accessed via HTTP @@ -62,11 +62,11 @@ Corresponding implicit environments are also provided: - **`local` environment**: Uses the `local` network with all project canisters. This is the default environment when none is specified. - **`ic` environment**: Uses the `ic` network with all project canisters. -These constants are defined in `crates/icp/src/prelude.rs` as `LOCAL` and `IC` and are used throughout the codebase. +These constants are defined in `crates/icp-project/src/prelude.rs` as `LOCAL` and `IC` and are used throughout the codebase. ## Identity & Canister IDs -- **Identities**: Stored in platform-specific directories as PEM files (Secp256k1 or Ed25519): +- **Identities** (`crates/icp-app/src/identity/`): Stored in platform-specific directories as PEM files (Secp256k1 or Ed25519): - macOS: `~/Library/Application Support/org.dfinity.icp-cli/identity/` - Linux: `~/.local/share/icp-cli/identity/` - Windows: `%APPDATA%\icp-cli\data\identity\` @@ -75,7 +75,7 @@ These constants are defined in `crates/icp/src/prelude.rs` as `LOCAL` and `IC` a - Managed networks (local) use `.icp/cache/mappings/` - Connected networks (mainnet) use `.icp/data/mappings/` -Store management is in `crates/icp/src/store_id.rs`. +Store management is in `crates/icp-project/src/store_id.rs`. ## Telemetry diff --git a/.claude/testing.md b/.claude/testing.md index 5c0f6ba96..ebd203f28 100644 --- a/.claude/testing.md +++ b/.claude/testing.md @@ -11,8 +11,15 @@ Tests are split between unit tests (in modules) and integration tests: ## Mock Helpers -`crates/icp/src/lib.rs` provides test utilities: +`crates/icp-project/src/lib.rs` provides test utilities: - `MockProjectLoader::minimal()`: Single canister, network, environment - `MockProjectLoader::complex()`: Multiple canisters, networks, environments - `NoProjectLoader`: Simulates missing project for error cases + +These, and the mock for every seam in `icp_project::host::Host`, sit behind +`icp-project`'s `test-util` feature so that crates downstream of it can build +against the same mocks — `#[cfg(test)]` does not cross a crate boundary. A +crate that needs them declares `icp-project = { workspace = true, features = +["test-util"] }` as a dev-dependency, as `icp-app` does. Nothing behind the +feature ships in a normal build. diff --git a/Cargo.lock b/Cargo.lock index 2a536c524..ab7f8df87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3620,60 +3620,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "icp" -version = "1.5.0" -dependencies = [ - "async-trait", - "bigdecimal", - "camino", - "camino-tempfile", - "candid", - "candid_parser", - "clap", - "dunce", - "flate2", - "futures", - "glob", - "handlebars", - "hex", - "httptest", - "ic-agent", - "ic-ledger-types", - "ic-management-canister-types 0.9.0", - "ic-utils", - "icp-canister-interfaces", - "icp-events", - "icp-sync-plugin", - "icrc-ledger-types", - "indexmap", - "indoc", - "itertools 0.14.0", - "jsonschema", - "num-bigint 0.4.6", - "num-integer", - "num-traits", - "pathdiff", - "rand 0.10.1", - "schemars", - "semver", - "serde", - "serde_cbor", - "serde_json", - "serde_yaml", - "sha2 0.11.0", - "shellwords", - "snafu", - "strum 0.28.0", - "tar", - "time", - "tokio", - "tracing", - "url", - "wasmparser 0.255.0", - "winreg", -] - [[package]] name = "icp-app" version = "1.5.0" @@ -3706,9 +3652,9 @@ dependencies = [ "ic-ledger-types", "ic-management-canister-types 0.9.0", "ic-utils", - "icp", "icp-canister-interfaces", "icp-events", + "icp-project", "icrc-ledger-types", "indexmap", "indoc", @@ -3791,10 +3737,10 @@ dependencies = [ "ic-ledger-types", "ic-management-canister-types 0.9.0", "ic-utils", - "icp", "icp-app", "icp-canister-interfaces", "icp-events", + "icp-project", "icrc-ledger-types", "indicatif", "indoc", @@ -3845,6 +3791,60 @@ dependencies = [ "tokio", ] +[[package]] +name = "icp-project" +version = "1.5.0" +dependencies = [ + "async-trait", + "bigdecimal", + "camino", + "camino-tempfile", + "candid", + "candid_parser", + "clap", + "dunce", + "flate2", + "futures", + "glob", + "handlebars", + "hex", + "httptest", + "ic-agent", + "ic-ledger-types", + "ic-management-canister-types 0.9.0", + "ic-utils", + "icp-canister-interfaces", + "icp-events", + "icp-sync-plugin", + "icrc-ledger-types", + "indexmap", + "indoc", + "itertools 0.14.0", + "jsonschema", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "pathdiff", + "rand 0.10.1", + "schemars", + "semver", + "serde", + "serde_cbor", + "serde_json", + "serde_yaml", + "sha2 0.11.0", + "shellwords", + "snafu", + "strum 0.28.0", + "tar", + "time", + "tokio", + "tracing", + "url", + "wasmparser 0.255.0", + "winreg", +] + [[package]] name = "icp-sync-plugin" version = "1.5.0" @@ -6420,7 +6420,7 @@ dependencies = [ name = "schema-gen" version = "1.5.0" dependencies = [ - "icp", + "icp-project", "schemars", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 435e1c938..903d4b944 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,10 +58,10 @@ ic-ed25519 = "0.6.0" ic-ledger-types = "0.16.0" ic-management-canister-types = { version = "0.9.0" } ic-utils = { version = "0.49.1" } -icp = { path = "crates/icp" } icp-app = { path = "crates/icp-app" } icp-canister-interfaces = { path = "crates/icp-canister-interfaces" } icp-events = { path = "crates/icp-events" } +icp-project = { path = "crates/icp-project" } icp-sync-plugin = { path = "crates/icp-sync-plugin" } ic-identity-hsm = "0.49.1" icrc-ledger-types = "0.1.10" diff --git a/clippy.toml b/clippy.toml index 583e4215e..2fe162096 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,5 +1,5 @@ disallowed-types = [ - { path = "std::path::PathBuf", reason = "Use `use icp::prelude::PathBuf;` or `use icp::prelude::*;` instead" }, - { path = "std::path::Path", reason = "Use `icp::prelude::Path;` or `use icp::prelude::*;` instead" }, + { path = "std::path::PathBuf", reason = "Use `use icp_project::prelude::PathBuf;` or `use icp_project::prelude::*;` instead" }, + { path = "std::path::Path", reason = "Use `icp_project::prelude::Path;` or `use icp_project::prelude::*;` instead" }, ] too-many-arguments-threshold = 12 diff --git a/crates/icp-app/Cargo.toml b/crates/icp-app/Cargo.toml index a343f200d..c51c890a5 100644 --- a/crates/icp-app/Cargo.toml +++ b/crates/icp-app/Cargo.toml @@ -8,9 +8,9 @@ publish.workspace = true [features] # `clap::ValueEnum` derives on the settings/identity enums used as CLI value # types. Enabled by `icp-cli`. -clap = ["dep:clap", "icp/clap"] -# Exposes this crate's mocks, as `icp`'s own feature does for its seams. -test-util = ["icp/test-util"] +clap = ["dep:clap", "icp-project/clap"] +# Exposes this crate's mocks, as `icp-project`'s own feature does for its seams. +test-util = ["icp-project/test-util"] [dependencies] async-dropper = { workspace = true } @@ -40,7 +40,7 @@ ic-identity-hsm = { workspace = true } ic-ledger-types = { workspace = true } ic-management-canister-types = { workspace = true } ic-utils = { workspace = true } -icp = { workspace = true } +icp-project = { workspace = true } icp-canister-interfaces = { workspace = true } icp-events = { workspace = true } icrc-ledger-types = { workspace = true } @@ -81,6 +81,6 @@ winreg = { workspace = true } [dev-dependencies] httptest = { workspace = true } -icp = { workspace = true, features = ["test-util"] } +icp-project = { workspace = true, features = ["test-util"] } indexmap = { workspace = true } indoc = { workspace = true } diff --git a/crates/icp-app/src/agent.rs b/crates/icp-app/src/agent.rs index 9f9dd5f95..ea33ae9dd 100644 --- a/crates/icp-app/src/agent.rs +++ b/crates/icp-app/src/agent.rs @@ -4,7 +4,7 @@ use async_trait::async_trait; use ic_agent::{Agent, AgentError, Identity}; use snafu::prelude::*; -use icp::prelude::*; +use icp_project::prelude::*; #[derive(Debug, Snafu)] pub enum CreateAgentError { diff --git a/crates/icp-app/src/context/init.rs b/crates/icp-app/src/context/init.rs index 711d28c6d..bf02207dd 100644 --- a/crates/icp-app/src/context/init.rs +++ b/crates/icp-app/src/context/init.rs @@ -5,14 +5,14 @@ use snafu::prelude::*; use crate::context::Context; use crate::directories::{Access as _, Directories}; use crate::recipe::RecipeFetcher; -use icp::canister::build::Builder; -use icp::canister::sync::Syncer; -use icp::prelude::*; -use icp::store_artifact::ArtifactStore; +use icp_project::canister::build::Builder; +use icp_project::canister::sync::Syncer; +use icp_project::prelude::*; +use icp_project::store_artifact::ArtifactStore; use std::time::Duration; use crate::{agent, identity, identity::PasswordFunc}; -use icp::{Lazy, ProjectLoadImpl, host::Host, manifest, store_id}; +use icp_project::{Lazy, ProjectLoadImpl, host::Host, manifest, store_id}; #[derive(Debug, Snafu)] pub enum ContextInitError { @@ -28,10 +28,14 @@ pub enum ContextInitError { Utf8Path { source: FromPathBufError }, #[snafu(display("failed to lock identity directory"))] - IdentityDirectory { source: icp::fs::lock::LockError }, + IdentityDirectory { + source: icp_project::fs::lock::LockError, + }, #[snafu(display("failed to lock package cache directory"))] - PackageCache { source: icp::fs::lock::LockError }, + PackageCache { + source: icp_project::fs::lock::LockError, + }, } pub fn initialize( diff --git a/crates/icp-app/src/context/mod.rs b/crates/icp-app/src/context/mod.rs index 599ed4c24..7df4073d3 100644 --- a/crates/icp-app/src/context/mod.rs +++ b/crates/icp-app/src/context/mod.rs @@ -6,7 +6,7 @@ use crate::{ }; use candid::Principal; use ic_agent::{Agent, Identity}; -use icp::{ +use icp_project::{ host::{ CanisterSelection, EnvironmentSelection, GetCanisterIdForEnvError, GetEnvironmentError, Host, @@ -50,7 +50,7 @@ pub struct Context { pub dirs: Arc, /// Where a network keeps its on-disk state. Not part of - /// [`icp::network::Access`] because the layout is this crate's invention. + /// [`icp_project::network::Access`] because the layout is this crate's invention. pub network_dirs: Arc, /// Identity loader @@ -93,7 +93,7 @@ impl Context { pub async fn get_network( &self, network_selection: &NetworkSelection, - ) -> Result { + ) -> Result { let network = match network_selection { NetworkSelection::Named(network_name) => { if self.host.project.exists().await? { @@ -103,10 +103,10 @@ impl Context { })?; net.clone() } else if network_name == IC { - icp::Network { + icp_project::Network { name: IC.to_string(), - configuration: icp::network::Configuration::Connected { - connected: icp::network::Connected { + configuration: icp_project::network::Configuration::Connected { + connected: icp_project::network::Connected { api_url: IC_MAINNET_NETWORK_API_URL.parse().unwrap(), http_gateway_url: Some( IC_MAINNET_NETWORK_GATEWAY_URL.parse().unwrap(), @@ -122,10 +122,10 @@ impl Context { } } NetworkSelection::Default => return Err(GetNetworkError::DefaultNetwork), - NetworkSelection::Url(url, root_key) => icp::Network { + NetworkSelection::Url(url, root_key) => icp_project::Network { name: url.to_string(), - configuration: icp::network::Configuration::Connected { - connected: icp::network::Connected { + configuration: icp_project::network::Configuration::Connected { + connected: icp_project::network::Connected { api_url: url.clone(), http_gateway_url: Some(url.clone()), root_key: root_key.clone(), @@ -151,7 +151,7 @@ impl Context { pub async fn get_network_or_environment( &self, selection: &NetworkOrEnvironmentSelection, - ) -> Result { + ) -> Result { match selection { NetworkOrEnvironmentSelection::Network(network_name) => { let network_selection = NetworkSelection::Named(network_name.clone()); @@ -265,7 +265,7 @@ impl Context { Err(GetAgentForEnvError::GetEnvironment { source: GetEnvironmentError::ProjectLoad { - source: icp::ProjectLoadError::Locate { .. }, + source: icp_project::ProjectLoadError::Locate { .. }, }, }) => Err(GetAgentError::NoProjectOrNetwork), Err(e) => Err(e.into()), @@ -345,7 +345,9 @@ pub enum GetIdentityError { #[derive(Debug, Snafu)] pub enum GetNetworkError { #[snafu(transparent)] - ProjectLoad { source: icp::ProjectLoadError }, + ProjectLoad { + source: icp_project::ProjectLoadError, + }, #[snafu(display("project does not contain a network named '{}'", name))] NetworkNotFound { name: String }, @@ -375,7 +377,9 @@ pub enum GetAgentForEnvError { GetEnvironment { source: GetEnvironmentError }, #[snafu(transparent)] - NetworkAccess { source: icp::network::AccessError }, + NetworkAccess { + source: icp_project::network::AccessError, + }, #[snafu(transparent)] AgentCreate { @@ -392,7 +396,9 @@ pub enum GetAgentForNetworkError { GetNetwork { source: GetNetworkError }, #[snafu(transparent)] - NetworkAccess { source: icp::network::AccessError }, + NetworkAccess { + source: icp_project::network::AccessError, + }, #[snafu(transparent)] AgentCreate { @@ -430,7 +436,9 @@ pub enum GetAgentForSigningError { #[derive(Debug, Snafu)] pub enum GetAgentError { #[snafu(transparent)] - ProjectExists { source: icp::ProjectLoadError }, + ProjectExists { + source: icp_project::ProjectLoadError, + }, #[snafu(display("You can't specify both an environment and a network"))] EnvironmentAndNetworkSpecified, diff --git a/crates/icp-app/src/context/tests.rs b/crates/icp-app/src/context/tests.rs index a597bfeaa..9f6a10536 100644 --- a/crates/icp-app/src/context/tests.rs +++ b/crates/icp-app/src/context/tests.rs @@ -1,8 +1,8 @@ use super::*; use crate::identity::MockIdentityLoader; use candid::Principal; -use icp::network::MockNetworkAccessor; -use icp::{ +use icp_project::network::MockNetworkAccessor; +use icp_project::{ Environment, MockProjectLoader, Network, Project, host::SetCanisterIdForEnvError, network::{ @@ -354,7 +354,7 @@ async fn test_remove_canister_id_for_env_success() { let lookup_result = ids_store.lookup(true, "dev", "backend"); assert!(matches!( lookup_result, - Err(icp::store_id::LookupIdError::IdNotFound { .. }) + Err(icp_project::store_id::LookupIdError::IdNotFound { .. }) )); } @@ -393,7 +393,7 @@ async fn test_get_agent_for_env_uses_environment_network() { "local", NetworkAccess { root_key: local_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:8000").unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -403,7 +403,7 @@ async fn test_get_agent_for_env_uses_environment_network() { "staging", NetworkAccess { root_key: staging_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://staging:9000").unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -482,7 +482,7 @@ async fn test_get_agent_for_network_success() { "local", NetworkAccess { root_key: root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:8000").unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -639,7 +639,7 @@ async fn test_ids_by_environment() { async fn test_get_agent_defaults_outside_project() { let ctx = Context { host: Host { - project: Arc::new(icp::NoProjectLoader), + project: Arc::new(icp_project::NoProjectLoader), ..Host::mocked() }, ..Context::mocked() @@ -708,12 +708,12 @@ async fn test_get_agent_defaults_inside_project_with_default_local() { let ctx = Context { host: Host { - project: Arc::new(icp::MockProjectLoader::new(project)), + project: Arc::new(icp_project::MockProjectLoader::new(project)), network: Arc::new(MockNetworkAccessor::new().with_network( LOCAL, NetworkAccess { root_key: local_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse(DEFAULT_LOCAL_NETWORK_URL).unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -786,12 +786,12 @@ async fn test_get_agent_defaults_with_overridden_local_network() { let ctx = Context { host: Host { - project: Arc::new(icp::MockProjectLoader::new(project)), + project: Arc::new(icp_project::MockProjectLoader::new(project)), network: Arc::new(MockNetworkAccessor::new().with_network( LOCAL, NetworkAccess { root_key: custom_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:9000").unwrap(), // Custom port http_gateway_url: None, use_friendly_domains: false, @@ -889,14 +889,14 @@ async fn test_get_agent_defaults_with_overridden_local_environment() { let ctx = Context { host: Host { - project: Arc::new(icp::MockProjectLoader::new(project)), + project: Arc::new(icp_project::MockProjectLoader::new(project)), network: Arc::new( MockNetworkAccessor::new() .with_network( LOCAL, NetworkAccess { root_key: local_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse(DEFAULT_LOCAL_NETWORK_URL).unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -906,7 +906,7 @@ async fn test_get_agent_defaults_with_overridden_local_environment() { "custom", NetworkAccess { root_key: custom_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:7000").unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -945,7 +945,7 @@ async fn test_get_agent_explicit_network_inside_project() { LOCAL, NetworkAccess { root_key: local_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse(DEFAULT_LOCAL_NETWORK_URL).unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -955,7 +955,7 @@ async fn test_get_agent_explicit_network_inside_project() { "staging", NetworkAccess { root_key: staging_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:8001").unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -995,7 +995,7 @@ async fn test_get_agent_explicit_environment_inside_project() { LOCAL, NetworkAccess { root_key: local_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse(DEFAULT_LOCAL_NETWORK_URL).unwrap(), http_gateway_url: None, use_friendly_domains: false, @@ -1005,7 +1005,7 @@ async fn test_get_agent_explicit_environment_inside_project() { "staging", NetworkAccess { root_key: staging_root_key.clone(), - root_key_source: icp::network::RootKeySource::Configured, + root_key_source: icp_project::network::RootKeySource::Configured, api_url: Url::parse("http://localhost:8001").unwrap(), http_gateway_url: None, use_friendly_domains: false, diff --git a/crates/icp-app/src/directories.rs b/crates/icp-app/src/directories.rs index 607a99bd3..cc9fd5d5c 100644 --- a/crates/icp-app/src/directories.rs +++ b/crates/icp-app/src/directories.rs @@ -10,7 +10,7 @@ use crate::{ settings::{SettingsDirectories, SettingsPaths}, }; use directories::ProjectDirs; -use icp::{fs::lock::LockError, prelude::*}; +use icp_project::{fs::lock::LockError, prelude::*}; use snafu::prelude::*; /// Trait for accessing global ICP CLI directories. diff --git a/crates/icp-app/src/identity/delegation.rs b/crates/icp-app/src/identity/delegation.rs index 64833624d..5b7b3ab65 100644 --- a/crates/icp-app/src/identity/delegation.rs +++ b/crates/icp-app/src/identity/delegation.rs @@ -5,7 +5,7 @@ use ic_agent::export::Principal; use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; -use icp::{fs, prelude::*}; +use icp_project::{fs, prelude::*}; /// Matches the Candid `DelegationChain` record from the cli-backend canister. /// All byte fields are hex-encoded strings on the wire. diff --git a/crates/icp-app/src/identity/key.rs b/crates/icp-app/src/identity/key.rs index 468927f67..93a4f4184 100644 --- a/crates/icp-app/src/identity/key.rs +++ b/crates/icp-app/src/identity/key.rs @@ -35,7 +35,7 @@ use crate::identity::{ LoadIdentityManifestError, PemFormat, WriteIdentityManifestError, }, }; -use icp::{ +use icp_project::{ fs::{ self, lock::{LRead, LWrite}, @@ -66,7 +66,7 @@ pub enum ExportFormat { #[derive(Debug, Snafu)] pub enum LoadIdentityError { #[snafu(transparent)] - ReadFileError { source: icp::fs::IoError }, + ReadFileError { source: icp_project::fs::IoError }, #[snafu(display("failed to load PEM from `{origin}`: failed to parse"))] ParsePemError { @@ -99,7 +99,9 @@ pub enum LoadIdentityError { GetPasswordError { message: String }, #[snafu(transparent)] - LockError { source: icp::fs::lock::LockError }, + LockError { + source: icp_project::fs::lock::LockError, + }, #[snafu(display("failed to load keyring entry"))] LoadEntryError { source: keyring::Error }, @@ -403,7 +405,7 @@ fn try_load_pem_session(dirs: LRead<&IdentityPaths>, name: &str) -> Option Result { - icp::fs::create_dir_all(&self.dir)?; + pub fn ensure_identity_defaults_path(&self) -> Result { + icp_project::fs::create_dir_all(&self.dir)?; Ok(self.dir.join(IDENTITY_DEFAULTS)) } @@ -55,8 +55,8 @@ impl IdentityPaths { self.dir.join(IDENTITIES_LIST) } - pub fn ensure_identity_list_path(&self) -> Result { - icp::fs::create_dir_all(&self.dir)?; + pub fn ensure_identity_list_path(&self) -> Result { + icp_project::fs::create_dir_all(&self.dir)?; Ok(self.dir.join(IDENTITIES_LIST)) } @@ -64,8 +64,8 @@ impl IdentityPaths { self.dir.join(format!("keys/{name}.pem")) } - pub fn ensure_key_pem_path(&self, name: &str) -> Result { - icp::fs::create_dir_all(&self.dir.join("keys"))?; + pub fn ensure_key_pem_path(&self, name: &str) -> Result { + icp_project::fs::create_dir_all(&self.dir.join("keys"))?; Ok(self.dir.join(format!("keys/{name}.pem"))) } @@ -73,8 +73,11 @@ impl IdentityPaths { self.dir.join(format!("delegations/{name}.json")) } - pub fn ensure_delegation_chain_path(&self, name: &str) -> Result { - icp::fs::create_dir_all(&self.dir.join("delegations"))?; + pub fn ensure_delegation_chain_path( + &self, + name: &str, + ) -> Result { + icp_project::fs::create_dir_all(&self.dir.join("delegations"))?; Ok(self.dir.join(format!("delegations/{name}.json"))) } } diff --git a/crates/icp-app/src/lib.rs b/crates/icp-app/src/lib.rs index cc01acdc8..ff33ec2a4 100644 --- a/crates/icp-app/src/lib.rs +++ b/crates/icp-app/src/lib.rs @@ -7,10 +7,10 @@ //! some manifest says about it. //! //! Projects — manifests, building, installing, syncing, deploying — are -//! [`icp`], which this crate depends on and which does not depend on this one. +//! [`icp-project`], which this crate depends on and which does not depend on this one. //! The seams that project code reaches the machine through -//! ([`icp::network::Access`], [`icp::canister::wasm::Fetch`], -//! [`icp::canister::recipe::Resolve`], [`icp::host::Observe`]) are declared +//! ([`icp_project::network::Access`], [`icp_project::canister::wasm::Fetch`], +//! [`icp_project::canister::recipe::Resolve`], [`icp_project::host::Observe`]) are declared //! there and implemented here. pub mod agent; diff --git a/crates/icp-app/src/network/accessor.rs b/crates/icp-app/src/network/accessor.rs index c67efb343..a97d770b5 100644 --- a/crates/icp-app/src/network/accessor.rs +++ b/crates/icp-app/src/network/accessor.rs @@ -1,4 +1,4 @@ -//! The host's answer to [`icp::network::Access`]: resolving a project's +//! The host's answer to [`icp_project::network::Access`]: resolving a project's //! networks against what is actually running on this machine. use std::{collections::BTreeMap, sync::Arc}; @@ -8,12 +8,12 @@ use candid::Principal; use snafu::{ResultExt, Snafu}; use url::Url; -use icp::manifest::{ProjectRootLocate, ProjectRootLocateError}; -use icp::network::{ +use icp_project::manifest::{ProjectRootLocate, ProjectRootLocateError}; +use icp_project::network::{ Access, AccessError, CollectFriendlyDomains, Configuration, NetworkAccess, NetworkUrls, }; -use icp::prelude::*; -use icp::{CACHE_DIR, ICP_BASE, Network}; +use icp_project::prelude::*; +use icp_project::{CACHE_DIR, ICP_BASE, Network}; use crate::network::{ NetworkDirectory, custom_domains, diff --git a/crates/icp-app/src/network/config.rs b/crates/icp-app/src/network/config.rs index 7894a2655..da28f4dbb 100644 --- a/crates/icp-app/src/network/config.rs +++ b/crates/icp-app/src/network/config.rs @@ -18,7 +18,7 @@ use snafu::prelude::*; use url::Url; use uuid::Uuid; -use icp::prelude::*; +use icp_project::prelude::*; /// How long to wait for the gateway to answer before concluding the network is defunct. const PROBE_TIMEOUT: Duration = Duration::from_secs(5); diff --git a/crates/icp-app/src/network/custom_domains.rs b/crates/icp-app/src/network/custom_domains.rs index 18695b673..1e73ca96e 100644 --- a/crates/icp-app/src/network/custom_domains.rs +++ b/crates/icp-app/src/network/custom_domains.rs @@ -4,7 +4,7 @@ use candid::Principal; use snafu::prelude::*; use url::Url; -use icp::prelude::*; +use icp_project::prelude::*; /// Writes a `custom-domains.txt` file to the given status directory. /// @@ -40,7 +40,7 @@ pub fn write_custom_domains( for (full_domain, canister_id) in extra_entries { content.push_str(&format!("{full_domain}:{canister_id}\n")); } - icp::fs::write(&file_path, content.as_bytes())?; + icp_project::fs::write(&file_path, content.as_bytes())?; Ok(()) } @@ -143,7 +143,7 @@ pub fn canister_gateway_url( #[derive(Debug, Snafu)] pub enum WriteCustomDomainsError { #[snafu(transparent)] - WriteFile { source: icp::fs::IoError }, + WriteFile { source: icp_project::fs::IoError }, } #[cfg(test)] diff --git a/crates/icp-app/src/network/directory.rs b/crates/icp-app/src/network/directory.rs index 873502c2e..2018feec9 100644 --- a/crates/icp-app/src/network/directory.rs +++ b/crates/icp-app/src/network/directory.rs @@ -54,7 +54,7 @@ use std::io::ErrorKind; use snafu::{ResultExt, prelude::*}; use crate::network::config::NetworkDescriptorModel; -use icp::{ +use icp_project::{ fs::{ create_dir_all, json, lock::{DirectoryStructureLock, LWrite, LockError, PathsAccess}, @@ -100,7 +100,7 @@ pub enum LoadNetworkFileError { } impl NetworkDirectory { - pub fn ensure_exists(&self) -> Result<(), icp::fs::IoError> { + pub fn ensure_exists(&self) -> Result<(), icp_project::fs::IoError> { // Network root create_dir_all(&self.network_root)?; @@ -150,7 +150,7 @@ impl NetworkDirectory { &self, ) -> Result<(), CleanupNetworkDescriptorError> { self.root()? - .with_write(async |root| icp::fs::remove_file(&root.network_descriptor_path())) + .with_write(async |root| icp_project::fs::remove_file(&root.network_descriptor_path())) .await??; Ok(()) } @@ -162,7 +162,7 @@ impl NetworkDirectory { ) -> Result<(), CleanupNetworkDescriptorError> { if let Some(port) = gateway_port { self.port(port)? - .with_write(async |paths| icp::fs::remove_file(&paths.descriptor_path())) + .with_write(async |paths| icp_project::fs::remove_file(&paths.descriptor_path())) .await??; } Ok(()) @@ -308,7 +308,7 @@ pub enum CleanupNetworkDescriptorError { #[snafu(transparent)] LockFileError { source: LockError }, #[snafu(transparent)] - DeleteFileError { source: icp::fs::IoError }, + DeleteFileError { source: icp_project::fs::IoError }, } #[derive(Debug, Snafu)] @@ -317,14 +317,14 @@ pub enum SavePidError { LockFileError { source: LockError }, #[snafu(transparent)] - WritePid { source: icp::fs::IoError }, + WritePid { source: icp_project::fs::IoError }, } #[derive(Debug, Snafu)] pub enum LoadPidError { #[snafu(display("failed to read PID from {path}"))] ReadPid { - source: icp::fs::IoError, + source: icp_project::fs::IoError, path: PathBuf, }, #[snafu(transparent)] diff --git a/crates/icp-app/src/network/managed/cache.rs b/crates/icp-app/src/network/managed/cache.rs index e511bc7b8..56cd0b24c 100644 --- a/crates/icp-app/src/network/managed/cache.rs +++ b/crates/icp-app/src/network/managed/cache.rs @@ -9,8 +9,8 @@ use tar::Archive; use tracing::debug; use crate::package::{PackageCachePaths, get_tag, get_tag_with_updater, set_tag_with_updater}; -use icp::fs::lock::{LRead, LWrite}; -use icp::prelude::*; +use icp_project::fs::lock::{LRead, LWrite}; +use icp_project::prelude::*; const LAUNCHER_NAME: &str = "icp-cli-network-launcher"; @@ -85,7 +85,9 @@ fn is_updater_stale(updater_version: Option<&str>) -> bool { #[derive(Debug, Snafu)] pub enum ReadCacheError { #[snafu(display("failed to read package tag"))] - LoadTag { source: icp::fs::json::Error }, + LoadTag { + source: icp_project::fs::json::Error, + }, } pub async fn get_latest_launcher_version(client: &Client) -> Result { @@ -126,7 +128,7 @@ pub async fn download_launcher_version( version_req.to_owned() }; let version_path = paths.launcher_version(&pkg_version); - icp::fs::create_dir_all(&paths.launcher_dir()).context(CreateDirSnafu)?; + icp_project::fs::create_dir_all(&paths.launcher_dir()).context(CreateDirSnafu)?; let mut tmp = camino_tempfile::tempfile().context(TempFileSnafu)?; let tmp_write = BufWriter::new(&tmp); let arch = match std::env::consts::ARCH { @@ -171,17 +173,17 @@ pub async fn download_launcher_version( let decompressor = GzDecoder::new(tmp_read); let mut archive = Archive::new(decompressor); let extract_dir = paths.launcher_dir().join("tmp"); - icp::fs::create_dir_all(&extract_dir).context(TempDirSnafu)?; + icp_project::fs::create_dir_all(&extract_dir).context(TempDirSnafu)?; let tarball_name = format!("icp-cli-network-launcher-{arch}-{os}-{pkg_version}"); let extracted_dir_path = extract_dir.join(&tarball_name); if extracted_dir_path.exists() { - icp::fs::remove_dir_all(&extracted_dir_path).context(RemoveExistingSnafu)? + icp_project::fs::remove_dir_all(&extracted_dir_path).context(RemoveExistingSnafu)? } archive .unpack(&extract_dir) .context(ExtractSnafu { path: &extract_dir })?; if version_path.exists() { - icp::fs::remove_dir_all(&version_path).context(RemoveExistingSnafu)? + icp_project::fs::remove_dir_all(&version_path).context(RemoveExistingSnafu)? } std::fs::rename(&extracted_dir_path, &version_path).context(MoveExtractedSnafu { from: extracted_dir_path, @@ -201,7 +203,7 @@ pub async fn check_launcher_update_available( client: &Client, ) -> Option { let ts_path = paths.update_nag_timestamp(); - if let Ok(contents) = icp::fs::read_to_string(&ts_path) + if let Ok(contents) = icp_project::fs::read_to_string(&ts_path) && let Ok(ts) = contents.trim().parse::() { let then = SystemTime::UNIX_EPOCH + Duration::from_secs(ts); @@ -216,7 +218,7 @@ pub async fn check_launcher_update_available( .expect("since epoch") .as_secs(); // Write timestamp regardless of outcome, so we don't re-check on failure - let _ = icp::fs::write(&ts_path, format!("{now}\n").as_bytes()); + let _ = icp_project::fs::write(&ts_path, format!("{now}\n").as_bytes()); let latest = get_latest_launcher_version(client).await.ok()?; if latest != cached_version { @@ -247,11 +249,11 @@ pub enum DownloadLauncherError { #[snafu(display("failed to save downloaded network launcher"))] SaveDownload { source: std::io::Error }, #[snafu(display("failed to remove existing launcher"))] - RemoveExisting { source: icp::fs::IoError }, + RemoveExisting { source: icp_project::fs::IoError }, #[snafu(display("failed to create temporary file for download"))] TempFile { source: std::io::Error }, #[snafu(display("failed to create temporary directory for extraction"))] - TempDir { source: icp::fs::IoError }, + TempDir { source: icp_project::fs::IoError }, #[snafu(display("buffer failure in temporary file"))] Buffer { source: std::io::Error }, #[snafu(display("failed to extract downloaded network launcher to {path}"))] @@ -266,11 +268,13 @@ pub enum DownloadLauncherError { to: PathBuf, }, #[snafu(display("failed to create network launcher cache directory"))] - CreateDir { source: icp::fs::IoError }, + CreateDir { source: icp_project::fs::IoError }, #[snafu(display("failed to fetch latest network launcher version from GitHub"))] LatestVersionFetch { source: reqwest::Error }, #[snafu(display("failed to parse latest version response from GitHub"))] LatestVersionParse, #[snafu(display("failed to create package tag"))] - CreateTag { source: icp::fs::json::Error }, + CreateTag { + source: icp_project::fs::json::Error, + }, } diff --git a/crates/icp-app/src/network/managed/docker.rs b/crates/icp-app/src/network/managed/docker.rs index 2b6c45e79..b3849f98c 100644 --- a/crates/icp-app/src/network/managed/docker.rs +++ b/crates/icp-app/src/network/managed/docker.rs @@ -24,8 +24,8 @@ use crate::network::{ config::ChildLocator, managed::launcher::{CUSTOM_DOMAINS_FEATURE, NetworkInstance}, }; -use icp::network::ManagedImageConfig; -use icp::prelude::*; +use icp_project::network::ManagedImageConfig; +use icp_project::prelude::*; use super::launcher::{ MAX_OUTPUT_TAIL_BYTES, MAX_OUTPUT_TAIL_LINES, output_tail, wait_for_launcher_status, diff --git a/crates/icp-app/src/network/managed/launcher.rs b/crates/icp-app/src/network/managed/launcher.rs index d2f24b43d..04e6cb20a 100644 --- a/crates/icp-app/src/network/managed/launcher.rs +++ b/crates/icp-app/src/network/managed/launcher.rs @@ -10,7 +10,7 @@ use tokio::{process::Child, select, sync::mpsc::Sender, time::Instant}; use tracing::{info, warn}; use crate::network::config::ChildLocator; -use icp::{ +use icp_project::{ network::{ManagedLauncherConfig, Port}, prelude::*, }; @@ -178,7 +178,7 @@ fn premature_exit_detail(background: bool, stderr_file: &Path) -> String { if !background { return String::new(); } - match icp::fs::read_to_string(stderr_file) { + match icp_project::fs::read_to_string(stderr_file) { Ok(contents) => { let tail = output_tail(&contents); if tail.is_empty() { @@ -334,7 +334,7 @@ pub enum WaitForFileError { }, #[snafu(transparent)] - ReadFile { source: icp::fs::IoError }, + ReadFile { source: icp_project::fs::IoError }, } /// Waits for a file to be created and have a full line of content. Call the function before initing the external process, @@ -378,7 +378,7 @@ pub fn wait_for_single_line_file( }; let event = res.context(ReadEventSnafu { path: &dir })?; if event.kind.is_modify() || event.kind.is_create() { - match icp::fs::read_to_string(&path) { + match icp_project::fs::read_to_string(&path) { Ok(content) => { if content.ends_with('\n') { return Ok(content); @@ -506,7 +506,7 @@ mod tests { fn premature_exit_detail_includes_captured_output() { let dir = camino_tempfile::Utf8TempDir::new().unwrap(); let file = dir.path().join("stderr.log"); - icp::fs::write(&file, b"Address already in use (os error 48)\n").unwrap(); + icp_project::fs::write(&file, b"Address already in use (os error 48)\n").unwrap(); let detail = premature_exit_detail(true, &file); assert!(detail.starts_with('\n')); assert!(detail.contains("Address already in use")); diff --git a/crates/icp-app/src/network/managed/run.rs b/crates/icp-app/src/network/managed/run.rs index d12a8a683..355ed7c22 100644 --- a/crates/icp-app/src/network/managed/run.rs +++ b/crates/icp-app/src/network/managed/run.rs @@ -36,7 +36,7 @@ use crate::network::{ launcher::{ChildSignalOnDrop, launcher_settings_flags, spawn_network_launcher}, }, }; -use icp::{ +use icp_project::{ fs::{create_dir_all, lock::LockError, remove_dir_all}, network::{Managed, ManagedLauncherConfig, ManagedMode, Port}, prelude::*, @@ -94,7 +94,7 @@ pub async fn stop_network(locator: &ChildLocator) -> Result<(), StopNetworkError #[derive(Debug, Snafu)] pub enum RunNetworkError { #[snafu(transparent)] - CreateDirFailed { source: icp::fs::IoError }, + CreateDirFailed { source: icp_project::fs::IoError }, #[snafu(transparent)] LockFileError { source: LockError }, @@ -412,13 +412,13 @@ pub enum RunNetworkLauncherError { CreateStatusDir { source: std::io::Error }, #[snafu(display("failed to create dir"))] - CreateDirAll { source: icp::fs::IoError }, + CreateDirAll { source: icp_project::fs::IoError }, #[snafu(display("failed to remove dir"))] - RemoveDirAll { source: icp::fs::IoError }, + RemoveDirAll { source: icp_project::fs::IoError }, #[snafu(display("failed to remove file"))] - RemoveFile { source: icp::fs::IoError }, + RemoveFile { source: icp_project::fs::IoError }, #[snafu(transparent)] SaveNetworkDescriptor { source: SaveNetworkDescriptorError }, @@ -820,7 +820,7 @@ async fn install_proxy( #[cfg(test)] mod tests { use super::*; - use icp::network::{Gateway, ManagedLauncherConfig, Port}; + use icp_project::network::{Gateway, ManagedLauncherConfig, Port}; #[test] fn transform_native_launcher_default_config() { diff --git a/crates/icp-app/src/network/resolve.rs b/crates/icp-app/src/network/resolve.rs index 0ad701b64..e9e93d1ad 100644 --- a/crates/icp-app/src/network/resolve.rs +++ b/crates/icp-app/src/network/resolve.rs @@ -11,8 +11,8 @@ use ic_agent::{AgentError, identity::AnonymousIdentity}; use snafu::{OptionExt, ResultExt, Snafu}; use url::Url; -use icp::network::{Connected, NetworkAccess, NetworkUrls, RootKeySource, RootKeySpec}; -use icp::prelude::*; +use icp_project::network::{Connected, NetworkAccess, NetworkUrls, RootKeySource, RootKeySpec}; +use icp_project::prelude::*; use crate::{ agent::{Create, CreateAgentError}, diff --git a/crates/icp-app/src/operations/snapshot_transfer.rs b/crates/icp-app/src/operations/snapshot_transfer.rs index 686c6036b..584dc1198 100644 --- a/crates/icp-app/src/operations/snapshot_transfer.rs +++ b/crates/icp-app/src/operations/snapshot_transfer.rs @@ -13,10 +13,10 @@ use ic_management_canister_types::{ UploadCanisterSnapshotMetadataResult, }; -use icp::operations::proxy::UpdateOrProxyError; -use icp::operations::proxy_management; -use icp::operations::task::TaskReporter; -use icp::{ +use icp_project::operations::proxy::UpdateOrProxyError; +use icp_project::operations::proxy_management; +use icp_project::operations::task::TaskReporter; +use icp_project::{ fs::lock::{DirectoryStructureLock, LWrite, LockError, PathsAccess}, prelude::*, }; @@ -79,9 +79,9 @@ impl SnapshotPaths { } /// Ensure the directory and wasm chunk store subdirectory exist. - pub fn ensure_dirs(&self) -> Result<(), icp::fs::IoError> { - icp::fs::create_dir_all(&self.dir)?; - icp::fs::create_dir_all(&self.wasm_chunk_store_dir())?; + pub fn ensure_dirs(&self) -> Result<(), icp_project::fs::IoError> { + icp_project::fs::create_dir_all(&self.dir)?; + icp_project::fs::create_dir_all(&self.wasm_chunk_store_dir())?; Ok(()) } @@ -147,13 +147,17 @@ pub enum SnapshotTransferError { }, #[snafu(transparent)] - FsIo { source: icp::fs::IoError }, + FsIo { source: icp_project::fs::IoError }, #[snafu(transparent)] - FsRename { source: icp::fs::RenameError }, + FsRename { + source: icp_project::fs::RenameError, + }, #[snafu(transparent)] - Json { source: icp::fs::json::Error }, + Json { + source: icp_project::fs::json::Error, + }, #[snafu(transparent)] Lock { source: LockError }, @@ -505,7 +509,7 @@ pub async fn download_blob_to_file( let output_path = paths.blob_path(blob_type); if total_size == 0 { - icp::fs::write(&output_path, &[])?; + icp_project::fs::write(&output_path, &[])?; return Ok(()); } @@ -632,7 +636,7 @@ pub async fn download_wasm_chunk( .await .context(ReadWasmChunkSnafu { hash: &hash_hex })?; - icp::fs::write(&output_path, &result.chunk)?; + icp_project::fs::write(&output_path, &result.chunk)?; Ok(()) } @@ -769,7 +773,7 @@ pub async fn upload_wasm_chunk( paths: LWrite<&SnapshotPaths>, ) -> Result<(), SnapshotTransferError> { let chunk_path = paths.wasm_chunk_path(chunk_hash); - let chunk = icp::fs::read(&chunk_path)?; + let chunk = icp_project::fs::read(&chunk_path)?; let args = UploadCanisterSnapshotDataArgs { canister_id, @@ -795,7 +799,7 @@ pub fn save_upload_progress( progress: &UploadProgress, paths: LWrite<&SnapshotPaths>, ) -> Result<(), SnapshotTransferError> { - icp::fs::json::save(&paths.upload_progress_path(), progress)?; + icp_project::fs::json::save(&paths.upload_progress_path(), progress)?; Ok(()) } @@ -809,14 +813,14 @@ pub fn load_upload_progress( path: paths.dir().to_path_buf(), }); } - Ok(icp::fs::json::load(&progress_path)?) + Ok(icp_project::fs::json::load(&progress_path)?) } /// Delete upload progress file. pub fn delete_upload_progress(paths: LWrite<&SnapshotPaths>) -> Result<(), SnapshotTransferError> { let progress_path = paths.upload_progress_path(); if progress_path.exists() { - icp::fs::remove_file(&progress_path)?; + icp_project::fs::remove_file(&progress_path)?; } Ok(()) } @@ -843,7 +847,7 @@ pub fn save_download_progress( drop(file); // Atomic rename - icp::fs::rename(&tmp_path, &target_path)?; + icp_project::fs::rename(&tmp_path, &target_path)?; Ok(()) } @@ -852,7 +856,7 @@ pub fn save_download_progress( pub fn load_download_progress( paths: LWrite<&SnapshotPaths>, ) -> Result { - Ok(icp::fs::json::load_or_default( + Ok(icp_project::fs::json::load_or_default( &paths.download_progress_path(), )?) } @@ -863,7 +867,7 @@ pub fn delete_download_progress( ) -> Result<(), SnapshotTransferError> { let progress_path = paths.download_progress_path(); if progress_path.exists() { - icp::fs::remove_file(&progress_path)?; + icp_project::fs::remove_file(&progress_path)?; } Ok(()) } @@ -873,7 +877,7 @@ pub fn save_metadata( metadata: &ReadCanisterSnapshotMetadataResult, paths: LWrite<&SnapshotPaths>, ) -> Result<(), SnapshotTransferError> { - icp::fs::json::save(&paths.metadata_path(), metadata)?; + icp_project::fs::json::save(&paths.metadata_path(), metadata)?; Ok(()) } @@ -887,5 +891,5 @@ pub fn load_metadata( path: metadata_path, }); } - Ok(icp::fs::json::load(&metadata_path)?) + Ok(icp_project::fs::json::load(&metadata_path)?) } diff --git a/crates/icp-app/src/operations/token/approve.rs b/crates/icp-app/src/operations/token/approve.rs index 529a9e748..fd247b699 100644 --- a/crates/icp-app/src/operations/token/approve.rs +++ b/crates/icp-app/src/operations/token/approve.rs @@ -1,7 +1,7 @@ use bigdecimal::BigDecimal; use candid::{Decode, Encode, Nat, Principal}; use ic_agent::{Agent, AgentError}; -use icp::parsers::to_token_unit_amount; +use icp_project::parsers::to_token_unit_amount; use icrc_ledger_types::icrc1::account::Account; use icrc_ledger_types::icrc2::approve::{ApproveArgs, ApproveError as Icrc2ApproveError}; use snafu::{ResultExt, Snafu}; diff --git a/crates/icp-app/src/operations/token/transfer.rs b/crates/icp-app/src/operations/token/transfer.rs index 632d01307..273659bf6 100644 --- a/crates/icp-app/src/operations/token/transfer.rs +++ b/crates/icp-app/src/operations/token/transfer.rs @@ -13,7 +13,7 @@ use icrc_ledger_types::icrc1::{ use num_traits::ToPrimitive; use snafu::{ResultExt, Snafu}; -use icp::parsers::FlexibleAccountId; +use icp_project::parsers::FlexibleAccountId; use super::{TOKEN_LEDGER_CIDS, TokenAmount}; diff --git a/crates/icp-app/src/package.rs b/crates/icp-app/src/package.rs index abc28a2b1..9d39dd8be 100644 --- a/crates/icp-app/src/package.rs +++ b/crates/icp-app/src/package.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use snafu::prelude::*; -use icp::{ +use icp_project::{ fs::lock::{DirectoryStructureLock, LRead, LWrite, LockError, PathsAccess}, prelude::*, }; @@ -82,13 +82,13 @@ pub fn cache_wasm( cache: LWrite<&PackageCachePaths>, sha: &str, wasm: &[u8], -) -> Result<(), icp::fs::IoError> { +) -> Result<(), icp_project::fs::IoError> { let cache_path = cache.wasm_sha(sha); let cache_wasm_path = cache_path.wasm(); if !cache_wasm_path.exists() { - icp::fs::create_dir_all(cache_path.dir())?; - icp::fs::write(&cache_wasm_path, wasm)?; - _ = icp::fs::write(&cache_path.atime(), b""); + icp_project::fs::create_dir_all(cache_path.dir())?; + icp_project::fs::write(&cache_wasm_path, wasm)?; + _ = icp_project::fs::write(&cache_path.atime(), b""); } Ok(()) } @@ -138,8 +138,8 @@ pub fn read_cached_recipe( let cache_path = cache.recipe_sha(cache_key); let template_path = cache_path.template(); if template_path.exists() { - let template = icp::fs::read(&template_path).context(RecipeCacheIoSnafu)?; - _ = icp::fs::write(&cache_path.atime(), b""); + let template = icp_project::fs::read(&template_path).context(RecipeCacheIoSnafu)?; + _ = icp_project::fs::write(&cache_path.atime(), b""); Ok(Some(template)) } else { Ok(None) @@ -183,9 +183,9 @@ pub fn cache_recipe( let cache_path = cache.recipe_sha(cache_key); let template_path = cache_path.template(); if !template_path.exists() { - icp::fs::create_dir_all(cache_path.dir()).context(RecipeCacheIoSnafu)?; - icp::fs::write(&template_path, template).context(RecipeCacheIoSnafu)?; - _ = icp::fs::write(&cache_path.atime(), b""); + icp_project::fs::create_dir_all(cache_path.dir()).context(RecipeCacheIoSnafu)?; + icp_project::fs::write(&template_path, template).context(RecipeCacheIoSnafu)?; + _ = icp_project::fs::write(&cache_path.atime(), b""); } Ok(()) } @@ -193,13 +193,17 @@ pub fn cache_recipe( #[derive(Debug, Snafu)] pub enum RecipeCacheError { #[snafu(display("failed to load recipe cache tag"))] - LoadRecipeTag { source: icp::fs::json::Error }, + LoadRecipeTag { + source: icp_project::fs::json::Error, + }, #[snafu(display("failed to save recipe cache tag"))] - SaveRecipeTag { source: icp::fs::json::Error }, + SaveRecipeTag { + source: icp_project::fs::json::Error, + }, #[snafu(display("failed to read or write recipe cache file"))] - RecipeCacheIo { source: icp::fs::IoError }, + RecipeCacheIo { source: icp_project::fs::IoError }, } pub type PackageCache = DirectoryStructureLock; @@ -222,8 +226,8 @@ pub fn get_tag( paths: LRead<&PackageCachePaths>, tool: &str, tag: &str, -) -> Result, icp::fs::json::Error> { - let manifest: Manifest = icp::fs::json::load_or_default(&paths.manifest())?; +) -> Result, icp_project::fs::json::Error> { + let manifest: Manifest = icp_project::fs::json::load_or_default(&paths.manifest())?; Ok(manifest.tags.get(&format!("{tool}:{tag}")).cloned()) } @@ -232,12 +236,12 @@ pub fn set_tag( tool: &str, version: &str, tag: &str, -) -> Result<(), icp::fs::json::Error> { - let mut manifest: Manifest = icp::fs::json::load_or_default(&paths.manifest())?; +) -> Result<(), icp_project::fs::json::Error> { + let mut manifest: Manifest = icp_project::fs::json::load_or_default(&paths.manifest())?; manifest .tags .insert(format!("{tool}:{tag}"), version.to_string()); - icp::fs::json::save(&paths.manifest(), &manifest)?; + icp_project::fs::json::save(&paths.manifest(), &manifest)?; Ok(()) } @@ -248,15 +252,15 @@ pub fn set_tag_with_updater( version: &str, tag: &str, updater_version: &str, -) -> Result<(), icp::fs::json::Error> { - let mut manifest: Manifest = icp::fs::json::load_or_default(&paths.manifest())?; +) -> Result<(), icp_project::fs::json::Error> { + let mut manifest: Manifest = icp_project::fs::json::load_or_default(&paths.manifest())?; manifest .tags .insert(format!("{tool}:{tag}"), version.to_string()); manifest .updater_versions .insert(tool.to_string(), updater_version.to_string()); - icp::fs::json::save(&paths.manifest(), &manifest)?; + icp_project::fs::json::save(&paths.manifest(), &manifest)?; Ok(()) } @@ -266,8 +270,8 @@ pub fn get_tag_with_updater( paths: LRead<&PackageCachePaths>, tool: &str, tag: &str, -) -> Result<(Option, Option), icp::fs::json::Error> { - let manifest: Manifest = icp::fs::json::load_or_default(&paths.manifest())?; +) -> Result<(Option, Option), icp_project::fs::json::Error> { + let manifest: Manifest = icp_project::fs::json::load_or_default(&paths.manifest())?; let tag_value = manifest.tags.get(&format!("{tool}:{tag}")).cloned(); let updater = manifest.updater_versions.get(tool).cloned(); Ok((tag_value, updater)) diff --git a/crates/icp-app/src/recipe.rs b/crates/icp-app/src/recipe.rs index d6989f7d2..37b278e91 100644 --- a/crates/icp-app/src/recipe.rs +++ b/crates/icp-app/src/recipe.rs @@ -13,13 +13,13 @@ use crate::package::{ PackageCache, cache_registry_recipe, cache_uri_recipe, read_cached_registry_recipe, read_cached_uri_recipe, }; -use icp::{ +use icp_project::{ fs::read, manifest::recipe::{Recipe, RecipeType}, prelude::*, }; -use icp::canister::recipe::{Fetched, Resolve, ResolveError}; +use icp_project::canister::recipe::{Fetched, Resolve, ResolveError}; /// Fetches recipe templates over HTTP, caching downloads in the package cache. /// Template *rendering* is a separate stage @@ -76,7 +76,7 @@ enum TemplateSource { #[derive(Debug, Snafu)] pub enum RecipeFetchError { #[snafu(display("failed to read local recipe template file"))] - ReadFile { source: icp::fs::IoError }, + ReadFile { source: icp_project::fs::IoError }, #[snafu(display("failed to decode UTF-8 string"))] DecodeUtf8 { source: FromUtf8Error }, @@ -106,7 +106,9 @@ pub enum RecipeFetchError { }, #[snafu(display("failed to acquire lock on package cache"))] - LockCache { source: icp::fs::lock::LockError }, + LockCache { + source: icp_project::fs::lock::LockError, + }, } impl RecipeFetcher { @@ -352,7 +354,7 @@ fn parse_bytes_to_string(bytes: Vec) -> Result { #[cfg(test)] mod tests { use super::*; - use icp::manifest::recipe::{Recipe, RecipeType}; + use icp_project::manifest::recipe::{Recipe, RecipeType}; fn fetcher(cache_dir: &Path) -> RecipeFetcher { RecipeFetcher { @@ -478,11 +480,11 @@ mod tests { ); // Rendering fails, so the caller never commits. - let ctx = icp::canister::recipe::RecipeContext { + let ctx = icp_project::canister::recipe::RecipeContext { canister_name: "c".to_owned(), }; assert!( - icp::canister::recipe::render_recipe(&fetched.template, &recipe, &ctx).is_err(), + icp_project::canister::recipe::render_recipe(&fetched.template, &recipe, &ctx).is_err(), "fixture template must fail to render" ); diff --git a/crates/icp-app/src/settings.rs b/crates/icp-app/src/settings.rs index adcbb635c..38173da30 100644 --- a/crates/icp-app/src/settings.rs +++ b/crates/icp-app/src/settings.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use snafu::{Snafu, ensure}; -use icp::{ +use icp_project::{ fs::{ json, lock::{DirectoryStructureLock, LRead, LWrite, LockError, PathsAccess}, @@ -32,8 +32,8 @@ impl SettingsPaths { } /// Ensures the settings directory exists and returns the path to the settings file. - pub fn ensure_settings_path(&self) -> Result { - icp::fs::create_dir_all(&self.dir)?; + pub fn ensure_settings_path(&self) -> Result { + icp_project::fs::create_dir_all(&self.dir)?; Ok(self.settings_path()) } } @@ -137,7 +137,7 @@ pub enum WriteSettingsError { WriteJsonError { source: json::Error }, #[snafu(transparent)] - CreateDirectoryError { source: icp::fs::IoError }, + CreateDirectoryError { source: icp_project::fs::IoError }, } #[derive(Debug, Snafu)] diff --git a/crates/icp-app/src/signed_message.rs b/crates/icp-app/src/signed_message.rs index f4971b0b5..c039f02bd 100644 --- a/crates/icp-app/src/signed_message.rs +++ b/crates/icp-app/src/signed_message.rs @@ -23,8 +23,8 @@ use ic_agent::agent::{ signed_update_inspect, }; use ic_agent::{AgentError, RequestId}; -use icp::network::RootKeySpec; -use icp::prelude::*; +use icp_project::network::RootKeySpec; +use icp_project::prelude::*; use serde::{Deserialize, Serialize}; use snafu::prelude::*; use time::{Duration, OffsetDateTime, UtcOffset, format_description::well_known::Rfc3339}; @@ -230,7 +230,7 @@ pub struct Validated { impl SignedMessage { /// Writes the message to `path`. pub fn save(&self, path: &Path) -> Result<(), Error> { - icp::fs::json::save(path, self).context(SaveSnafu { path }) + icp_project::fs::json::save(path, self).context(SaveSnafu { path }) } /// Renders the message exactly as [`SignedMessage::save`] would write it, for @@ -242,7 +242,7 @@ impl SignedMessage { /// Reads a message from `path`. The result is unvalidated — call /// [`SignedMessage::validate`] before acting on any of it. pub fn load(path: &Path) -> Result { - icp::fs::json::load(path).context(LoadSnafu { path }) + icp_project::fs::json::load(path).context(LoadSnafu { path }) } /// Checks the file against its envelope and reports where `now` falls in the @@ -481,7 +481,7 @@ pub fn format_timestamp(t: OffsetDateTime) -> String { pub enum Error { #[snafu(display("failed to write the signed message to {path}"))] Save { - source: icp::fs::json::Error, + source: icp_project::fs::json::Error, path: PathBuf, }, @@ -490,7 +490,7 @@ pub enum Error { #[snafu(display("failed to read the signed message at {path}"))] Load { - source: icp::fs::json::Error, + source: icp_project::fs::json::Error, path: PathBuf, }, diff --git a/crates/icp-app/src/telemetry_data.rs b/crates/icp-app/src/telemetry_data.rs index 3f13ec548..eb84347b4 100644 --- a/crates/icp-app/src/telemetry_data.rs +++ b/crates/icp-app/src/telemetry_data.rs @@ -44,7 +44,7 @@ impl TelemetryData { *self.network_type.lock().unwrap() } - fn set_project(&self, project: &icp::Project) { + fn set_project(&self, project: &icp_project::Project) { let recipes: Vec = project .canisters .values() @@ -66,11 +66,15 @@ impl TelemetryData { /// The project facts telemetry keeps are established during environment /// resolution, so the bag receives them from there rather than the other way /// around. -impl icp::host::Observe for TelemetryData { - fn environment_resolved(&self, project: &icp::Project, environment: &icp::Environment) { +impl icp_project::host::Observe for TelemetryData { + fn environment_resolved( + &self, + project: &icp_project::Project, + environment: &icp_project::Environment, + ) { let network_type = match &environment.network.configuration { - icp::network::Configuration::Managed { .. } => NetworkType::Managed, - icp::network::Configuration::Connected { .. } => NetworkType::Connected, + icp_project::network::Configuration::Managed { .. } => NetworkType::Managed, + icp_project::network::Configuration::Connected { .. } => NetworkType::Connected, }; self.set_network_type(network_type); self.set_project(project); diff --git a/crates/icp-app/src/wasm.rs b/crates/icp-app/src/wasm.rs index be298e27a..61df53a48 100644 --- a/crates/icp-app/src/wasm.rs +++ b/crates/icp-app/src/wasm.rs @@ -5,11 +5,11 @@ use std::sync::Arc; use camino::{Utf8Path, Utf8PathBuf}; -use icp::canister::wasm::{Fetch, FetchError}; -use icp::fs::read; -use icp::manifest::prebuilt::SourceField; -use icp::prelude::*; use icp_events::StepReporter; +use icp_project::canister::wasm::{Fetch, FetchError}; +use icp_project::fs::read; +use icp_project::manifest::prebuilt::SourceField; +use icp_project::prelude::*; use reqwest::{Client, Method, Request}; use sha2::{Digest, Sha256}; use snafu::prelude::*; @@ -21,7 +21,7 @@ use crate::package::{PackageCache, cache_wasm}; pub enum WasmError { #[snafu(display("failed to read wasm file at '{path}'"))] ReadLocal { - source: icp::fs::IoError, + source: icp_project::fs::IoError, path: Utf8PathBuf, }, @@ -41,10 +41,12 @@ pub enum WasmError { ChecksumMismatch { expected: String, actual: String }, #[snafu(display("failed to cache wasm file"))] - CacheFile { source: icp::fs::IoError }, + CacheFile { source: icp_project::fs::IoError }, #[snafu(display("failed to acquire lock on package cache"))] - LockCache { source: icp::fs::lock::LockError }, + LockCache { + source: icp_project::fs::lock::LockError, + }, } /// The [`Fetch`] that downloads over HTTP and caches in the package cache. @@ -117,7 +119,7 @@ impl Fetcher { let wasm_cache = r.wasm_sha(expected); let path = wasm_cache.wasm(); if path.exists() { - _ = icp::fs::write(&wasm_cache.atime(), b""); + _ = icp_project::fs::write(&wasm_cache.atime(), b""); Some(path) } else { None diff --git a/crates/icp-cli/Cargo.toml b/crates/icp-cli/Cargo.toml index 9cec04b5d..47215ff6a 100644 --- a/crates/icp-cli/Cargo.toml +++ b/crates/icp-cli/Cargo.toml @@ -39,7 +39,7 @@ ic-ledger-types.workspace = true ic-management-canister-types.workspace = true ic-utils.workspace = true icp-canister-interfaces.workspace = true -icp = { workspace = true, features = ["clap"] } +icp-project = { workspace = true, features = ["clap"] } icp-app = { workspace = true, features = ["clap"] } icp-events.workspace = true icrc-ledger-types.workspace = true diff --git a/crates/icp-cli/src/call_output.rs b/crates/icp-cli/src/call_output.rs index d19a5277f..d054b78fa 100644 --- a/crates/icp-cli/src/call_output.rs +++ b/crates/icp-cli/src/call_output.rs @@ -11,12 +11,12 @@ use candid_parser::utils::CandidSource; use clap::ValueEnum; use dialoguer::console::Term; use ic_agent::Agent; -use icp::prelude::*; +use icp_project::prelude::*; use serde::Serialize; use std::io::{self, Write}; use tracing::error; -use icp::operations::misc::fetch_canister_metadata; +use icp_project::operations::misc::fetch_canister_metadata; /// How to interpret and display the call response blob. #[derive(Debug, Clone, Copy, Default, ValueEnum)] @@ -196,7 +196,7 @@ pub(crate) fn load_candid_from_file(path: &Path) -> Result Result<(), anyhow::E "a positional argument", )? { None => None, - Some(icp::CanisterArgs::Binary(bytes)) => Some(ResolvedArgs::Bytes(bytes)), - Some(icp::CanisterArgs::Text { + Some(icp_project::CanisterArgs::Binary(bytes)) => Some(ResolvedArgs::Bytes(bytes)), + Some(icp_project::CanisterArgs::Text { content, format: ArgsFormat::Candid, }) => Some(ResolvedArgs::Candid( parse_idl_args(&content).context("failed to parse Candid arguments")?, )), - Some(icp::CanisterArgs::Text { + Some(icp_project::CanisterArgs::Text { content, format: ArgsFormat::Hex, }) => Some(ResolvedArgs::Bytes( hex::decode(&content).context("failed to decode hex arguments")?, )), - Some(icp::CanisterArgs::Text { + Some(icp_project::CanisterArgs::Text { format: ArgsFormat::Bin, .. }) => { @@ -551,9 +551,9 @@ fn floor_to_minute(t: OffsetDateTime) -> OffsetDateTime { /// by principal rather than by name, simply yields nothing. async fn local_candid_type( ctx: &Context, - canister: &icp::host::CanisterSelection, + canister: &icp_project::host::CanisterSelection, ) -> Option { - let icp::host::CanisterSelection::Named(name) = canister else { + let icp_project::host::CanisterSelection::Named(name) = canister else { return None; }; let wasm = ctx.host.artifacts.lookup(name).await.ok()?; diff --git a/crates/icp-cli/src/commands/canister/create.rs b/crates/icp-cli/src/commands/canister/create.rs index 0d2d8a5d0..a2502fd1e 100644 --- a/crates/icp-cli/src/commands/canister/create.rs +++ b/crates/icp-cli/src/commands/canister/create.rs @@ -5,17 +5,17 @@ use bigdecimal::BigDecimal; use candid::{Nat, Principal}; use clap::{ArgGroup, Args, Parser}; use ic_management_canister_types::CanisterSettings as MgmtCanisterSettings; -use icp::canister::resolve_controllers; -use icp::host::EnvironmentSelection; -use icp::parsers::{CyclesAmount, DurationAmount, MemoryAmount, parse_token_amount}; -use icp::store_id::IdMapping; -use icp::{Canister, host::CanisterSelection, prelude::*}; use icp_app::context::{Context, NetworkSelection}; use icp_app::identity::IdentitySelection; +use icp_project::canister::resolve_controllers; +use icp_project::host::EnvironmentSelection; +use icp_project::parsers::{CyclesAmount, DurationAmount, MemoryAmount, parse_token_amount}; +use icp_project::store_id::IdMapping; +use icp_project::{Canister, host::CanisterSelection, prelude::*}; use serde::Serialize; use tracing::{info, warn}; -use icp::operations::create::{CreateFunding, CreateOperation, CreateTarget, shell_quote}; +use icp_project::operations::create::{CreateFunding, CreateOperation, CreateTarget, shell_quote}; use crate::commands::args; @@ -347,7 +347,7 @@ async fn create_project_canister(ctx: &Context, args: &CreateArgs) -> Result<(), if ctx .host .get_canister_id_for_env( - &icp::host::CanisterSelection::Named(canister.clone()), + &icp_project::host::CanisterSelection::Named(canister.clone()), &selections.environment, ) .await @@ -392,7 +392,7 @@ async fn create_project_canister(ctx: &Context, args: &CreateArgs) -> Result<(), .set_canister_id_for_env(&canister, id, &selections.environment) .await?; - icp::operations::settings::sync_controller_dependents( + icp_project::operations::settings::sync_controller_dependents( &ctx.host, &agent, args.proxy, diff --git a/crates/icp-cli/src/commands/canister/delete.rs b/crates/icp-cli/src/commands/canister/delete.rs index 076e5f5b6..9d32cca9b 100644 --- a/crates/icp-cli/src/commands/canister/delete.rs +++ b/crates/icp-cli/src/commands/canister/delete.rs @@ -2,10 +2,10 @@ use anyhow::anyhow; use candid::Principal; use clap::Args; use ic_management_canister_types::CanisterIdRecord; -use icp::host::CanisterSelection; use icp_app::context::Context; +use icp_project::host::CanisterSelection; -use icp::operations::{proxy_management, recover_cycles}; +use icp_project::operations::{proxy_management, recover_cycles}; use crate::commands::args; diff --git a/crates/icp-cli/src/commands/canister/install.rs b/crates/icp-cli/src/commands/canister/install.rs index d93a8ec32..ed917af29 100644 --- a/crates/icp-cli/src/commands/canister/install.rs +++ b/crates/icp-cli/src/commands/canister/install.rs @@ -5,13 +5,13 @@ use candid::Principal; use clap::{Args, ValueHint}; use dialoguer::Confirm; use ic_management_canister_types::CanisterInstallMode; -use icp::fs; -use icp::host::CanisterSelection; -use icp::prelude::*; use icp_app::context::Context; +use icp_project::fs; +use icp_project::host::CanisterSelection; +use icp_project::prelude::*; use tracing::{info, warn}; -use icp::operations::{ +use icp_project::operations::{ candid_compat::{CandidCompatibility, check_candid_compatibility}, install::{ WasmMemoryPersistenceOpt, install_canister, is_eop_canister, diff --git a/crates/icp-cli/src/commands/canister/link.rs b/crates/icp-cli/src/commands/canister/link.rs index f83143d91..bc273f228 100644 --- a/crates/icp-cli/src/commands/canister/link.rs +++ b/crates/icp-cli/src/commands/canister/link.rs @@ -2,8 +2,8 @@ use anyhow::bail; use candid::Principal; use clap::Args; use clap_complete::ArgValueCandidates; -use icp::host::EnvironmentSelection; use icp_app::context::Context; +use icp_project::host::EnvironmentSelection; use tracing::info; use crate::options::EnvironmentOpt; diff --git a/crates/icp-cli/src/commands/canister/logs.rs b/crates/icp-cli/src/commands/canister/logs.rs index ff8aaad31..f51c3986b 100644 --- a/crates/icp-cli/src/commands/canister/logs.rs +++ b/crates/icp-cli/src/commands/canister/logs.rs @@ -5,15 +5,15 @@ use candid::Principal; use clap::Args; use ic_agent::Agent; use ic_management_canister_types::{CanisterLogFilter, CanisterLogRecord, FetchCanisterLogsArgs}; -use icp::signal::stop_signal; use icp_app::context::Context; +use icp_project::signal::stop_signal; use itertools::Itertools; use serde::Serialize; use time::{OffsetDateTime, format_description::well_known::Rfc3339}; use tokio::select; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; /// Fetch and display canister logs #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/metadata.rs b/crates/icp-cli/src/commands/canister/metadata.rs index dcf2a2995..42226c15c 100644 --- a/crates/icp-cli/src/commands/canister/metadata.rs +++ b/crates/icp-cli/src/commands/canister/metadata.rs @@ -6,7 +6,7 @@ use icp_app::context::Context; use serde::Serialize; use crate::commands::args; -use icp::operations::misc::fetch_canister_metadata; +use icp_project::operations::misc::fetch_canister_metadata; /// Read a metadata section from a canister #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/migrate_id.rs b/crates/icp-cli/src/commands/canister/migrate_id.rs index 1050bfb9e..51bed3850 100644 --- a/crates/icp-cli/src/commands/canister/migrate_id.rs +++ b/crates/icp-cli/src/commands/canister/migrate_id.rs @@ -15,12 +15,12 @@ use num_traits::ToPrimitive; use tracing::{info, warn}; use crate::commands::args::{self, Canister}; -use icp::host::CanisterSelection; -use icp::operations::misc::format_timestamp; -use icp::operations::proxy_management; use icp_app::operations::canister_migration::{ get_subnet_for_canister, migrate_canister, migration_status, }; +use icp_project::host::CanisterSelection; +use icp_project::operations::misc::format_timestamp; +use icp_project::operations::proxy_management; /// Minimum cycles required for migration (10T). const MIN_CYCLES_FOR_MIGRATION: u128 = 10_000_000_000_000; diff --git a/crates/icp-cli/src/commands/canister/mod.rs b/crates/icp-cli/src/commands/canister/mod.rs index 4863143b4..76804b5fb 100644 --- a/crates/icp-cli/src/commands/canister/mod.rs +++ b/crates/icp-cli/src/commands/canister/mod.rs @@ -1,5 +1,5 @@ use clap::Subcommand; -use icp::canister::Visibility; +use icp_project::canister::Visibility; pub(crate) mod call; pub(crate) mod create; diff --git a/crates/icp-cli/src/commands/canister/settings/show.rs b/crates/icp-cli/src/commands/canister/settings/show.rs index 9e9a337cb..0d6e85773 100644 --- a/crates/icp-cli/src/commands/canister/settings/show.rs +++ b/crates/icp-cli/src/commands/canister/settings/show.rs @@ -4,7 +4,7 @@ use ic_management_canister_types::{CanisterIdRecord, DefiniteCanisterSettings}; use icp_app::context::Context; use std::fmt::Write; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; use crate::commands::{ args::CanisterCommandArgs, diff --git a/crates/icp-cli/src/commands/canister/settings/sync.rs b/crates/icp-cli/src/commands/canister/settings/sync.rs index 6a7e2ebca..392a41553 100644 --- a/crates/icp-cli/src/commands/canister/settings/sync.rs +++ b/crates/icp-cli/src/commands/canister/settings/sync.rs @@ -1,8 +1,8 @@ use anyhow::bail; use candid::Principal; use clap::Args; -use icp::host::CanisterSelection; use icp_app::context::Context; +use icp_project::host::CanisterSelection; use tracing::warn; use crate::commands::args::CanisterCommandArgs; @@ -50,7 +50,8 @@ pub(crate) async fn exec(ctx: &Context, args: &SyncArgs) -> Result<(), anyhow::E .map_err(|e| anyhow::anyhow!(e))?; let unresolved = - icp::operations::settings::sync_settings(&agent, args.proxy, &cid, &canister, &ids).await?; + icp_project::operations::settings::sync_settings(&agent, args.proxy, &cid, &canister, &ids) + .await?; for controller_name in &unresolved { warn!( "Controller canister '{controller_name}' for '{name}' has not been created yet; \ diff --git a/crates/icp-cli/src/commands/canister/settings/update.rs b/crates/icp-cli/src/commands/canister/settings/update.rs index fd54c57cd..d1c0d8713 100644 --- a/crates/icp-cli/src/commands/canister/settings/update.rs +++ b/crates/icp-cli/src/commands/canister/settings/update.rs @@ -8,16 +8,16 @@ use ic_management_canister_types::{ CanisterIdRecord, CanisterSettings, CanisterStatusResult, EnvironmentVariable, UpdateSettingsArgs, }; -use icp::ProjectLoadError; -use icp::canister::Visibility; -use icp::host::CanisterSelection; -use icp::parsers::{CyclesAmount, DurationAmount, MemoryAmount}; use icp_app::context::Context; +use icp_project::ProjectLoadError; +use icp_project::canister::Visibility; +use icp_project::host::CanisterSelection; +use icp_project::parsers::{CyclesAmount, DurationAmount, MemoryAmount}; use std::collections::{HashMap, HashSet}; use tracing::warn; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; #[derive(Clone, Debug, Default, Args)] pub(crate) struct ControllerOpt { @@ -732,7 +732,7 @@ fn get_environment_variables( } fn maybe_warn_on_env_vars_change( - configured_settings: &icp::canister::Settings, + configured_settings: &icp_project::canister::Settings, environment_variables_opt: &EnvironmentVariableOpt, ) { if let Some(configured_vars) = &configured_settings.environment_variables { diff --git a/crates/icp-cli/src/commands/canister/snapshot/create.rs b/crates/icp-cli/src/commands/canister/snapshot/create.rs index 87d473cb7..ec4c3e9c3 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/create.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/create.rs @@ -12,7 +12,7 @@ use serde::Serialize; use super::SnapshotId; use crate::commands::args; -use icp::operations::{misc::format_timestamp, proxy_management}; +use icp_project::operations::{misc::format_timestamp, proxy_management}; /// Create a snapshot of a canister's state #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/snapshot/delete.rs b/crates/icp-cli/src/commands/canister/snapshot/delete.rs index 8e355222b..da34a6e9b 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/delete.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/delete.rs @@ -6,7 +6,7 @@ use tracing::info; use super::SnapshotId; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; /// Delete a canister snapshot #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/snapshot/download.rs b/crates/icp-cli/src/commands/canister/snapshot/download.rs index 8cc449e93..9461740cc 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/download.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/download.rs @@ -1,21 +1,21 @@ use byte_unit::{Byte, UnitType}; use candid::Principal; use clap::{Args, ValueHint}; -use icp::prelude::*; use icp_app::context::Context; +use icp_project::prelude::*; use tracing::info; -use icp::operations::task::{Task, TransferBlob, TransferDirection}; +use icp_project::operations::task::{Task, TransferBlob, TransferDirection}; use super::SnapshotId; use crate::commands::args; use crate::render::rendered_task; -use icp::operations::misc::format_timestamp; use icp_app::operations::snapshot_transfer::{ BlobType, SnapshotPaths, SnapshotTransferError, delete_download_progress, download_blob_to_file, download_wasm_chunk, load_download_progress, load_metadata, read_snapshot_metadata, save_metadata, }; +use icp_project::operations::misc::format_timestamp; /// Download a snapshot to local disk #[derive(Debug, Args)] @@ -220,7 +220,7 @@ pub(crate) async fn exec(ctx: &Context, args: &DownloadArgs) -> Result<(), anyho } } else { // Create empty stable memory file - icp::fs::write(&paths.stable_memory_path(), &[])?; + icp_project::fs::write(&paths.stable_memory_path(), &[])?; } // Download WASM chunk store diff --git a/crates/icp-cli/src/commands/canister/snapshot/list.rs b/crates/icp-cli/src/commands/canister/snapshot/list.rs index 27c0350b5..9b5e1b781 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/list.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/list.rs @@ -9,7 +9,7 @@ use itertools::Itertools; use serde::Serialize; use crate::commands::args; -use icp::operations::{misc::format_timestamp, proxy_management}; +use icp_project::operations::{misc::format_timestamp, proxy_management}; /// List all snapshots for a canister #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/snapshot/restore.rs b/crates/icp-cli/src/commands/canister/snapshot/restore.rs index c0c523ff3..2282da795 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/restore.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/restore.rs @@ -9,7 +9,7 @@ use tracing::info; use super::SnapshotId; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; /// Restore a canister from a snapshot #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/snapshot/upload.rs b/crates/icp-cli/src/commands/canister/snapshot/upload.rs index 07943fa74..6f1bb7c63 100644 --- a/crates/icp-cli/src/commands/canister/snapshot/upload.rs +++ b/crates/icp-cli/src/commands/canister/snapshot/upload.rs @@ -3,22 +3,22 @@ use std::io::stdout; use byte_unit::{Byte, UnitType}; use candid::Principal; use clap::{Args, ValueHint}; -use icp::prelude::*; use icp_app::context::Context; +use icp_project::prelude::*; use serde::Serialize; use tracing::info; -use icp::operations::task::{Task, TransferBlob, TransferDirection}; +use icp_project::operations::task::{Task, TransferBlob, TransferDirection}; use super::SnapshotId; use crate::commands::args; use crate::render::rendered_task; -use icp::operations::misc::format_timestamp; use icp_app::operations::snapshot_transfer::{ BlobType, SnapshotPaths, SnapshotTransferError, UploadProgress, delete_upload_progress, load_metadata, load_upload_progress, save_upload_progress, upload_blob_from_file, upload_snapshot_metadata, upload_wasm_chunk, }; +use icp_project::operations::misc::format_timestamp; /// Upload a snapshot from local disk #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/start.rs b/crates/icp-cli/src/commands/canister/start.rs index 37dad36f7..35a04eaa8 100644 --- a/crates/icp-cli/src/commands/canister/start.rs +++ b/crates/icp-cli/src/commands/canister/start.rs @@ -4,7 +4,7 @@ use ic_management_canister_types::CanisterIdRecord; use icp_app::context::Context; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; /// Start a canister on a network #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/status.rs b/crates/icp-cli/src/commands/canister/status.rs index 01ecfa892..5a36328b7 100644 --- a/crates/icp-cli/src/commands/canister/status.rs +++ b/crates/icp-cli/src/commands/canister/status.rs @@ -3,19 +3,19 @@ use clap::Args; use clap_complete::ArgValueCandidates; use ic_agent::{Agent, AgentError, agent::RejectResponse, export::Principal}; use ic_management_canister_types::{CanisterIdRecord, CanisterStatusResult, EnvironmentVariable}; -use icp::{ - canister::Visibility, - host::{CanisterSelection, EnvironmentSelection}, -}; use icp_app::{ context::{Context, NetworkSelection}, identity::IdentitySelection, }; +use icp_project::{ + canister::Visibility, + host::{CanisterSelection, EnvironmentSelection}, +}; use serde::Serialize; use std::fmt::Write; use tracing::debug; -use icp::operations::{proxy::UpdateOrProxyError, proxy_management}; +use icp_project::operations::{proxy::UpdateOrProxyError, proxy_management}; use crate::{ commands::{ diff --git a/crates/icp-cli/src/commands/canister/stop.rs b/crates/icp-cli/src/commands/canister/stop.rs index 39388b183..2eb3f156c 100644 --- a/crates/icp-cli/src/commands/canister/stop.rs +++ b/crates/icp-cli/src/commands/canister/stop.rs @@ -4,7 +4,7 @@ use ic_management_canister_types::CanisterIdRecord; use icp_app::context::Context; use crate::commands::args; -use icp::operations::proxy_management; +use icp_project::operations::proxy_management; /// Stop a canister on a network #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/canister/top_up.rs b/crates/icp-cli/src/commands/canister/top_up.rs index 537e6cdf5..b6881097a 100644 --- a/crates/icp-cli/src/commands/canister/top_up.rs +++ b/crates/icp-cli/src/commands/canister/top_up.rs @@ -2,11 +2,11 @@ use anyhow::{Context as _, bail}; use bigdecimal::BigDecimal; use candid::{Decode, Encode, Nat}; use clap::Args; -use icp::parsers::CyclesAmount; use icp_app::context::Context; use icp_canister_interfaces::cycles_ledger::{ CYCLES_LEDGER_PRINCIPAL, WithdrawArgs, WithdrawResponse, }; +use icp_project::parsers::CyclesAmount; use tracing::info; use crate::commands::args; diff --git a/crates/icp-cli/src/commands/completions.rs b/crates/icp-cli/src/commands/completions.rs index 5908f7628..66acb69ff 100644 --- a/crates/icp-cli/src/commands/completions.rs +++ b/crates/icp-cli/src/commands/completions.rs @@ -2,7 +2,7 @@ use std::io::{self, Write as _}; use clap::Args; use clap_complete::Shell; -use icp::prelude::*; +use icp_project::prelude::*; use indoc::formatdoc; use snafu::prelude::*; diff --git a/crates/icp-cli/src/commands/cycles/mint.rs b/crates/icp-cli/src/commands/cycles/mint.rs index 2b0993863..3eef91fbf 100644 --- a/crates/icp-cli/src/commands/cycles/mint.rs +++ b/crates/icp-cli/src/commands/cycles/mint.rs @@ -3,8 +3,8 @@ use std::io::stdout; use anyhow::bail; use bigdecimal::BigDecimal; use clap::Args; -use icp::parsers::{CyclesAmount, parse_token_amount}; use icp_app::context::Context; +use icp_project::parsers::{CyclesAmount, parse_token_amount}; use serde::Serialize; use crate::commands::args::TokenCommandArgs; diff --git a/crates/icp-cli/src/commands/cycles/transfer.rs b/crates/icp-cli/src/commands/cycles/transfer.rs index e8091ebba..1a343d22c 100644 --- a/crates/icp-cli/src/commands/cycles/transfer.rs +++ b/crates/icp-cli/src/commands/cycles/transfer.rs @@ -2,9 +2,9 @@ use std::io::stdout; use anyhow::ensure; use clap::Args; -use icp::parsers::CyclesAmount; use icp_app::context::Context; use icp_canister_interfaces::cycles_ledger::{CYCLES_LEDGER_BLOCK_FEE, CYCLES_LEDGER_PRINCIPAL}; +use icp_project::parsers::CyclesAmount; use icrc_ledger_types::icrc1::account::Account; use serde::Serialize; diff --git a/crates/icp-cli/src/commands/deploy.rs b/crates/icp-cli/src/commands/deploy.rs index 16c027c63..4afbceab9 100644 --- a/crates/icp-cli/src/commands/deploy.rs +++ b/crates/icp-cli/src/commands/deploy.rs @@ -3,15 +3,15 @@ use candid::Principal; use clap::Args; use clap_complete::ArgValueCandidates; use ic_agent::{Agent, AgentError}; -use icp::operations::deploy::{DeployParams, DeployReport, deploy, resolve_targets}; -use icp::parsers::CyclesAmount; -use icp::{ +use icp_app::{context::Context, identity::IdentitySelection}; +use icp_canister_interfaces::candid_ui::MAINNET_CANDID_UI_CID; +use icp_project::operations::deploy::{DeployParams, DeployReport, deploy, resolve_targets}; +use icp_project::parsers::CyclesAmount; +use icp_project::{ agent::LazyAgent, host::{CanisterSelection, EnvironmentSelection}, network::Configuration as NetworkConfiguration, }; -use icp_app::{context::Context, identity::IdentitySelection}; -use icp_canister_interfaces::candid_ui::MAINNET_CANDID_UI_CID; use serde::Serialize; use tracing::info; diff --git a/crates/icp-cli/src/commands/identity/delegation/request.rs b/crates/icp-cli/src/commands/identity/delegation/request.rs index 97743feaf..941355b4a 100644 --- a/crates/icp-cli/src/commands/identity/delegation/request.rs +++ b/crates/icp-cli/src/commands/identity/delegation/request.rs @@ -1,8 +1,8 @@ use clap::{Args, ValueHint}; use dialoguer::Password; use elliptic_curve::zeroize::Zeroizing; -use icp::{fs::read_to_string, prelude::*}; use icp_app::{context::Context, identity::key}; +use icp_project::{fs::read_to_string, prelude::*}; use pem::Pem; use snafu::{ResultExt, Snafu}; use tracing::warn; @@ -73,13 +73,15 @@ pub(crate) async fn exec(ctx: &Context, args: &RequestArgs) -> Result<(), Reques #[derive(Debug, Snafu)] pub(crate) enum RequestError { #[snafu(display("failed to read storage password file"))] - ReadStoragePasswordFile { source: icp::fs::IoError }, + ReadStoragePasswordFile { source: icp_project::fs::IoError }, #[snafu(display("failed to read storage password from terminal"))] StoragePasswordTermRead { source: dialoguer::Error }, #[snafu(transparent)] - LockIdentityDir { source: icp::fs::lock::LockError }, + LockIdentityDir { + source: icp_project::fs::lock::LockError, + }, #[snafu(display("failed to create pending delegation identity"))] Create { diff --git a/crates/icp-cli/src/commands/identity/delegation/sign.rs b/crates/icp-cli/src/commands/identity/delegation/sign.rs index 5833e1e7e..063a32f65 100644 --- a/crates/icp-cli/src/commands/identity/delegation/sign.rs +++ b/crates/icp-cli/src/commands/identity/delegation/sign.rs @@ -5,13 +5,13 @@ use std::{ use clap::{Args, ValueHint}; use ic_agent::{Identity as _, export::Principal, identity::Delegation as AgentDelegation}; -use icp::{fs::read_to_string, prelude::*}; use icp_app::{ context::{Context, GetIdentityError}, identity::delegation::{ Delegation as WireDelegation, DelegationChain, SignedDelegation as WireSignedDelegation, }, }; +use icp_project::{fs::read_to_string, prelude::*}; use pem::Pem; use snafu::{OptionExt, ResultExt, Snafu}; @@ -173,7 +173,7 @@ pub(crate) enum SignError { AnonymousIdentity, #[snafu(display("failed to read key PEM file"))] - ReadKeyPem { source: icp::fs::IoError }, + ReadKeyPem { source: icp_project::fs::IoError }, #[snafu(display("corrupted PEM file `{path}`"))] ParseKeyPem { diff --git a/crates/icp-cli/src/commands/identity/delegation/use.rs b/crates/icp-cli/src/commands/identity/delegation/use.rs index a8feaa633..bd1a01cdd 100644 --- a/crates/icp-cli/src/commands/identity/delegation/use.rs +++ b/crates/icp-cli/src/commands/identity/delegation/use.rs @@ -1,6 +1,5 @@ use clap::{Args, ValueHint}; use clap_complete::ArgValueCandidates; -use icp::{fs::json, prelude::*}; use icp_app::{ context::Context, identity::{ @@ -9,6 +8,7 @@ use icp_app::{ manifest::{DelegationKeyStorage, PemFormat}, }, }; +use icp_project::{fs::json, prelude::*}; use snafu::{ResultExt, Snafu}; use tracing::{info, warn}; @@ -59,7 +59,9 @@ pub(crate) enum UseError { LoadDelegationChain { source: json::Error }, #[snafu(transparent)] - LockIdentityDir { source: icp::fs::lock::LockError }, + LockIdentityDir { + source: icp_project::fs::lock::LockError, + }, #[snafu(display("failed to complete delegation identity"))] Complete { diff --git a/crates/icp-cli/src/commands/identity/export.rs b/crates/icp-cli/src/commands/identity/export.rs index 073d20469..e9ea28b12 100644 --- a/crates/icp-cli/src/commands/identity/export.rs +++ b/crates/icp-cli/src/commands/identity/export.rs @@ -3,10 +3,10 @@ use clap::{Args, ValueHint}; use clap_complete::ArgValueCandidates; use dialoguer::Password; use elliptic_curve::zeroize::Zeroizing; -use icp::fs::read_to_string; -use icp::prelude::*; use icp_app::context::Context; use icp_app::identity::key::{ExportFormat, export_identity}; +use icp_project::fs::read_to_string; +use icp_project::prelude::*; /// Print the PEM file for the identity #[derive(Debug, Args)] diff --git a/crates/icp-cli/src/commands/identity/import.rs b/crates/icp-cli/src/commands/identity/import.rs index 14cbda4af..0c34bac26 100644 --- a/crates/icp-cli/src/commands/identity/import.rs +++ b/crates/icp-cli/src/commands/identity/import.rs @@ -2,16 +2,16 @@ use bip39::{Language, Mnemonic}; use clap::{ArgGroup, Args, ValueHint}; use dialoguer::Password; use elliptic_curve::zeroize::Zeroizing; -use icp::{ - fs::{json, read_to_string}, - prelude::*, -}; use icp_app::identity::{ delegation::DelegationChain, key::{CreateFormat, CreateIdentityError, IdentityKey, create_identity}, manifest::IdentityKeyAlgorithm, seed::derive_key_from_seed_slip10, }; +use icp_project::{ + fs::{json, read_to_string}, + prelude::*, +}; use itertools::Itertools; use k256::Secp256k1; use p256::NistP256; @@ -438,7 +438,7 @@ pub(crate) enum LoadKeyError { BadEdAssertion { path: PathBuf }, #[snafu(display("failed to read file"))] - ReadFileError { source: icp::fs::IoError }, + ReadFileError { source: icp_project::fs::IoError }, #[snafu(display("expected 1 key block in PEM file `{path}`, found {count}"))] TooManyKeyBlocks { path: PathBuf, count: usize }, @@ -480,7 +480,7 @@ pub(crate) enum LoadKeyError { StoragePasswordTermReadError { source: dialoguer::Error }, #[snafu(display("failed to read storage password file"))] - ReadStoragePasswordFileError { source: icp::fs::IoError }, + ReadStoragePasswordFileError { source: icp_project::fs::IoError }, #[snafu(display("PEM file `{path}` uses unsupported algorithm {found}, expected {}", expected.iter().format(", ")))] UnsupportedAlgorithm { @@ -496,13 +496,15 @@ pub(crate) enum LoadKeyError { CreateIdentityError { source: CreateIdentityError }, #[snafu(transparent)] - LockIdentityDirError { source: icp::fs::lock::LockError }, + LockIdentityDirError { + source: icp_project::fs::lock::LockError, + }, } #[derive(Debug, Snafu)] pub(crate) enum DeriveKeyError { #[snafu(display("failed to read seed file"))] - ReadSeedFile { source: icp::fs::IoError }, + ReadSeedFile { source: icp_project::fs::IoError }, #[snafu(display("failed to read seed phrase from terminal"))] ReadSeedPhraseFromTerminal { source: dialoguer::Error }, @@ -514,5 +516,7 @@ pub(crate) enum DeriveKeyError { CreateIdentity { source: CreateIdentityError }, #[snafu(transparent)] - LockIdentityDirError { source: icp::fs::lock::LockError }, + LockIdentityDirError { + source: icp_project::fs::lock::LockError, + }, } diff --git a/crates/icp-cli/src/commands/identity/link/hsm.rs b/crates/icp-cli/src/commands/identity/link/hsm.rs index 5ec41b02d..435601b4b 100644 --- a/crates/icp-cli/src/commands/identity/link/hsm.rs +++ b/crates/icp-cli/src/commands/identity/link/hsm.rs @@ -1,10 +1,10 @@ use clap::{Args, ValueHint}; use dialoguer::Password; -use icp::prelude::*; use icp_app::{ context::Context, identity::{key::link_hsm_identity, manifest::IdentityList}, }; +use icp_project::prelude::*; use snafu::{ResultExt, Snafu, ensure}; use tracing::info; @@ -48,7 +48,7 @@ pub(crate) async fn exec(ctx: &Context, args: &HsmArgs) -> Result<(), HsmError> Some(path) => { let path = path.clone(); Box::new(move || { - icp::fs::read_to_string(&path) + icp_project::fs::read_to_string(&path) .map(|s| s.trim().to_string()) .map_err(|e| e.to_string()) }) @@ -92,7 +92,9 @@ pub(crate) enum HsmError { }, #[snafu(transparent)] - LockIdentityDir { source: icp::fs::lock::LockError }, + LockIdentityDir { + source: icp_project::fs::lock::LockError, + }, #[snafu(display("failed to link HSM identity"))] LinkHsm { diff --git a/crates/icp-cli/src/commands/identity/link/web.rs b/crates/icp-cli/src/commands/identity/link/web.rs index 9fd8b14da..46ac4a03f 100644 --- a/crates/icp-cli/src/commands/identity/link/web.rs +++ b/crates/icp-cli/src/commands/identity/link/web.rs @@ -13,7 +13,6 @@ use clap::{Args, ValueHint}; use dialoguer::Password; use elliptic_curve::zeroize::Zeroizing; use ic_agent::{Identity as _, export::Principal, identity::BasicIdentity}; -use icp::{fs::read_to_string, prelude::*}; use icp_app::{ context::Context, identity::{ @@ -22,6 +21,7 @@ use icp_app::{ manifest::IdentityList, }, }; +use icp_project::{fs::read_to_string, prelude::*}; use indicatif::{ProgressBar, ProgressStyle}; use rand::RngExt as _; use serde::Deserialize; @@ -168,7 +168,7 @@ pub(crate) enum WebAuthError { #[snafu(display("failed to read storage password file"))] ReadStoragePasswordFile { - source: icp::fs::IoError, + source: icp_project::fs::IoError, }, #[snafu(display("failed to read storage password from terminal"))] @@ -188,7 +188,7 @@ pub(crate) enum WebAuthError { #[snafu(transparent)] LockIdentityDir { - source: icp::fs::lock::LockError, + source: icp_project::fs::lock::LockError, }, #[snafu(display("failed to link web-auth identity"))] diff --git a/crates/icp-cli/src/commands/identity/new.rs b/crates/icp-cli/src/commands/identity/new.rs index 9c61e19ff..b18c7c3f8 100644 --- a/crates/icp-cli/src/commands/identity/new.rs +++ b/crates/icp-cli/src/commands/identity/new.rs @@ -5,12 +5,12 @@ use bip39::{Language, Mnemonic, MnemonicType}; use clap::{Args, ValueHint}; use dialoguer::Password; use elliptic_curve::zeroize::Zeroizing; -use icp::{fs::write_string, prelude::*}; use icp_app::identity::{ key::{CreateFormat, create_identity, validate_password}, manifest::{IdentityKeyAlgorithm, IdentityList}, seed::derive_key_from_seed_slip10, }; +use icp_project::{fs::write_string, prelude::*}; use icp_app::context::Context; use serde::Serialize; @@ -68,7 +68,7 @@ pub(crate) async fn exec(ctx: &Context, args: &NewArgs) -> Result<(), anyhow::Er StorageMode::Keyring => CreateFormat::Keyring, StorageMode::Password => { let password = if let Some(path) = &args.storage_password_file { - icp::fs::read_to_string(path) + icp_project::fs::read_to_string(path) .context("failed to read storage password file")? .trim() .to_string() diff --git a/crates/icp-cli/src/commands/identity/reauth.rs b/crates/icp-cli/src/commands/identity/reauth.rs index da1754187..cfc5b9495 100644 --- a/crates/icp-cli/src/commands/identity/reauth.rs +++ b/crates/icp-cli/src/commands/identity/reauth.rs @@ -136,7 +136,9 @@ pub(crate) async fn exec(ctx: &Context, args: &ReauthArgs) -> Result<(), LoginEr #[derive(Debug, Snafu)] pub(crate) enum LoginError { #[snafu(transparent)] - LockIdentityDir { source: icp::fs::lock::LockError }, + LockIdentityDir { + source: icp_project::fs::lock::LockError, + }, #[snafu(transparent)] LoadManifest { diff --git a/crates/icp-cli/src/commands/message/send.rs b/crates/icp-cli/src/commands/message/send.rs index 0e48aa191..83fdabda8 100644 --- a/crates/icp-cli/src/commands/message/send.rs +++ b/crates/icp-cli/src/commands/message/send.rs @@ -2,15 +2,15 @@ use anyhow::{Context as _, bail}; use candid::{IDLArgs, TypeEnv, types::Function}; use clap::{Args, ValueHint}; use ic_agent::agent::CallResponse; -use icp::network::RootKeySpec; -use icp::prelude::IC_ROOT_KEY; -use icp::prelude::*; use icp_app::context::Context; use icp_app::identity::IdentitySelection; use icp_app::signed_message::{ CallType, Destination, SUBMISSION_WINDOW, SignedMessage, Validated, WindowState, format_timestamp, }; +use icp_project::network::RootKeySpec; +use icp_project::prelude::IC_ROOT_KEY; +use icp_project::prelude::*; use std::io::{self, IsTerminal, Read}; use time::{Duration, OffsetDateTime}; use tracing::warn; @@ -19,7 +19,7 @@ use url::Url; use crate::call_output::{ CallOutputMode, CanisterInterface, get_candid_type, load_candid_from_file, print_response, }; -use icp::operations::create::shell_quote; +use icp_project::operations::create::shell_quote; /// Submit a message signed on another machine /// diff --git a/crates/icp-cli/src/commands/network/args.rs b/crates/icp-cli/src/commands/network/args.rs index 44a8a7d10..de2a50f90 100644 --- a/crates/icp-cli/src/commands/network/args.rs +++ b/crates/icp-cli/src/commands/network/args.rs @@ -1,7 +1,7 @@ use clap::Args; use clap_complete::ArgValueCandidates; -use icp::prelude::LOCAL; use icp_app::context::NetworkOrEnvironmentSelection; +use icp_project::prelude::LOCAL; #[derive(Args, Clone, Debug)] pub(crate) struct NetworkOrEnvironmentArgs { diff --git a/crates/icp-cli/src/commands/network/start.rs b/crates/icp-cli/src/commands/network/start.rs index dbe880a23..334e2ae93 100644 --- a/crates/icp-cli/src/commands/network/start.rs +++ b/crates/icp-cli/src/commands/network/start.rs @@ -3,9 +3,6 @@ use std::sync::{Arc, OnceLock}; use anyhow::{Context as _, bail}; use candid::Principal; use clap::Args; -use icp::network::Configuration; -use icp::network::ManagedMode; -use icp::prelude::*; use icp_app::{ identity::manifest::IdentityList, network::{ @@ -20,6 +17,9 @@ use icp_app::{ }, settings::Settings, }; +use icp_project::network::Configuration; +use icp_project::network::ManagedMode; +use icp_project::prelude::*; use tracing::{debug, info, warn}; use crate::render::{ProgressManager, ProgressManagerSettings}; diff --git a/crates/icp-cli/src/commands/network/status.rs b/crates/icp-cli/src/commands/network/status.rs index 8944ed32a..ef430702c 100644 --- a/crates/icp-cli/src/commands/network/status.rs +++ b/crates/icp-cli/src/commands/network/status.rs @@ -1,7 +1,7 @@ use anyhow::Context as _; use clap::Args; -use icp::network::{Configuration, RootKeySource}; use icp_app::context::Context; +use icp_project::network::{Configuration, RootKeySource}; use serde::Serialize; use super::args::NetworkOrEnvironmentArgs; diff --git a/crates/icp-cli/src/commands/network/stop.rs b/crates/icp-cli/src/commands/network/stop.rs index 4613dd199..f212c7636 100644 --- a/crates/icp-cli/src/commands/network/stop.rs +++ b/crates/icp-cli/src/commands/network/stop.rs @@ -1,7 +1,7 @@ use anyhow::bail; use clap::Args; -use icp::{fs::remove_file, network::Configuration}; use icp_app::network::{config::ChildLocator, managed::run::stop_network}; +use icp_project::{fs::remove_file, network::Configuration}; use tracing::info; use super::args::NetworkOrEnvironmentArgs; diff --git a/crates/icp-cli/src/commands/new.rs b/crates/icp-cli/src/commands/new.rs index 550d652da..4b63cd478 100644 --- a/crates/icp-cli/src/commands/new.rs +++ b/crates/icp-cli/src/commands/new.rs @@ -1,5 +1,5 @@ #[allow(clippy::disallowed_types)] -// In this case we allow PathBuf instead of using icp::prelude::* because +// In this case we allow PathBuf instead of using icp_project::prelude::* because // this is what the crargo generate crate expects use std::path::PathBuf; diff --git a/crates/icp-cli/src/commands/project/bundle.rs b/crates/icp-cli/src/commands/project/bundle.rs index 774e11772..fd87932dd 100644 --- a/crates/icp-cli/src/commands/project/bundle.rs +++ b/crates/icp-cli/src/commands/project/bundle.rs @@ -2,12 +2,12 @@ use std::collections::HashSet; use anyhow::Context as _; use clap::{Args, ValueHint}; -use icp::host::EnvironmentSelection; -use icp::prelude::*; use icp_app::context::Context; +use icp_project::host::EnvironmentSelection; +use icp_project::prelude::*; use tracing::warn; -use icp::operations::bundle::create_bundle; +use icp_project::operations::bundle::create_bundle; use crate::render::rendered; diff --git a/crates/icp-cli/src/commands/sync.rs b/crates/icp-cli/src/commands/sync.rs index 813ced9bb..a0f694d10 100644 --- a/crates/icp-cli/src/commands/sync.rs +++ b/crates/icp-cli/src/commands/sync.rs @@ -4,13 +4,13 @@ use clap::Args; use clap_complete::ArgValueCandidates; use futures::future::try_join_all; use ic_management_canister_types::{CanisterId, CanisterIdRecord, CanisterStatusType}; -use icp::host::{CanisterSelection, EnvironmentSelection}; use icp_app::context::Context; use icp_app::identity::IdentitySelection; +use icp_project::host::{CanisterSelection, EnvironmentSelection}; use std::collections::BTreeMap; use tracing::info; -use icp::operations::{proxy_management, sync::sync_many}; +use icp_project::operations::{proxy_management, sync::sync_many}; use crate::{ options::{EnvironmentOpt, IdentityOpt}, diff --git a/crates/icp-cli/src/commands/token/approve.rs b/crates/icp-cli/src/commands/token/approve.rs index 6fa50a545..f4157bcaf 100644 --- a/crates/icp-cli/src/commands/token/approve.rs +++ b/crates/icp-cli/src/commands/token/approve.rs @@ -4,8 +4,8 @@ use anyhow::Context as _; use bigdecimal::BigDecimal; use candid::Principal; use clap::Args; -use icp::parsers::{DurationAmount, parse_token_amount}; use icp_app::context::Context; +use icp_project::parsers::{DurationAmount, parse_token_amount}; use icrc_ledger_types::icrc1::account::Account; use serde::Serialize; use time::OffsetDateTime; diff --git a/crates/icp-cli/src/commands/token/transfer.rs b/crates/icp-cli/src/commands/token/transfer.rs index 8bfbf34fb..5e446ba1d 100644 --- a/crates/icp-cli/src/commands/token/transfer.rs +++ b/crates/icp-cli/src/commands/token/transfer.rs @@ -2,8 +2,8 @@ use std::io::stdout; use bigdecimal::BigDecimal; use clap::Args; -use icp::parsers::parse_token_amount; use icp_app::context::Context; +use icp_project::parsers::parse_token_amount; use serde::Serialize; use crate::commands::args::{FlexibleAccountId, TokenCommandArgs}; diff --git a/crates/icp-cli/src/complete.rs b/crates/icp-cli/src/complete.rs index 0c4184d67..b96726eac 100644 --- a/crates/icp-cli/src/complete.rs +++ b/crates/icp-cli/src/complete.rs @@ -14,11 +14,11 @@ use std::time::Duration; use clap::CommandFactory as _; use clap_complete::CompleteEnv; use clap_complete::engine::CompletionCandidate; -use icp::network::Configuration; -use icp::prelude::*; -use icp::{Environment, Network, Project}; use icp_app::context::Context; use icp_app::identity::manifest::IdentityList; +use icp_project::network::Configuration; +use icp_project::prelude::*; +use icp_project::{Environment, Network, Project}; /// Answer a completion request and exit, if this invocation is one. /// diff --git a/crates/icp-cli/src/dist.rs b/crates/icp-cli/src/dist.rs index f7911d75b..358bcef49 100644 --- a/crates/icp-cli/src/dist.rs +++ b/crates/icp-cli/src/dist.rs @@ -203,7 +203,7 @@ pub(crate) async fn update_check(ctx: &icp_app::context::Context) -> Option() { let then = SystemTime::UNIX_EPOCH + Duration::from_secs(ts); @@ -218,8 +218,8 @@ pub(crate) async fn update_check(ctx: &icp_app::context::Context) -> Option Result<(), Error> { let password_func: icp_app::identity::PasswordFunc = match cli.identity_password_file { Some(path) => Arc::new(move || { - icp::fs::read_to_string(&path) + icp_project::fs::read_to_string(&path) .map(|s| s.trim().to_string()) .map_err(|e| e.to_string()) }), diff --git a/crates/icp-cli/src/options.rs b/crates/icp-cli/src/options.rs index 4feecdbcc..7a3bd4446 100644 --- a/crates/icp-cli/src/options.rs +++ b/crates/icp-cli/src/options.rs @@ -1,11 +1,11 @@ use clap::error::ErrorKind; use clap::{ArgGroup, ArgMatches, Args, FromArgMatches}; use clap_complete::ArgValueCandidates; -use icp::host::EnvironmentSelection; -use icp::network::RootKeySpec; -use icp::prelude::LOCAL; use icp_app::context::NetworkSelection; use icp_app::identity::IdentitySelection; +use icp_project::host::EnvironmentSelection; +use icp_project::network::RootKeySpec; +use icp_project::prelude::LOCAL; use url::Url; mod heading { diff --git a/crates/icp-cli/src/render/interactive.rs b/crates/icp-cli/src/render/interactive.rs index 3cef7ffbb..aeae00b01 100644 --- a/crates/icp-cli/src/render/interactive.rs +++ b/crates/icp-cli/src/render/interactive.rs @@ -14,7 +14,7 @@ use tracing::{debug, info}; use super::style::{ COLOR_FAILURE, COLOR_REGULAR, COLOR_SUCCESS, TICK_EMPTY, TICK_FAILURE, TICK_SUCCESS, make_style, }; -use icp::operations::task::{Event, Widget}; +use icp_project::operations::task::{Event, Widget}; use super::{INDENT, RollingLines, TaskLog, dump_failures}; diff --git a/crates/icp-cli/src/render/mod.rs b/crates/icp-cli/src/render/mod.rs index 34eadc24e..ef6da874c 100644 --- a/crates/icp-cli/src/render/mod.rs +++ b/crates/icp-cli/src/render/mod.rs @@ -7,7 +7,7 @@ //! operation. //! //! `icp_events` is generic over the task payload and knows nothing about what -//! is being run; the vocabulary comes from [`icp::operations::task`], where +//! is being run; the vocabulary comes from [`icp_project::operations::task`], where //! each kind of work describes itself. What lives here is only how those //! descriptions are drawn on a terminal. //! @@ -17,8 +17,8 @@ use std::collections::{BTreeMap, VecDeque}; -use icp::operations::task::{Failure, Presentation, Task}; use icp_events::{TaskId, TaskOutcome}; +use icp_project::operations::task::{Failure, Presentation, Task}; use tokio::sync::mpsc::UnboundedReceiver; use tracing::error; @@ -31,7 +31,7 @@ pub(crate) use interactive::InteractiveRenderer; pub(crate) use plain::PlainRenderer; pub(crate) use spinner::{ProgressManager, ProgressManagerSettings}; -use icp::operations::task::{Event, Reporter, TaskReporter}; +use icp_project::operations::task::{Event, Reporter, TaskReporter}; /// The maximum number of lines to display for a step output const MAX_LINES_PER_STEP: usize = 10_000; diff --git a/crates/icp-cli/src/render/plain.rs b/crates/icp-cli/src/render/plain.rs index 6e3a916db..d0ead035a 100644 --- a/crates/icp-cli/src/render/plain.rs +++ b/crates/icp-cli/src/render/plain.rs @@ -7,7 +7,7 @@ use std::collections::BTreeMap; use icp_events::{EventKind, TaskId, TaskOutcome}; use tracing::{debug, info}; -use icp::operations::task::{Event, Widget}; +use icp_project::operations::task::{Event, Widget}; use super::{INDENT, TaskLog, dump_failures}; diff --git a/crates/icp-cli/src/telemetry.rs b/crates/icp-cli/src/telemetry.rs index 6a36bb3e0..9eda42043 100644 --- a/crates/icp-cli/src/telemetry.rs +++ b/crates/icp-cli/src/telemetry.rs @@ -10,9 +10,9 @@ use std::{ }; use clap::parser::ValueSource; -use icp::prelude::*; use icp_app::settings::Settings; use icp_app::telemetry_data::{IdentityStorageType, NetworkType, TelemetryData}; +use icp_project::prelude::*; use rand::RngExt as _; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; diff --git a/crates/icp-cli/tests/build_adapter_tests.rs b/crates/icp-cli/tests/build_adapter_tests.rs index 985b43dc4..b23145d0a 100644 --- a/crates/icp-cli/tests/build_adapter_tests.rs +++ b/crates/icp-cli/tests/build_adapter_tests.rs @@ -3,7 +3,7 @@ use k256::sha2::{Digest, Sha256}; use predicates::{prelude::PredicateBooleanExt, str::contains}; use crate::common::{TestContext, spawn_test_server}; -use icp::fs::{read, write_string}; +use icp_project::fs::{read, write_string}; mod common; diff --git a/crates/icp-cli/tests/build_tests.rs b/crates/icp-cli/tests/build_tests.rs index 2e5554d0e..59518b625 100644 --- a/crates/icp-cli/tests/build_tests.rs +++ b/crates/icp-cli/tests/build_tests.rs @@ -5,7 +5,7 @@ use indoc::{formatdoc, indoc}; use predicates::{prelude::PredicateBooleanExt, str::contains}; use crate::common::TestContext; -use icp::fs::{read_to_string, write_string}; +use icp_project::fs::{read_to_string, write_string}; mod common; diff --git a/crates/icp-cli/tests/bundle_tests.rs b/crates/icp-cli/tests/bundle_tests.rs index 49cd73889..669c38556 100644 --- a/crates/icp-cli/tests/bundle_tests.rs +++ b/crates/icp-cli/tests/bundle_tests.rs @@ -5,7 +5,7 @@ use std::{ use camino::Utf8Component; use flate2::bufread::GzDecoder; -use icp::{ +use icp_project::{ fs::{create_dir_all, read_to_string, write, write_string}, prelude::*, }; diff --git a/crates/icp-cli/tests/canister_call_root_key_tests.rs b/crates/icp-cli/tests/canister_call_root_key_tests.rs index 8005fa252..9a26dc70b 100644 --- a/crates/icp-cli/tests/canister_call_root_key_tests.rs +++ b/crates/icp-cli/tests/canister_call_root_key_tests.rs @@ -3,7 +3,7 @@ use predicates::ord::eq; use predicates::str::{PredicateStrExt, contains}; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext}; -use icp::fs::write_string; +use icp_project::fs::write_string; mod common; diff --git a/crates/icp-cli/tests/canister_call_sign_tests.rs b/crates/icp-cli/tests/canister_call_sign_tests.rs index 505ceb508..5a45a4615 100644 --- a/crates/icp-cli/tests/canister_call_sign_tests.rs +++ b/crates/icp-cli/tests/canister_call_sign_tests.rs @@ -11,8 +11,8 @@ use predicates::str::contains; use serde_json::Value; use crate::common::TestContext; -use icp::fs::write_string; -use icp::prelude::*; +use icp_project::fs::write_string; +use icp_project::prelude::*; mod common; @@ -35,7 +35,7 @@ fn envelope_expiry(encoded: &str) -> u64 { } fn read_message(path: &Path) -> Value { - let text = icp::fs::read_to_string(path).expect("the message file must exist"); + let text = icp_project::fs::read_to_string(path).expect("the message file must exist"); serde_json::from_str(&text).expect("a signed message must be JSON a human can read") } diff --git a/crates/icp-cli/tests/canister_call_tests.rs b/crates/icp-cli/tests/canister_call_tests.rs index a72eea5c6..654b87113 100644 --- a/crates/icp-cli/tests/canister_call_tests.rs +++ b/crates/icp-cli/tests/canister_call_tests.rs @@ -4,7 +4,7 @@ use predicates::prelude::PredicateBooleanExt; use predicates::str::{PredicateStrExt, contains}; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext}; -use icp::fs::write_string; +use icp_project::fs::write_string; mod common; diff --git a/crates/icp-cli/tests/canister_create_tests.rs b/crates/icp-cli/tests/canister_create_tests.rs index 00b99f409..47976d4f4 100644 --- a/crates/icp-cli/tests/canister_create_tests.rs +++ b/crates/icp-cli/tests/canister_create_tests.rs @@ -10,7 +10,7 @@ use crate::common::{ ENVIRONMENT_DOCKER_ENGINE, ENVIRONMENT_RANDOM_PORT, NETWORK_DOCKER_ENGINE, NETWORK_RANDOM_PORT, TestContext, clients, }; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_delete_tests.rs b/crates/icp-cli/tests/canister_delete_tests.rs index 23f5f2c7d..9e8cd9a1a 100644 --- a/crates/icp-cli/tests/canister_delete_tests.rs +++ b/crates/icp-cli/tests/canister_delete_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_info_tests.rs b/crates/icp-cli/tests/canister_info_tests.rs index 243224867..97609311d 100644 --- a/crates/icp-cli/tests/canister_info_tests.rs +++ b/crates/icp-cli/tests/canister_info_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::{prelude::PredicateBooleanExt, str::contains}; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_install_tests.rs b/crates/icp-cli/tests/canister_install_tests.rs index 30e5a0233..1dcc2466a 100644 --- a/crates/icp-cli/tests/canister_install_tests.rs +++ b/crates/icp-cli/tests/canister_install_tests.rs @@ -9,7 +9,7 @@ use predicates::{ }; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_link_tests.rs b/crates/icp-cli/tests/canister_link_tests.rs index f19660fb3..1455aac21 100644 --- a/crates/icp-cli/tests/canister_link_tests.rs +++ b/crates/icp-cli/tests/canister_link_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; @@ -61,7 +61,7 @@ async fn canister_link_records_id() { let path = mapping_path(&project_dir); assert!(path.exists(), "ID mapping file should exist at {path}"); - let mapping = icp::fs::read_to_string(&path).expect("failed to read mapping file"); + let mapping = icp_project::fs::read_to_string(&path).expect("failed to read mapping file"); assert!( mapping.contains(LINKED_ID), "mapping should contain the linked ID, got: {mapping}" @@ -150,7 +150,8 @@ async fn canister_link_existing_requires_force() { // With --force it overwrites the recorded ID. link(other_id, true).assert().success(); - let mapping = icp::fs::read_to_string(&mapping_path(&project_dir)).expect("read mapping"); + let mapping = + icp_project::fs::read_to_string(&mapping_path(&project_dir)).expect("read mapping"); assert!( mapping.contains(other_id) && !mapping.contains(LINKED_ID), "mapping should hold the forced ID only, got: {mapping}" diff --git a/crates/icp-cli/tests/canister_logs_tests.rs b/crates/icp-cli/tests/canister_logs_tests.rs index a325669a4..c67bed640 100644 --- a/crates/icp-cli/tests/canister_logs_tests.rs +++ b/crates/icp-cli/tests/canister_logs_tests.rs @@ -1,7 +1,7 @@ #[cfg(unix)] use { crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext}, - icp::fs::write_string, + icp_project::fs::write_string, indoc::formatdoc, predicates::prelude::PredicateBooleanExt, predicates::str::contains, diff --git a/crates/icp-cli/tests/canister_metadata_tests.rs b/crates/icp-cli/tests/canister_metadata_tests.rs index 643891b4d..90d11ff91 100644 --- a/crates/icp-cli/tests/canister_metadata_tests.rs +++ b/crates/icp-cli/tests/canister_metadata_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_settings_tests.rs b/crates/icp-cli/tests/canister_settings_tests.rs index 5436b077a..de23ea91f 100644 --- a/crates/icp-cli/tests/canister_settings_tests.rs +++ b/crates/icp-cli/tests/canister_settings_tests.rs @@ -5,7 +5,7 @@ use crate::common::{ ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients::{self, icp_cli}, }; -use icp::{ +use icp_project::{ fs::{create_dir_all, write_string}, prelude::*, }; diff --git a/crates/icp-cli/tests/canister_snapshot_tests.rs b/crates/icp-cli/tests/canister_snapshot_tests.rs index 49c18cb6f..e00c01be3 100644 --- a/crates/icp-cli/tests/canister_snapshot_tests.rs +++ b/crates/icp-cli/tests/canister_snapshot_tests.rs @@ -1,7 +1,7 @@ #[cfg(unix)] use { crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}, - icp::{fs::write_string, prelude::*}, + icp_project::{fs::write_string, prelude::*}, indoc::formatdoc, predicates::str::contains, }; diff --git a/crates/icp-cli/tests/canister_start_tests.rs b/crates/icp-cli/tests/canister_start_tests.rs index 00f7d6d87..87fffc36b 100644 --- a/crates/icp-cli/tests/canister_start_tests.rs +++ b/crates/icp-cli/tests/canister_start_tests.rs @@ -5,7 +5,7 @@ use predicates::{ }; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_status_tests.rs b/crates/icp-cli/tests/canister_status_tests.rs index fe6098da2..694d2a4c5 100644 --- a/crates/icp-cli/tests/canister_status_tests.rs +++ b/crates/icp-cli/tests/canister_status_tests.rs @@ -5,7 +5,7 @@ use predicates::{ }; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_stop_tests.rs b/crates/icp-cli/tests/canister_stop_tests.rs index f81168da3..fbde3134c 100644 --- a/crates/icp-cli/tests/canister_stop_tests.rs +++ b/crates/icp-cli/tests/canister_stop_tests.rs @@ -5,7 +5,7 @@ use predicates::{ }; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/canister_top_up_tests.rs b/crates/icp-cli/tests/canister_top_up_tests.rs index d93d88782..9f710f821 100644 --- a/crates/icp-cli/tests/canister_top_up_tests.rs +++ b/crates/icp-cli/tests/canister_top_up_tests.rs @@ -3,7 +3,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/common/clients.rs b/crates/icp-cli/tests/common/clients.rs index c7ebc8ac0..0899a78b0 100644 --- a/crates/icp-cli/tests/common/clients.rs +++ b/crates/icp-cli/tests/common/clients.rs @@ -1,4 +1,4 @@ -use icp::prelude::*; +use icp_project::prelude::*; use crate::common::TestContext; diff --git a/crates/icp-cli/tests/common/clients/icp_cli.rs b/crates/icp-cli/tests/common/clients/icp_cli.rs index c9a0bd336..13afe4ca2 100644 --- a/crates/icp-cli/tests/common/clients/icp_cli.rs +++ b/crates/icp-cli/tests/common/clients/icp_cli.rs @@ -1,5 +1,5 @@ use candid::Principal; -use icp::prelude::*; +use icp_project::prelude::*; use crate::common::TestContext; diff --git a/crates/icp-cli/tests/common/context.rs b/crates/icp-cli/tests/common/context.rs index b75c29e04..5b97fd5b3 100644 --- a/crates/icp-cli/tests/common/context.rs +++ b/crates/icp-cli/tests/common/context.rs @@ -9,7 +9,7 @@ use std::{ use assert_cmd::Command; use camino_tempfile::{Utf8TempDir as TempDir, tempdir}; use ic_agent::Agent; -use icp::prelude::*; +use icp_project::prelude::*; use reqwest::Client; use serde_json::json; use time::UtcDateTime; diff --git a/crates/icp-cli/tests/common/softhsm.rs b/crates/icp-cli/tests/common/softhsm.rs index 7a4fa1d47..fb7672b99 100644 --- a/crates/icp-cli/tests/common/softhsm.rs +++ b/crates/icp-cli/tests/common/softhsm.rs @@ -8,7 +8,7 @@ use cryptoki::{ session::UserType, types::AuthPin, }; -use icp::prelude::*; +use icp_project::prelude::*; /// Default SoftHSM2 library paths by platform #[cfg(target_os = "macos")] diff --git a/crates/icp-cli/tests/cycles_tests.rs b/crates/icp-cli/tests/cycles_tests.rs index a29ee9b58..4722dd9fa 100644 --- a/crates/icp-cli/tests/cycles_tests.rs +++ b/crates/icp-cli/tests/cycles_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::fs::write_string; +use icp_project::fs::write_string; mod common; diff --git a/crates/icp-cli/tests/dependency_tests.rs b/crates/icp-cli/tests/dependency_tests.rs index 24cd55aa5..ac5b9be85 100644 --- a/crates/icp-cli/tests/dependency_tests.rs +++ b/crates/icp-cli/tests/dependency_tests.rs @@ -2,7 +2,7 @@ use indoc::formatdoc; use predicates::{prelude::PredicateBooleanExt, str::contains}; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; mod common; diff --git a/crates/icp-cli/tests/deploy_tests.rs b/crates/icp-cli/tests/deploy_tests.rs index 599d5a079..7efa7546c 100644 --- a/crates/icp-cli/tests/deploy_tests.rs +++ b/crates/icp-cli/tests/deploy_tests.rs @@ -10,7 +10,7 @@ use crate::common::{ ENVIRONMENT_DOCKER_ENGINE, ENVIRONMENT_RANDOM_PORT, NETWORK_DOCKER_ENGINE, NETWORK_RANDOM_PORT, TestContext, build_sync_plugin_example, clients, }; -use icp::{ +use icp_project::{ fs::{create_dir_all, read_to_string, write_string}, prelude::*, store_id::IdMapping, @@ -1473,7 +1473,7 @@ async fn deploy_sync_script_icp_env_vars() { .stderr(contains("NET=random-network")); // Read the assigned canister IDs and verify CID vars and cross-canister visibility. - let id_mapping: IdMapping = icp::fs::json::load( + let id_mapping: IdMapping = icp_project::fs::json::load( &project_dir .join(".icp") .join("cache") diff --git a/crates/icp-cli/tests/identity_tests.rs b/crates/icp-cli/tests/identity_tests.rs index 3f3d3b53e..5038c1b9a 100644 --- a/crates/icp-cli/tests/identity_tests.rs +++ b/crates/icp-cli/tests/identity_tests.rs @@ -4,7 +4,7 @@ use std::io::Write; use camino_tempfile::NamedUtf8TempFile as NamedTempFile; use common::TestContext; use ic_agent::export::Principal; -use icp::{fs::write_string, prelude::*}; +use icp_project::{fs::write_string, prelude::*}; use indoc::formatdoc; use predicates::{ord::eq, prelude::*, str::contains}; diff --git a/crates/icp-cli/tests/message_send_tests.rs b/crates/icp-cli/tests/message_send_tests.rs index 4bfeb3318..f668e27d5 100644 --- a/crates/icp-cli/tests/message_send_tests.rs +++ b/crates/icp-cli/tests/message_send_tests.rs @@ -10,8 +10,8 @@ use predicates::str::contains; use serde_json::Value; use crate::common::{ChildGuard, ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext}; -use icp::fs::write_string; -use icp::prelude::*; +use icp_project::fs::write_string; +use icp_project::prelude::*; mod common; @@ -232,7 +232,7 @@ fn only_the_file_says_where_to_submit() { // An edited network is honoured, and the message still validates: the // envelope is signed and carries no URL, so this cannot change what executes. let mut file: Value = - serde_json::from_str(&icp::fs::read_to_string(&msg).expect("read")).expect("JSON"); + serde_json::from_str(&icp_project::fs::read_to_string(&msg).expect("read")).expect("JSON"); file["network"]["url"] = Value::String("http://127.0.0.1:1234/".into()); write_string( &msg, @@ -279,7 +279,7 @@ fn tampered_file_is_refused() { .success(); let mut file: Value = - serde_json::from_str(&icp::fs::read_to_string(&msg).expect("read")).expect("JSON"); + serde_json::from_str(&icp_project::fs::read_to_string(&msg).expect("read")).expect("JSON"); file["summary"]["method"] = Value::String("transfer".into()); write_string( &msg, @@ -341,7 +341,7 @@ fn a_doctored_interface_cannot_hide_the_signed_argument() { // Swap in an interface that declares only `to`. It still decodes, and the // envelope and summary still validate — nothing about the file is invalid. let mut file: Value = - serde_json::from_str(&icp::fs::read_to_string(&msg).expect("read")).expect("JSON"); + serde_json::from_str(&icp_project::fs::read_to_string(&msg).expect("read")).expect("JSON"); file["candid"] = Value::String(r#"service : { "transfer" : (record { to : text }) -> () }"#.into()); write_string( @@ -444,7 +444,7 @@ fn expired_file_is_refused() { }, network: Network { url: "http://127.0.0.1:1".parse().expect("url"), - root_key: icp::network::RootKeySpec::Mainnet, + root_key: icp_project::network::RootKeySpec::Mainnet, }, destination: Destination::Canister(canister), candid: None, diff --git a/crates/icp-cli/tests/network_ping_tests.rs b/crates/icp-cli/tests/network_ping_tests.rs index c3811671c..afa4b5ffb 100644 --- a/crates/icp-cli/tests/network_ping_tests.rs +++ b/crates/icp-cli/tests/network_ping_tests.rs @@ -1,4 +1,4 @@ -use icp::fs::write_string; +use icp_project::fs::write_string; use predicates::str::{PredicateStrExt, contains}; use serde_json::Value; diff --git a/crates/icp-cli/tests/network_status_tests.rs b/crates/icp-cli/tests/network_status_tests.rs index fa5f4298e..c75b44265 100644 --- a/crates/icp-cli/tests/network_status_tests.rs +++ b/crates/icp-cli/tests/network_status_tests.rs @@ -1,4 +1,4 @@ -use icp::fs::write_string; +use icp_project::fs::write_string; use indoc::formatdoc; use predicates::str::{PredicateStrExt, contains}; diff --git a/crates/icp-cli/tests/network_tests.rs b/crates/icp-cli/tests/network_tests.rs index c371b55e3..22126db37 100644 --- a/crates/icp-cli/tests/network_tests.rs +++ b/crates/icp-cli/tests/network_tests.rs @@ -21,7 +21,7 @@ use crate::common::{ ENVIRONMENT_DOCKER, ENVIRONMENT_RANDOM_PORT, NETWORK_DOCKER, NETWORK_RANDOM_PORT, TestContext, TestNetwork, clients, }; -use icp::{ +use icp_project::{ fs::{read_to_string, write_string}, prelude::*, }; diff --git a/crates/icp-cli/tests/project_tests.rs b/crates/icp-cli/tests/project_tests.rs index 7aaee9d5f..08ee9c2cd 100644 --- a/crates/icp-cli/tests/project_tests.rs +++ b/crates/icp-cli/tests/project_tests.rs @@ -3,7 +3,7 @@ use indoc::{formatdoc, indoc}; use predicates::str::contains; use crate::common::TestContext; -use icp::fs::{create_dir_all, write_string}; +use icp_project::fs::{create_dir_all, write_string}; mod common; diff --git a/crates/icp-cli/tests/recipe_tests.rs b/crates/icp-cli/tests/recipe_tests.rs index e10554f00..c09071f39 100644 --- a/crates/icp-cli/tests/recipe_tests.rs +++ b/crates/icp-cli/tests/recipe_tests.rs @@ -3,7 +3,7 @@ use k256::sha2::{Digest, Sha256}; use predicates::{prelude::PredicateBooleanExt, str::contains}; use crate::common::{TestContext, spawn_test_server}; -use icp::fs::write_string; +use icp_project::fs::write_string; mod common; diff --git a/crates/icp-cli/tests/sync_tests.rs b/crates/icp-cli/tests/sync_tests.rs index 867a766b2..01a7fe19d 100644 --- a/crates/icp-cli/tests/sync_tests.rs +++ b/crates/icp-cli/tests/sync_tests.rs @@ -1,4 +1,4 @@ -use icp::{ +use icp_project::{ fs::{create_dir_all, write_string}, prelude::*, store_id::IdMapping, @@ -940,7 +940,7 @@ async fn sync_script_icp_env_vars() { .assert() .success(); - let id_mapping: IdMapping = icp::fs::json::load( + let id_mapping: IdMapping = icp_project::fs::json::load( &project_dir .join(".icp") .join("cache") diff --git a/crates/icp-cli/tests/telemetry_tests.rs b/crates/icp-cli/tests/telemetry_tests.rs index f28536fef..cda734f9b 100644 --- a/crates/icp-cli/tests/telemetry_tests.rs +++ b/crates/icp-cli/tests/telemetry_tests.rs @@ -20,7 +20,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use camino_tempfile::tempdir; use httptest::{Expectation, Server, matchers::*, responders::*}; -use icp::prelude::*; // brings in camino Path / PathBuf +use icp_project::prelude::*; // brings in camino Path / PathBuf use predicates::str as predstr; use serde_json::Value; use time::OffsetDateTime; diff --git a/crates/icp-cli/tests/token_tests.rs b/crates/icp-cli/tests/token_tests.rs index bdc0c8eb1..24414b810 100644 --- a/crates/icp-cli/tests/token_tests.rs +++ b/crates/icp-cli/tests/token_tests.rs @@ -3,7 +3,7 @@ use indoc::formatdoc; use predicates::str::contains; use crate::common::{ENVIRONMENT_RANDOM_PORT, NETWORK_RANDOM_PORT, TestContext, clients}; -use icp::fs::write_string; +use icp_project::fs::write_string; mod common; diff --git a/crates/icp/Cargo.toml b/crates/icp-project/Cargo.toml similarity index 99% rename from crates/icp/Cargo.toml rename to crates/icp-project/Cargo.toml index 21d9e68fd..491ca2ab0 100644 --- a/crates/icp/Cargo.toml +++ b/crates/icp-project/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "icp" +name = "icp-project" version.workspace = true edition = { workspace = true } license = { workspace = true } diff --git a/crates/icp/src/agent.rs b/crates/icp-project/src/agent.rs similarity index 100% rename from crates/icp/src/agent.rs rename to crates/icp-project/src/agent.rs diff --git a/crates/icp/src/canister/build/mod.rs b/crates/icp-project/src/canister/build/mod.rs similarity index 100% rename from crates/icp/src/canister/build/mod.rs rename to crates/icp-project/src/canister/build/mod.rs diff --git a/crates/icp/src/canister/build/prebuilt.rs b/crates/icp-project/src/canister/build/prebuilt.rs similarity index 100% rename from crates/icp/src/canister/build/prebuilt.rs rename to crates/icp-project/src/canister/build/prebuilt.rs diff --git a/crates/icp/src/canister/build/script.rs b/crates/icp-project/src/canister/build/script.rs similarity index 100% rename from crates/icp/src/canister/build/script.rs rename to crates/icp-project/src/canister/build/script.rs diff --git a/crates/icp/src/canister/mod.rs b/crates/icp-project/src/canister/mod.rs similarity index 100% rename from crates/icp/src/canister/mod.rs rename to crates/icp-project/src/canister/mod.rs diff --git a/crates/icp/src/canister/recipe/mod.rs b/crates/icp-project/src/canister/recipe/mod.rs similarity index 100% rename from crates/icp/src/canister/recipe/mod.rs rename to crates/icp-project/src/canister/recipe/mod.rs diff --git a/crates/icp/src/canister/recipe/render.rs b/crates/icp-project/src/canister/recipe/render.rs similarity index 100% rename from crates/icp/src/canister/recipe/render.rs rename to crates/icp-project/src/canister/recipe/render.rs diff --git a/crates/icp/src/canister/script.rs b/crates/icp-project/src/canister/script.rs similarity index 100% rename from crates/icp/src/canister/script.rs rename to crates/icp-project/src/canister/script.rs diff --git a/crates/icp/src/canister/sync/mod.rs b/crates/icp-project/src/canister/sync/mod.rs similarity index 100% rename from crates/icp/src/canister/sync/mod.rs rename to crates/icp-project/src/canister/sync/mod.rs diff --git a/crates/icp/src/canister/sync/plugin.rs b/crates/icp-project/src/canister/sync/plugin.rs similarity index 100% rename from crates/icp/src/canister/sync/plugin.rs rename to crates/icp-project/src/canister/sync/plugin.rs diff --git a/crates/icp/src/canister/sync/script.rs b/crates/icp-project/src/canister/sync/script.rs similarity index 100% rename from crates/icp/src/canister/sync/script.rs rename to crates/icp-project/src/canister/sync/script.rs diff --git a/crates/icp/src/canister/visibility.rs b/crates/icp-project/src/canister/visibility.rs similarity index 100% rename from crates/icp/src/canister/visibility.rs rename to crates/icp-project/src/canister/visibility.rs diff --git a/crates/icp/src/canister/wasm.rs b/crates/icp-project/src/canister/wasm.rs similarity index 100% rename from crates/icp/src/canister/wasm.rs rename to crates/icp-project/src/canister/wasm.rs diff --git a/crates/icp/src/fs/json.rs b/crates/icp-project/src/fs/json.rs similarity index 100% rename from crates/icp/src/fs/json.rs rename to crates/icp-project/src/fs/json.rs diff --git a/crates/icp/src/fs/lock.rs b/crates/icp-project/src/fs/lock.rs similarity index 100% rename from crates/icp/src/fs/lock.rs rename to crates/icp-project/src/fs/lock.rs diff --git a/crates/icp/src/fs/mod.rs b/crates/icp-project/src/fs/mod.rs similarity index 100% rename from crates/icp/src/fs/mod.rs rename to crates/icp-project/src/fs/mod.rs diff --git a/crates/icp/src/fs/yaml.rs b/crates/icp-project/src/fs/yaml.rs similarity index 100% rename from crates/icp/src/fs/yaml.rs rename to crates/icp-project/src/fs/yaml.rs diff --git a/crates/icp/src/host.rs b/crates/icp-project/src/host.rs similarity index 100% rename from crates/icp/src/host.rs rename to crates/icp-project/src/host.rs diff --git a/crates/icp/src/lib.rs b/crates/icp-project/src/lib.rs similarity index 100% rename from crates/icp/src/lib.rs rename to crates/icp-project/src/lib.rs diff --git a/crates/icp/src/manifest/adapter/mod.rs b/crates/icp-project/src/manifest/adapter/mod.rs similarity index 100% rename from crates/icp/src/manifest/adapter/mod.rs rename to crates/icp-project/src/manifest/adapter/mod.rs diff --git a/crates/icp/src/manifest/adapter/plugin.rs b/crates/icp-project/src/manifest/adapter/plugin.rs similarity index 100% rename from crates/icp/src/manifest/adapter/plugin.rs rename to crates/icp-project/src/manifest/adapter/plugin.rs diff --git a/crates/icp/src/manifest/adapter/prebuilt.rs b/crates/icp-project/src/manifest/adapter/prebuilt.rs similarity index 100% rename from crates/icp/src/manifest/adapter/prebuilt.rs rename to crates/icp-project/src/manifest/adapter/prebuilt.rs diff --git a/crates/icp/src/manifest/adapter/script.rs b/crates/icp-project/src/manifest/adapter/script.rs similarity index 100% rename from crates/icp/src/manifest/adapter/script.rs rename to crates/icp-project/src/manifest/adapter/script.rs diff --git a/crates/icp/src/manifest/canister.rs b/crates/icp-project/src/manifest/canister.rs similarity index 100% rename from crates/icp/src/manifest/canister.rs rename to crates/icp-project/src/manifest/canister.rs diff --git a/crates/icp/src/manifest/dependency.rs b/crates/icp-project/src/manifest/dependency.rs similarity index 100% rename from crates/icp/src/manifest/dependency.rs rename to crates/icp-project/src/manifest/dependency.rs diff --git a/crates/icp/src/manifest/environment.rs b/crates/icp-project/src/manifest/environment.rs similarity index 100% rename from crates/icp/src/manifest/environment.rs rename to crates/icp-project/src/manifest/environment.rs diff --git a/crates/icp/src/manifest/mod.rs b/crates/icp-project/src/manifest/mod.rs similarity index 100% rename from crates/icp/src/manifest/mod.rs rename to crates/icp-project/src/manifest/mod.rs diff --git a/crates/icp/src/manifest/network.rs b/crates/icp-project/src/manifest/network.rs similarity index 100% rename from crates/icp/src/manifest/network.rs rename to crates/icp-project/src/manifest/network.rs diff --git a/crates/icp/src/manifest/project.rs b/crates/icp-project/src/manifest/project.rs similarity index 100% rename from crates/icp/src/manifest/project.rs rename to crates/icp-project/src/manifest/project.rs diff --git a/crates/icp/src/manifest/recipe.rs b/crates/icp-project/src/manifest/recipe.rs similarity index 100% rename from crates/icp/src/manifest/recipe.rs rename to crates/icp-project/src/manifest/recipe.rs diff --git a/crates/icp/src/manifest/serde_helpers.rs b/crates/icp-project/src/manifest/serde_helpers.rs similarity index 100% rename from crates/icp/src/manifest/serde_helpers.rs rename to crates/icp-project/src/manifest/serde_helpers.rs diff --git a/crates/icp/src/network/access.rs b/crates/icp-project/src/network/access.rs similarity index 100% rename from crates/icp/src/network/access.rs rename to crates/icp-project/src/network/access.rs diff --git a/crates/icp/src/network/mod.rs b/crates/icp-project/src/network/mod.rs similarity index 100% rename from crates/icp/src/network/mod.rs rename to crates/icp-project/src/network/mod.rs diff --git a/crates/icp/src/operations/binding_env_vars.rs b/crates/icp-project/src/operations/binding_env_vars.rs similarity index 100% rename from crates/icp/src/operations/binding_env_vars.rs rename to crates/icp-project/src/operations/binding_env_vars.rs diff --git a/crates/icp/src/operations/build.rs b/crates/icp-project/src/operations/build.rs similarity index 100% rename from crates/icp/src/operations/build.rs rename to crates/icp-project/src/operations/build.rs diff --git a/crates/icp/src/operations/bundle.rs b/crates/icp-project/src/operations/bundle.rs similarity index 100% rename from crates/icp/src/operations/bundle.rs rename to crates/icp-project/src/operations/bundle.rs diff --git a/crates/icp/src/operations/candid_compat.rs b/crates/icp-project/src/operations/candid_compat.rs similarity index 100% rename from crates/icp/src/operations/candid_compat.rs rename to crates/icp-project/src/operations/candid_compat.rs diff --git a/crates/icp/src/operations/create.rs b/crates/icp-project/src/operations/create.rs similarity index 100% rename from crates/icp/src/operations/create.rs rename to crates/icp-project/src/operations/create.rs diff --git a/crates/icp/src/operations/deploy.rs b/crates/icp-project/src/operations/deploy.rs similarity index 100% rename from crates/icp/src/operations/deploy.rs rename to crates/icp-project/src/operations/deploy.rs diff --git a/crates/icp/src/operations/install.rs b/crates/icp-project/src/operations/install.rs similarity index 100% rename from crates/icp/src/operations/install.rs rename to crates/icp-project/src/operations/install.rs diff --git a/crates/icp/src/operations/misc.rs b/crates/icp-project/src/operations/misc.rs similarity index 100% rename from crates/icp/src/operations/misc.rs rename to crates/icp-project/src/operations/misc.rs diff --git a/crates/icp/src/operations/mod.rs b/crates/icp-project/src/operations/mod.rs similarity index 100% rename from crates/icp/src/operations/mod.rs rename to crates/icp-project/src/operations/mod.rs diff --git a/crates/icp/src/operations/proxy.rs b/crates/icp-project/src/operations/proxy.rs similarity index 100% rename from crates/icp/src/operations/proxy.rs rename to crates/icp-project/src/operations/proxy.rs diff --git a/crates/icp/src/operations/proxy_management.rs b/crates/icp-project/src/operations/proxy_management.rs similarity index 100% rename from crates/icp/src/operations/proxy_management.rs rename to crates/icp-project/src/operations/proxy_management.rs diff --git a/crates/icp/src/operations/recover_cycles.rs b/crates/icp-project/src/operations/recover_cycles.rs similarity index 100% rename from crates/icp/src/operations/recover_cycles.rs rename to crates/icp-project/src/operations/recover_cycles.rs diff --git a/crates/icp/src/operations/settings.rs b/crates/icp-project/src/operations/settings.rs similarity index 100% rename from crates/icp/src/operations/settings.rs rename to crates/icp-project/src/operations/settings.rs diff --git a/crates/icp/src/operations/sync.rs b/crates/icp-project/src/operations/sync.rs similarity index 100% rename from crates/icp/src/operations/sync.rs rename to crates/icp-project/src/operations/sync.rs diff --git a/crates/icp/src/operations/task.rs b/crates/icp-project/src/operations/task.rs similarity index 100% rename from crates/icp/src/operations/task.rs rename to crates/icp-project/src/operations/task.rs diff --git a/crates/icp/src/operations/wasm.rs b/crates/icp-project/src/operations/wasm.rs similarity index 100% rename from crates/icp/src/operations/wasm.rs rename to crates/icp-project/src/operations/wasm.rs diff --git a/crates/icp/src/parsers.rs b/crates/icp-project/src/parsers.rs similarity index 100% rename from crates/icp/src/parsers.rs rename to crates/icp-project/src/parsers.rs diff --git a/crates/icp/src/prelude.rs b/crates/icp-project/src/prelude.rs similarity index 100% rename from crates/icp/src/prelude.rs rename to crates/icp-project/src/prelude.rs diff --git a/crates/icp/src/project.rs b/crates/icp-project/src/project.rs similarity index 100% rename from crates/icp/src/project.rs rename to crates/icp-project/src/project.rs diff --git a/crates/icp/src/signal.rs b/crates/icp-project/src/signal.rs similarity index 95% rename from crates/icp/src/signal.rs rename to crates/icp-project/src/signal.rs index 294b197c5..607fba7b6 100644 --- a/crates/icp/src/signal.rs +++ b/crates/icp-project/src/signal.rs @@ -10,7 +10,7 @@ use tokio::select; /// # Examples /// /// ```no_run -/// use icp::signal::stop_signal; +/// use icp_project::signal::stop_signal; /// use tokio::select; /// /// # async fn example() { @@ -45,7 +45,7 @@ pub async fn stop_signal() { /// # Examples /// /// ```no_run -/// use icp::signal::stop_signal; +/// use icp_project::signal::stop_signal; /// use tokio::select; /// /// # async fn example() { diff --git a/crates/icp/src/store_artifact.rs b/crates/icp-project/src/store_artifact.rs similarity index 100% rename from crates/icp/src/store_artifact.rs rename to crates/icp-project/src/store_artifact.rs diff --git a/crates/icp/src/store_id.rs b/crates/icp-project/src/store_id.rs similarity index 100% rename from crates/icp/src/store_id.rs rename to crates/icp-project/src/store_id.rs diff --git a/crates/schema-gen/Cargo.toml b/crates/schema-gen/Cargo.toml index 48f59d6de..7a4c4d68b 100644 --- a/crates/schema-gen/Cargo.toml +++ b/crates/schema-gen/Cargo.toml @@ -6,7 +6,7 @@ license.workspace = true publish.workspace = true [dependencies] -icp = { workspace = true } +icp-project = { workspace = true } schemars = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/schema-gen/src/main.rs b/crates/schema-gen/src/main.rs index 3c6ebfb18..cd09d39e2 100644 --- a/crates/schema-gen/src/main.rs +++ b/crates/schema-gen/src/main.rs @@ -1,8 +1,10 @@ -use icp::manifest::{CanisterManifest, EnvironmentManifest, NetworkManifest, ProjectManifest}; +use icp_project::manifest::{ + CanisterManifest, EnvironmentManifest, NetworkManifest, ProjectManifest, +}; macro_rules! generate_schemas { ($base:expr, $($t:ty => $filename:expr),+ $(,)?) => {{ - let base : icp::prelude::PathBuf = $base.into(); + let base : icp_project::prelude::PathBuf = $base.into(); $( {