From 657b107ccac4939f8a01d39da340fb76cb7c3624 Mon Sep 17 00:00:00 2001 From: Raymond Khalife Date: Thu, 5 Feb 2026 09:14:37 -0500 Subject: [PATCH 1/4] chore: move command availability check to the top --- recipes/rust/recipe.hbs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/recipes/rust/recipe.hbs b/recipes/rust/recipe.hbs index 51552c3..d5f36e4 100644 --- a/recipes/rust/recipe.hbs +++ b/recipes/rust/recipe.hbs @@ -7,6 +7,16 @@ build: steps: + - type: script + commands: + - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 'ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n'; exit 1; } + {{#unless candid}} + - command -v candid-extractor >/dev/null 2>&1 || { echo >&2 'candid-extractor not found. Run `cargo install candid-extractor` to install it.'; exit 1; } + {{/unless}} + {{#if compress }} + - command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; } + {{/if}} + - type: script commands: - cargo build --package {{ package }} --target wasm32-unknown-unknown --release @@ -14,13 +24,11 @@ build: - type: script commands: - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 'ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n'; exit 1; } - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "cargo:version" -d "$(cargo --version)" --keep-name-section - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "template:type" -d "rust" --keep-name-section {{#if candid}} - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "candid:service" -f '{{ candid }}' -v public --keep-name-section {{else}} - - command -v candid-extractor >/dev/null 2>&1 || { echo >&2 'candid-extractor not found. Run `cargo install candid-extractor` to install it.'; exit 1; } - did="$(mktemp)"; candid-extractor "$ICP_WASM_OUTPUT_PATH" >"$did" && ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "candid:service" -f "$did" -v public --keep-name-section {{/if}} {{#if metadata}} @@ -32,7 +40,6 @@ build: {{#if shrink}} - type: script commands: - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" shrink --keep-name-section {{/if}} From 4e14e8f4a95efa43b0b58c246d8f10f94358cc6e Mon Sep 17 00:00:00 2001 From: Raymond Khalife Date: Thu, 5 Feb 2026 15:36:45 -0500 Subject: [PATCH 2/4] precheck required tools for motoko --- recipes/motoko/recipe.hbs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/recipes/motoko/recipe.hbs b/recipes/motoko/recipe.hbs index 7ab4ee7..9508fac 100644 --- a/recipes/motoko/recipe.hbs +++ b/recipes/motoko/recipe.hbs @@ -8,14 +8,21 @@ build: steps: + # Check that required commands exist - type: script commands: - sh -c 'command -v mops >/dev/null 2>&1 || { echo >&2 "'mops' not found on path. To install Mops, see https://mops.one/docs/install.\n"; exit 1; }' + - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } + {{#if compress }} + - command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; } + {{/if}} + + - type: script + commands: - sh -c '$(mops toolchain bin moc) "{{ main }}" {{#if args}}{{ args }} {{/if}}{{#if candid}}--omit-metadata{{else}}--public-metadata{{/if}} candid:service $(mops sources) -o "$ICP_WASM_OUTPUT_PATH"' - type: script commands: - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } - sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "moc:version" -d "$($(mops toolchain bin moc) --version)" --keep-name-section' - type: script @@ -33,14 +40,12 @@ build: {{#if shrink}} - type: script commands: - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" shrink --keep-name-section {{/if}} {{#if compress }} - type: script commands: - - command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; } - gzip --no-name "$ICP_WASM_OUTPUT_PATH" - mv "${ICP_WASM_OUTPUT_PATH}.gz" "$ICP_WASM_OUTPUT_PATH" {{/if}} From b44962d1d06252c977ca53a81a723dc1aaf48cb2 Mon Sep 17 00:00:00 2001 From: Raymond Khalife Date: Thu, 5 Feb 2026 15:38:52 -0500 Subject: [PATCH 3/4] do it for the asset canister --- recipes/asset-canister/recipe.hbs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/asset-canister/recipe.hbs b/recipes/asset-canister/recipe.hbs index 012a4e5..fc392eb 100644 --- a/recipes/asset-canister/recipe.hbs +++ b/recipes/asset-canister/recipe.hbs @@ -8,6 +8,12 @@ build: steps: + {{#if metadata}} + - type: script + commands: + - sh -c 'command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; }' + {{/if}} + {{#if build}} {{! Execute frontend build command(s) first }} - type: script @@ -28,7 +34,6 @@ build: - type: script commands: {{#each metadata}} - - sh -c 'command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; }' - sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "{{ name }}" -d "{{ value }}" --keep-name-section' {{/each}} {{/if}} From 1e44735d99d5baa52e61a343fd2db59bb9226582 Mon Sep 17 00:00:00 2001 From: Raymond Khalife Date: Thu, 5 Feb 2026 15:41:31 -0500 Subject: [PATCH 4/4] do it for prebuilt --- recipes/prebuilt/recipe.hbs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/recipes/prebuilt/recipe.hbs b/recipes/prebuilt/recipe.hbs index 2aca2dd..2cd44e7 100644 --- a/recipes/prebuilt/recipe.hbs +++ b/recipes/prebuilt/recipe.hbs @@ -9,6 +9,19 @@ build: steps: + - type: script + commands: + - echo "Checking pre-requisites" + {{#if metadata}} + - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } + {{/if}} + {{#if shrink}} + - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } + {{/if}} + {{#if compress}} + - command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; } + {{/if}} + - type: pre-built path: {{ path }} {{#if sha256 }} @@ -19,7 +32,6 @@ build: - type: script commands: {{#each metadata}} - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "{{ name }}" -d "{{ value }}" --keep-name-section {{/each}} {{/if}} @@ -27,14 +39,12 @@ build: {{#if shrink}} - type: script commands: - - command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; } - ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" shrink --keep-name-section {{/if}} {{#if compress}} - type: script commands: - - command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; } - gzip --no-name "$ICP_WASM_OUTPUT_PATH" - mv "${ICP_WASM_OUTPUT_PATH}.gz" "$ICP_WASM_OUTPUT_PATH" {{/if}}