-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_wasm_for_wasi.ps1
32 lines (25 loc) · 1.29 KB
/
build_wasm_for_wasi.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Remove-Item pkg_wasi/* -ea stop
cargo build --features="wasi,utils,unstable,bin-features" --target wasm32-wasi --release --out-dir pkg_wasi -Z unstable-options
remove-item pkg_wasi/*.rlib -ea stop
if($null -eq (test-path .\pkg_wasi\marlowe_lang_cli.wasm)) {
throw "marlowe_lang_cli.wasm was not correctly built"
}
if($null -eq (test-path .\pkg_wasi\marlowe_lang.wasm)) {
throw "marlowe_lang.wasm was not correctly built"
}
write-host -ForegroundColor Green "Successfully built crate for wasi wasm @ pkg_wasi"
# you can try calling these files using wasmtime , wasmer or any other runtime
# For installing wasmer:
# linux: curl https://get.wasmer.io -sSfL | sh
# windows: iwr https://win.wasmer.io -useb | iex
# Calling an exposed method in the library using wasmtime
# wasmtime --invoke foo \pkg_wasi\marlowe_lang_cli.wasm --wasm-features all
# Calling the cli using wasmtime
# wasmtime .\pkg_wasi\marlowe_lang_cli.wasm
# Calling the cli using wasmer
# wasmer run .\pkg_wasi\marlowe_lang_cli.wasm
# wasmer run .\pkg_wasi\marlowe_lang_cli.wasm contract from-string Close marlowe-dsl json
# Calling an exposed lib method using wasmer
# wasmer run .\pkg_wasi\marlowe_lang_cli.wasm --invoke foo
# Listing the exported functions in a wasm file using wasmer:
# wasmer inspect .\pkg_wasi\marlowe_lang_cli.wasm