Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build_and_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ jobs:
name: Build and Test
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@1.85.0
with:
Expand All @@ -31,7 +30,7 @@ jobs:

- name: install ic-wasm
run: |
wget https://github.com/dfinity/ic-wasm/releases/download/0.8.1/ic-wasm-linux64 -O /usr/local/bin/ic-wasm
wget https://github.com/dfinity/ic-wasm/releases/download/0.9.3/ic-wasm-linux64 -O /usr/local/bin/ic-wasm
chmod +x /usr/local/bin/ic-wasm

- name: check rust code style
Expand All @@ -50,4 +49,3 @@ jobs:
run: |
sudo apt install gcc-multilib
just test_i686

3 changes: 3 additions & 0 deletions ic-canister/tests/canister-a/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "canister-a"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
5 changes: 0 additions & 5 deletions ic-canister/tests/canister-a/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-canister/tests/canister-b/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "canister-b"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
14 changes: 2 additions & 12 deletions ic-canister/tests/canister-b/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::rc::Rc;

use canister_a::{CanisterA, CanisterAImpl, StateA};
use ic_canister::{
canister_call, canister_notify, generate_idl, init, update, virtual_canister_call,
virtual_canister_notify, Canister, PreUpdate,
canister_call, canister_notify, init, update, virtual_canister_call, virtual_canister_notify,
Canister, PreUpdate,
};
use ic_exports::candid::{CandidType, Deserialize, Principal};
use ic_storage::IcStorage;
Expand Down Expand Up @@ -108,16 +108,6 @@ impl CanisterA for CanisterB {
}
}

pub fn idl() -> String {
use ic_canister::Idl;

let canister_b_idl = generate_idl!();
let mut canister_a_idl = <CanisterB as CanisterA>::get_idl();
canister_a_idl.merge(&canister_b_idl);

candid::pretty::candid::compile(&canister_a_idl.env.env, &Some(canister_a_idl.actor))
}

#[cfg(test)]
mod tests {
use ic_exports::ic_kit::mock_principals::alice;
Expand Down
3 changes: 0 additions & 3 deletions ic-canister/tests/canister-b/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-canister/tests/canister-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "canister-c"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
14 changes: 1 addition & 13 deletions ic-canister/tests/canister-c/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cell::RefCell;
use std::rc::Rc;

use ic_canister::{generate_idl, update, Canister, MethodType, PreUpdate};
use ic_canister::{update, Canister, MethodType, PreUpdate};
use ic_exports::candid::{CandidType, Deserialize, Principal};
use ic_metrics::{Metrics, MetricsStorage};
use ic_storage::stable::Versioned;
Expand Down Expand Up @@ -53,18 +53,6 @@ impl PreUpdate for CanisterC {
}
}

pub fn idl() -> String {
use ic_canister::Idl;

let canister_c_idl = generate_idl!();

let mut metrics_idl = <CanisterC as Metrics>::get_idl();

metrics_idl.merge(&canister_c_idl);

candid::pretty::candid::compile(&metrics_idl.env.env, &Some(metrics_idl.actor))
}

