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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-wasi
target: wasm32-wasip1

- name: Check Rust Version
run: rustc --version
Expand Down
2 changes: 1 addition & 1 deletion bindgen-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ case $1 in
echo "building '$PLUGIN_NAME'..."
xtp plugin build --path $PLUGIN_NAME
echo "testing '$PLUGIN_NAME'..."
xtp plugin test $PLUGIN_NAME/target/wasm32-wasi/release/plugin.wasm --with test.wasm --mock-host mock.wasm
xtp plugin test $PLUGIN_NAME/target/wasm32-wasip1/release/plugin.wasm --with test.wasm --mock-host mock.wasm
;;
esac
2 changes: 1 addition & 1 deletion template/.cargo/config.toml.ejs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
target = "wasm32-wasi"
target = "wasm32-wasip1"
20 changes: 19 additions & 1 deletion template/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ if ! (command_exists cargo); then
echo ""
fi

if ! (command_exists rustup); then
missing_deps=1
echo "❌ rustup is missing. Check your rust installation."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: not a blocker, but we should come back and add some links here about how to install rustup.

echo ""
fi

# Exit with a bad exit code if any dependencies are missing
if [ "$missing_deps" -ne 0 ]; then
echo "Install the missing dependencies and ensure they are on your path. Then run this command again."
Expand All @@ -36,5 +42,17 @@ if [ "$missing_deps" -ne 0 ]; then
exit 1
fi

if ! (rustup target list --installed | grep -q '^wasm32-wasip1$'); then
if ! (rustup target add wasm32-wasip1); then
echo "❌ error encountered while adding target \"wasm32-wasip1\""
echo ""
echo "Update rustup with:"
echo "👉 rustup update"
echo ""
exit 1
fi
fi


if ! (rustup target list --installed | grep -q '^wasm32-unknown-unknown$'); then
rustup target add wasm32-unknown-unknown
fi
4 changes: 2 additions & 2 deletions template/xtp.toml.ejs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
app_id = "<%= project.appId %>"

# This is where 'xtp plugin push' expects to find the wasm file after the build script has run.
bin = "target/wasm32-wasi/release/plugin.wasm"
bin = "target/wasm32-wasip1/release/plugin.wasm"
extension_point_id = "<%= project.extensionPointId %>"
# This is the 'binding' name used for the plugin.
name = "<%= project.name %>"

[scripts]
# xtp plugin build runs this script to generate the wasm file
build = "cargo build --release --target wasm32-wasi"
build = "cargo build --release --target wasm32-wasip1"

# xtp plugin init runs this script to format the code
format = "cargo fmt"
Expand Down
Loading