Skip to content

Commit 9211bd7

Browse files
L-jasminejprendesapepkuss
authored
Refactor RustSDK (#83)
* [Refactor] Add #[form] for subtypes of WasmEdgeError. Signed-off-by: csh <[email protected]> * [Refactor] fix memory leak Signed-off-by: csh <[email protected]> * [Fix] Avoid the CPU 100% by tokio-wasi. Signed-off-by: csh <[email protected]> * [Fix] Fix blocking during tokio-wasi TCP connect. Signed-off-by: csh <[email protected]> * [Fix] async-wasi get envs & args Signed-off-by: csh <[email protected]> * [Perf] Optimize the wasi-ctx Signed-off-by: csh <[email protected]> * [Chore] Temporarily disable the serialize feature. Signed-off-by: csh <[email protected]> * [feat] virtual file system Signed-off-by: csh <[email protected]> * [Refactor] update the argument type of `run_func_with_timeout` and `run_func_async_with_timeout` (#76) * [Feat] run func timeout use std::time::Duration Signed-off-by: csh <[email protected]> * [Doc]: update api docs Signed-off-by: csh <[email protected]> --------- Signed-off-by: csh <[email protected]> (cherry picked from commit 07e84b7) Signed-off-by: csh <[email protected]> * [Refactor] delete useless code from validator Signed-off-by: csh <[email protected]> * [Refactor] To pass the clippy Signed-off-by: csh <[email protected]> * Disable timeout in musl libc (#71) Signed-off-by: Jorge Prendes <[email protected]> Signed-off-by: csh <[email protected]> * Disable timeout in musl libc Signed-off-by: csh <[email protected]> * [Doc] update doc Signed-off-by: csh <[email protected]> * [Fix] fix ffi::WasmEdge_String to String Signed-off-by: csh <[email protected]> * [Fix] Fix unit test Signed-off-by: csh <[email protected]> * [Fix] Modify the `WasiModule`. Signed-off-by: csh <[email protected]> * [refactor] Introduce `WasmEdge_FunctionInstanceGetData` to drop host data (#84) * feat(rust-sys): drop host_data in `Function::drop` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update `drop` of `ImportModule` and `Function` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update test code Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update `drop` of `ImportModule` and `Function` Signed-off-by: Xin Liu <[email protected]> * refactor(rust-sys): update `ImportModule::drop` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): remove debug code Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): remove debug code Signed-off-by: Xin Liu <[email protected]> * version(rust-sdk): bump to `0.13.0` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): supress clippy warning Signed-off-by: Xin Liu <[email protected]> * ci(ci-build): update rust version Signed-off-by: Xin Liu <[email protected]> * ci(standalone): update rust version Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update rustdoc Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update rustdoc and `README` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update dependencies Signed-off-by: Xin Liu <[email protected]> * ci: update to `macos-13` Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * doc: update `CHANGELOG` (#85) Signed-off-by: Xin Liu <[email protected]> * [Chore] Update build script (#86) * chore(rust-sys): update build script Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update build script Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * [Fix] Fix sys test Signed-off-by: csh <[email protected]> * Relax the version of `wat` dep (#90) * chore(rust-sdk): update `wat` dep Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update test code Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update test code Signed-off-by: Xin Liu <[email protected]> * version(rust-sys): bump to `0.17.4` Signed-off-by: Xin Liu <[email protected]> * version(rust-sdk): bump to `0.13.1` Signed-off-by: Xin Liu <[email protected]> * doc: update `CHANGELOG` Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * [CI] skip test_vmbuilder on fedora Signed-off-by: csh <[email protected]> * Fix static build to link agains zstd (#91) Signed-off-by: Jorge Prendes <[email protected]> * Update doc for releasing `v0.13.2` (#93) * ci: update workflows Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update versioning table Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update versioning table Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): fix typo Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update rustdoc Signed-off-by: Xin Liu <[email protected]> * version(rust-sdk): bump to `0.13.2` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update versioning table Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * [Version] Bump `wasmedge-sys` to `v0.17.5` (#94) * version(rust-sys): bump to `0.17.5` Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update versioning table Signed-off-by: Xin Liu <[email protected]> * chore(rust-sys): update dependency Signed-off-by: Xin Liu <[email protected]> * chore(rust-sdk): update versioning table Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * doc: update `CHANGELOG` (#95) Signed-off-by: Xin Liu <[email protected]> * [CI] Update `rust-static-lib` workflow (#96) * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): update workflow Signed-off-by: Xin Liu <[email protected]> * ci(rust-static-lib): remove `libboost-all-dev` dep Signed-off-by: Xin Liu <[email protected]> --------- Signed-off-by: Xin Liu <[email protected]> * [Fix] Temporary FuncRef extraction implementation. Signed-off-by: csh <[email protected]> * [CI] fix test wat Signed-off-by: csh <[email protected]> --------- Signed-off-by: csh <[email protected]> Signed-off-by: Jorge Prendes <[email protected]> Signed-off-by: Xin Liu <[email protected]> Co-authored-by: Jorge Prendes <[email protected]> Co-authored-by: Xin Liu <[email protected]>
1 parent 3146e89 commit 9211bd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4177
-11021
lines changed

.github/workflows/ci-build.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ on:
99
paths-ignore:
1010
- "**/*.md"
1111
- ".github/workflows/standalone.yml"
12+
- ".github/workflows/rust-static-lib.yml"
1213
pull_request:
1314
paths-ignore:
1415
- "**/*.md"
1516
- ".github/workflows/standalone.yml"
17+
- ".github/workflows/rust-static-lib.yml"
1618

1719
jobs:
1820
build_ubuntu:
@@ -21,7 +23,7 @@ jobs:
2123
strategy:
2224
matrix:
2325
os: [ubuntu-22.04, ubuntu-20.04]
24-
rust: [1.72, 1.71, 1.70.0]
26+
rust: [1.73, 1.72, 1.71]
2527
container:
2628
image: wasmedge/wasmedge:ubuntu-build-clang
2729

@@ -90,7 +92,7 @@ jobs:
9092
runs-on: ubuntu-latest
9193
strategy:
9294
matrix:
93-
rust: [1.72, 1.71, 1.70.0]
95+
rust: [1.73, 1.72, 1.71]
9496
container:
9597
image: fedora:latest
9698

@@ -159,15 +161,15 @@ jobs:
159161
export WASMEDGE_BUILD_DIR="$(pwd)/WasmEdge/build"
160162
export WASMEDGE_PLUGIN_PATH="$(pwd)/WasmEdge/build/plugins/wasmedge_process"
161163
export LD_LIBRARY_PATH="$(pwd)/WasmEdge/build/lib/api"
162-
cargo test --workspace --locked --features aot,async,wasmedge_process,ffi -- --nocapture --test-threads=1
164+
cargo test --workspace --locked --features aot,async,wasmedge_process,ffi -- --nocapture --test-threads=1 --skip test_vmbuilder
163165
164166
build_macos:
165167
name: MacOS
166168
runs-on: ${{ matrix.os }}
167169
strategy:
168170
matrix:
169-
os: [macos-11, macos-12]
170-
rust: [1.72, 1.71, 1.70.0]
171+
os: [macos-12, macos-13]
172+
rust: [1.73, 1.72, 1.71]
171173

172174
steps:
173175
- name: Checkout sources
@@ -222,7 +224,7 @@ jobs:
222224
runs-on: windows-2022
223225
strategy:
224226
matrix:
225-
rust: [1.72, 1.71, 1.70.0]
227+
rust: [1.73, 1.72, 1.71]
226228
env:
227229
WASMEDGE_DIR: ${{ github.workspace }}\WasmEdge
228230
WASMEDGE_BUILD_DIR: ${{ github.workspace }}\WasmEdge\build

.github/workflows/rust-static-lib.yml

+20-46
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,15 @@ concurrency:
66

77
on:
88
push:
9-
branches:
10-
- master
11-
- "rust/*"
12-
paths:
13-
- ".github/workflows/rust-static-lib.yml"
14-
- "bindings/rust/**"
15-
- "include/api/wasmedge/**"
16-
- "lib/api/**"
9+
paths-ignore:
10+
- "**/*.md"
11+
- ".github/workflows/standalone.yml"
12+
- ".github/workflows/ci-build.yml"
1713
pull_request:
18-
branches:
19-
- master
20-
paths:
21-
- ".github/workflows/rust-static-lib.yml"
22-
- "bindings/rust/**"
23-
- "include/api/wasmedge/**"
24-
- "lib/api/**"
14+
paths-ignore:
15+
- "**/*.md"
16+
- ".github/workflows/standalone.yml"
17+
- ".github/workflows/ci-build.yml"
2518

2619
jobs:
2720
build_ubuntu:
@@ -30,49 +23,30 @@ jobs:
3023
strategy:
3124
matrix:
3225
os: [ubuntu-22.04]
33-
rust: [1.69, 1.68]
26+
rust: [1.73, 1.72, 1.71]
3427
container:
35-
image: wasmedge/wasmedge:latest
28+
image: wasmedge/wasmedge:ubuntu-build-clang
3629

3730
steps:
38-
- uses: actions/checkout@v3
31+
- name: Checkout WasmEdge Rust SDK
32+
uses: actions/checkout@v3
3933
with:
4034
fetch-depth: 0
4135

42-
- name: Build WasmEdge with Release mode
36+
- name: Install dependencies
4337
run: |
4438
apt update
45-
apt install -y software-properties-common libboost-all-dev llvm-15-dev liblld-15-dev ninja-build
46-
cmake cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_LINK_LLVM_STATIC=ON -DWASMEDGE_BUILD_SHARED_LIB=OFF -DWASMEDGE_BUILD_STATIC_LIB=ON -DWASMEDGE_LINK_TOOLS_STATIC=ON -DWASMEDGE_BUILD_PLUGINS=OFF .
47-
cmake --build build
48-
49-
- name: Install Rust-nightly
50-
uses: dtolnay/rust-toolchain@nightly
51-
with:
52-
components: rustfmt, clippy
53-
54-
- name: Rustfmt
55-
working-directory: bindings/rust/
56-
run: cargo +nightly fmt --all -- --check
57-
58-
- name: Clippy
59-
working-directory: bindings/rust/
60-
run: |
61-
export WASMEDGE_DIR="$(pwd)/../../"
62-
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
63-
cargo +nightly clippy -V
64-
cargo +nightly clippy --lib --examples --features static -- -D warnings
39+
apt install -y software-properties-common llvm-15-dev liblld-15-dev ninja-build
6540
6641
- name: Install Rust-stable
6742
uses: dtolnay/rust-toolchain@stable
6843
with:
6944
toolchain: ${{ matrix.rust }}
7045

71-
- name: Test Rust Bindings
72-
working-directory: bindings/rust/
46+
- name: Test Rust SDK
47+
run: |
48+
cargo test -p wasmedge-sdk --all --examples --features static,aot,wasmedge_process,ffi -- --nocapture --test-threads=1
49+
50+
- name: Test Rust SDK with async feature
7351
run: |
74-
export WASMEDGE_DIR="$(pwd)/../../"
75-
export WASMEDGE_BUILD_DIR="$(pwd)/../../build"
76-
cargo +nightly -Z sparse-registry update
77-
cargo test --workspace --features static --locked -- --test-threads=1
78-
cargo test --examples --features static --locked -- --test-threads=1
52+
cargo test -p wasmedge-sdk --all --examples --features static,aot,async,wasmedge_process,ffi -- --nocapture --test-threads=1

.github/workflows/standalone.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ on:
99
paths-ignore:
1010
- "**/*.md"
1111
- ".github/workflows/ci-build.yml"
12+
- ".github/workflows/rust-static-lib.yml"
1213

1314
pull_request:
1415
paths-ignore:
1516
- "**/*.md"
1617
- ".github/workflows/ci-build.yml"
18+
- ".github/workflows/rust-static-lib.yml"
1719

1820
jobs:
1921
build_ubuntu_2204:
2022
name: Ubuntu
2123
runs-on: ubuntu-22.04
2224
strategy:
2325
matrix:
24-
rust: [1.72, 1.71, 1.70.0]
26+
rust: [1.73, 1.72, 1.71]
2527

2628
steps:
2729
- name: Checkout WasmEdge Rust SDK
@@ -55,7 +57,7 @@ jobs:
5557
runs-on: ubuntu-20.04
5658
strategy:
5759
matrix:
58-
rust: [1.72, 1.71, 1.70.0]
60+
rust: [1.73, 1.72, 1.71]
5961

6062
steps:
6163
- name: Checkout WasmEdge Rust SDK
@@ -89,8 +91,8 @@ jobs:
8991
runs-on: ${{ matrix.os }}
9092
strategy:
9193
matrix:
92-
os: [macos-11, macos-12]
93-
rust: [1.72, 1.71, 1.70.0]
94+
os: [macos-12, macos-13]
95+
rust: [1.73, 1.72, 1.71]
9496

9597
steps:
9698
- name: Checkout sources
@@ -119,7 +121,7 @@ jobs:
119121
runs-on: ubuntu-latest
120122
strategy:
121123
matrix:
122-
rust: [1.72, 1.71, 1.70.0]
124+
rust: [1.73, 1.72, 1.71]
123125
container:
124126
image: fedora:latest
125127

CHANGELOG.md

+39
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.13.2] - 2023-11-15
6+
7+
### 🐛 Bug Fixes
8+
9+
- Fix the static build to link against `zstd` ([#91](https://github.com/orhun/git-cliff/issues/91))
10+
11+
## [0.13.1] - 2023-11-14
12+
13+
- Update the `wat` dep. This update is to fix [#88](https://github.com/WasmEdge/wasmedge-rust-sdk/issues/88).
14+
15+
## [0.13.0] - 2023-11-07
16+
17+
### ⛰️ Features
18+
19+
- New API `PluginManager::nn_preload`. This API is used to initialize the `wasi_nn` plug-in with given preloads ([#74](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/74))
20+
21+
- Implement `FromStr` trait for `NNPreload` struct ([#81](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/81))
22+
23+
### 🚜 Refactor
24+
25+
- [BREAKING] Update the argument types ([#82](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/82)):
26+
- `VmBuilder::with_plugin`
27+
- `VmBuilder::with_plugin_wasi_nn`
28+
- `VmBuilder::with_plugin_wasi_crypto`
29+
- `VmBuilder::with_plugin_wasmedge_process`
30+
31+
- [BREAKING] Update the argument types ([#76](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/76)):
32+
- `Executor::run_func_with_timeout` and `Executor::run_func_async_with_timeout`
33+
- `Vm::run_func_with_timeout` and `Vm::run_func_async_with_timeout`
34+
- `Func::run_with_timeout` and `Func::run_async_with_timeout`
35+
36+
### 🐛 Bug Fixes
37+
38+
- Introduce new C-API `WasmEdge_FunctionInstanceGetData` to fix the memory leak issue caused by host data ([#84](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/84))
39+
40+
### Ci
41+
42+
- Support `macos-13` and remove `macos-11` from the `ci-build` and `standalone` workflows ([#84](https://github.com/WasmEdge/wasmedge-rust-sdk/pull/84))
43+
544
## [0.12.2] - 2023-09-22
645

746
### 🚜 Refactor

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "Apache-2.0"
88
name = "wasmedge-sdk"
99
readme = "README.md"
1010
repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
11-
version = "0.12.3-dev"
11+
version = "0.13.2"
1212

1313
[dependencies]
1414
anyhow = "1.0"
@@ -17,7 +17,7 @@ num-derive = "0.3"
1717
num-traits = "0.2"
1818
thiserror = "1.0.30"
1919
wasmedge-macro.workspace = true
20-
wasmedge-sys = { path = "crates/wasmedge-sys", version = "0.17", default-features = false }
20+
wasmedge-sys = { path = "crates/wasmedge-sys", version = "0.17.5", default-features = false }
2121
wasmedge-types.workspace = true
2222

2323
[workspace.dependencies]
@@ -26,15 +26,15 @@ cfg-if = "1.0.0"
2626
parking_lot = "0.12.1"
2727
wasmedge-macro = { path = "crates/wasmedge-macro", version = "0.6" }
2828
wasmedge-types = { path = "crates/wasmedge-types", version = "0.4" }
29-
wat = "=1.0.67"
29+
wat = "1.0"
3030

3131
[target.'cfg(target_os = "linux")'.dependencies]
3232
async-wasi = { workspace = true, optional = true }
3333

3434
[features]
3535
aot = ["wasmedge-sys/aot"]
3636
async = ["wasmedge-sys/async", "dep:async-wasi"]
37-
default = []
37+
default = ["async"]
3838
ffi = ["wasmedge-sys/ffi"]
3939
standalone = ["wasmedge-sys/standalone"]
4040
static = ["wasmedge-sys/static"]

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ This crate depends on the WasmEdge C API. In linux/macOS the crate can download
1616

1717
| wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
1818
| :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
19+
| 0.13.2 | 0.13.5 | 0.17.5 | 0.4.4 | 0.6.1 | 0.1.0 |
20+
| 0.13.1 | 0.13.5 | 0.17.4 | 0.4.4 | 0.6.1 | 0.1.0 |
21+
| 0.13.0 | 0.13.5 | 0.17.3 | 0.4.4 | 0.6.1 | 0.1.0 |
1922
| 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
2023
| 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
2124
| 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
@@ -58,7 +61,7 @@ The following architectures are supported for automatic downloads:
5861

5962
This crate uses `rust-bindgen` during the build process. If you would like to use an external `rust-bindgen` you can set the `WASMEDGE_RUST_BINDGEN_PATH` environment variable to the `bindgen` executable path. This is particularly useful in systems like Alpine Linux (see [rust-lang/rust-bindgen#2360](https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595869379), [rust-lang/rust-bindgen#2333](https://github.com/rust-lang/rust-bindgen/issues/2333)).
6063

61-
**Notice:** The minimum supported Rust version is 1.70.
64+
**Notice:** The minimum supported Rust version is 1.71.
6265

6366
## API Reference
6467

crates/async-wasi/Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ version = "0.1.0"
1212
[dependencies]
1313
bitflags = "2.0.2"
1414
cfg-if = "1.0.0"
15-
futures = {version = "0.3"}
15+
futures = { version = "0.3" }
1616
getrandom = "0.2"
1717
libc = "0.2"
1818
path-absolutize = "3.0.13"
19-
serde = {version = "1", features = ["derive"], optional = true}
20-
socket2 = {version = "^0.4.9", features = ["all"]}
21-
tokio = {version = "1", features = ["full"], optional = true}
19+
serde = { version = "1", features = ["derive"] }
20+
socket2 = { version = "^0.4.9", features = ["all"] }
21+
tokio = { version = "1", features = ["full"], optional = true }
2222
parking_lot.workspace = true
2323

2424
[dev-dependencies]
25-
serde_json = {version = "1"}
25+
serde_json = { version = "1" }
2626

2727
[features]
2828
async_tokio = ["tokio"]
29-
default = ["async_tokio", "serialize"]
30-
serialize = ["serde"]
29+
default = ["async_tokio"]
30+
serialize = []

0 commit comments

Comments
 (0)