#[cfg(test)]
mod tests {
use ic_canister::canister_call;
Expand Down
3 changes: 0 additions & 3 deletions ic-canister/tests/canister-c/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-canister/tests/canister-d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "canister-d"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
5 changes: 0 additions & 5 deletions ic-canister/tests/canister-d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ pub trait CanisterD: Canister {

generate_exports!(CanisterD, CanisterDImpl);

pub fn idl() -> String {
let trait_idl = <CanisterDImpl as CanisterD>::get_idl();
candid::pretty::candid::compile(&trait_idl.env.env, &Some(trait_idl.actor))
}

#[cfg(test)]
mod tests {

Expand Down
3 changes: 0 additions & 3 deletions ic-canister/tests/canister-d/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-canister/tests/canister-e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "canister-e"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
Expand Down
10 changes: 0 additions & 10 deletions ic-canister/tests/canister-e/src/main.rs

This file was deleted.

11 changes: 10 additions & 1 deletion ic-log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "ic-log"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -24,7 +27,13 @@ serde = { workspace = true }
ic-canister = { path = "../ic-canister/ic-canister" }

[features]
canister = ["export-api", "ic-canister", "ic-storage", "ic-stable-structures", "cfg-if"]
canister = [
"export-api",
"ic-canister",
"ic-storage",
"ic-stable-structures",
"cfg-if",
]
export-api = []

[[example]]
Expand Down
3 changes: 3 additions & 0 deletions ic-payments/test-payment-canister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "test-payment-canister"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
6 changes: 5 additions & 1 deletion ic-payments/test-payment-canister/src/canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::collections::HashMap;

use candid::Nat;
use ic_canister::{init, update, Canister, PreUpdate};
use ic_canister::{generate_idl, init, update, Canister, Idl, PreUpdate};
use ic_exports::candid::{CandidType, Deserialize, Principal};
use ic_exports::ic_kit::ic;
use ic_exports::icrc_types::icrc1::account::Account;
Expand Down Expand Up @@ -148,4 +148,8 @@ impl PaymentCanister {

(local_balance, token_canister_balance)
}

pub fn idl() -> Idl {
generate_idl!()
}
}
1 change: 1 addition & 0 deletions ic-payments/test-payment-canister/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod canister;
4 changes: 0 additions & 4 deletions ic-payments/test-payment-canister/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-stable-structures/tests/dummy_canister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "dummy_canister"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
1 change: 1 addition & 0 deletions ic-stable-structures/tests/dummy_canister/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod canister;
10 changes: 0 additions & 10 deletions ic-stable-structures/tests/dummy_canister/src/main.rs

This file was deleted.

3 changes: 3 additions & 0 deletions ic-task-scheduler/tests/dummy_scheduler_canister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "dummy_scheduler_canister"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = []
export-api = []
Expand Down
10 changes: 0 additions & 10 deletions ic-task-scheduler/tests/dummy_scheduler_canister/src/main.rs

This file was deleted.

29 changes: 11 additions & 18 deletions just/build.just
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,40 @@ build: pre_build build_ic_stable_structures_dummy_canister build_ic_canister_tes


[private]
pre_build:
pre_build:
mkdir -p "{{WASM_DIR}}"


[private]
build_ic_stable_structures_dummy_canister:
cargo run -p dummy_canister --features export-api > {{WASM_DIR}}/dummy_canister.did
cargo build -p dummy_canister --target wasm32-unknown-unknown --features export-api --release
ic-wasm {{WASM_DIR}}/dummy_canister.wasm -o {{WASM_DIR}}/dummy_canister.wasm shrink
ic-wasm {{WASM_DIR}}/dummy_canister.wasm -o {{WASM_DIR}}/dummy_canister.wasm shrink --keep-name-section



[private]
build_ic_canister_test_canisters:
cargo run -p canister-a --features export-api > {{WASM_DIR}}/canister-a.did
cargo run -p canister-b --features export-api > {{WASM_DIR}}/canister-b.did
cargo run -p canister-c --features export-api > {{WASM_DIR}}/canister-c.did
cargo run -p canister-d --features export-api > {{WASM_DIR}}/canister-d.did

cargo build -p canister-a --target wasm32-unknown-unknown --features export-api --release
cargo build -p canister-b --target wasm32-unknown-unknown --features export-api --release
cargo build -p canister-c --target wasm32-unknown-unknown --features export-api --release
cargo build -p canister-d --target wasm32-unknown-unknown --features export-api --release

ic-wasm {{WASM_DIR}}/canister-a.wasm -o {{WASM_DIR}}/canister-a.wasm shrink
ic-wasm {{WASM_DIR}}/canister-b.wasm -o {{WASM_DIR}}/canister-b.wasm shrink
ic-wasm {{WASM_DIR}}/canister-c.wasm -o {{WASM_DIR}}/canister-c.wasm shrink
ic-wasm {{WASM_DIR}}/canister-d.wasm -o {{WASM_DIR}}/canister-d.wasm shrink
ic-wasm {{WASM_DIR}}/canister_a.wasm -o {{WASM_DIR}}/canister_a.wasm shrink --keep-name-section
ic-wasm {{WASM_DIR}}/canister_b.wasm -o {{WASM_DIR}}/canister_b.wasm shrink --keep-name-section
ic-wasm {{WASM_DIR}}/canister_c.wasm -o {{WASM_DIR}}/canister_c.wasm shrink --keep-name-section
ic-wasm {{WASM_DIR}}/canister_d.wasm -o {{WASM_DIR}}/canister_d.wasm shrink --keep-name-section


[private]
build_ic_task_scheduler_dummy_scheduler_canister:
cargo run -p dummy_scheduler_canister --features export-api > {{WASM_DIR}}/dummy_scheduler_canister.did
cargo build -p dummy_scheduler_canister --target wasm32-unknown-unknown --features export-api --release
ic-wasm {{WASM_DIR}}/dummy_scheduler_canister.wasm -o {{WASM_DIR}}/dummy_scheduler_canister.wasm shrink
ic-wasm {{WASM_DIR}}/dummy_scheduler_canister.wasm -o {{WASM_DIR}}/dummy_scheduler_canister.wasm shrink --keep-name-section



[private]
build_ic_log_test_canister:
cargo run -p ic-log --example log_canister --features canister > {{WASM_DIR}}/log_canister.did
cargo build -p ic-log --example log_canister --target wasm32-unknown-unknown --features canister --release
ic-wasm {{WASM_DIR}}/examples/log_canister.wasm -o {{WASM_DIR}}/log_canister.wasm shrink
ic-wasm {{WASM_DIR}}/examples/log_canister.wasm -o {{WASM_DIR}}/log_canister.wasm shrink --keep-name-section


[private]
Expand All @@ -70,5 +63,5 @@ build_ic_payments_test_canister:
fi

cargo build --target wasm32-unknown-unknown --features export-api -p test-payment-canister --release
ic-wasm {{WASM_DIR}}/test-payment-canister.wasm -o {{WASM_DIR}}/test-payment-canister.wasm shrink
ic-wasm {{WASM_DIR}}/test_payment_canister.wasm -o {{WASM_DIR}}/test_payment_canister.wasm shrink --keep-name-section