Skip to content

icp-sync-plugin/build.rs: warn instead of panic when wasm32-wasip2 is missing#545

Closed
SAY-5 wants to merge 1 commit intodfinity:mainfrom
SAY-5:say5/sync-plugin-build-skip-on-missing-target-543
Closed

icp-sync-plugin/build.rs: warn instead of panic when wasm32-wasip2 is missing#545
SAY-5 wants to merge 1 commit intodfinity:mainfrom
SAY-5:say5/sync-plugin-build-skip-on-missing-target-543

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #543.

crates/icp-sync-plugin/build.rs unconditionally ran cargo build --target wasm32-wasip2 for the test fixture and panicked the entire build when the target wasn't installed. Distribution toolchains (Homebrew, distro packagers) often don't ship wasm32-wasip2, so cargo install icp-cli failed for downstream packagers.

The fixture is only consumed by #[test] functions in runtime.rs. CARGO_CFG_TEST isn't set during build-script execution, so suggested gating doesn't actually distinguish test from non-test invocations. Instead: keep building when the target is available, but on failure emit a cargo:warning and set TEST_PLUGIN_WASM= (empty). Tests that need the fixture will surface a clearer error at test time; cargo install and cargo build succeed cleanly on toolchains without wasm32-wasip2 (e.g. the Homebrew Rust at Homebrew/homebrew-core#280458).

… missing

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@SAY-5 SAY-5 requested a review from a team as a code owner May 2, 2026 18:36
@cla-idx-bot
Copy link
Copy Markdown

cla-idx-bot Bot commented May 2, 2026

Dear @SAY-5,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA.

If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged.

— The DFINITY Foundation

@cla-idx-bot cla-idx-bot Bot mentioned this pull request May 2, 2026
@lwshang
Copy link
Copy Markdown
Contributor

lwshang commented May 2, 2026

Thank you @SAY-5 for the fix and the thorough analysis — we really appreciate it!

We landed on a similar approach in #544, which was just merged. Closing this to avoid a double-merge. Thanks again!

@lwshang lwshang closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build.rs: skip wasm32-wasip2 test fixture build for non-test builds

2 participants