Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rustdocs #55

Merged
merged 17 commits into from
Aug 17, 2023
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
55 changes: 55 additions & 0 deletions .github/workflows/release-async-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: wasmedge-sdk-release

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
wasmedge_version:
description: "Version of WasmEdge"
required: true
type: string

jobs:
release_wasmedge_sdk:
name: Release wasmedge-sdk crate
runs-on: ubuntu-22.04
container:
image: wasmedge/wasmedge:ubuntu-build-clang

steps:
- name: Checkout WasmEdge Rust SDK
uses: actions/checkout@v3
with:
fetch-depth: 0
path: wasmedge-rust-sdk

- name: Set up build environment
run: |
apt update
apt install -y software-properties-common libboost-all-dev ninja-build
apt install -y llvm-15-dev liblld-15-dev

- name: Install WasmEdge
run: |
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v ${{ inputs.wasmedge_version }} -p /usr/local
ldconfig

- name: Install Rust-nightly
uses: dtolnay/rust-toolchain@nightly

- name: Build Async API document
working-directory: wasmedge-rust-sdk
run: |
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -p wasmedge-sdk --workspace --no-deps --features aot,async,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target

- name: Deploy Async API document
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: wasmedge-rust-sdk/target/doc
force_orphan: true
4 changes: 2 additions & 2 deletions .github/workflows/release-wasmedge-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Build API document
working-directory: wasmedge-rust-sdk
run: |
cargo doc -p wasmedge-sdk --workspace --no-deps --features aot,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -p wasmedge-sdk --workspace --no-deps --features aot,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target

- name: Deploy API document
if: github.ref == 'refs/heads/main'
Expand All @@ -80,7 +80,7 @@ jobs:
# - name: Build Async API document
# working-directory: wasmedge-rust-sdk
# run: |
# cargo doc -p wasmedge-sdk --workspace --no-deps --features aot,async,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target/async-wasmedge
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -p wasmedge-sdk --workspace --no-deps --features aot,async,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target/async-wasmedge

# - name: Deploy Async API document
# if: github.ref == 'refs/heads/main'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-wasmedge-sys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Build API document
working-directory: wasmedge-rust-sdk
run: |
cargo doc -p wasmedge-sys --workspace --no-deps --features aot,async,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc -p wasmedge-sys --workspace --no-deps --features aot,wasi_crypto,wasi_nn,wasmedge_process,ffi --target-dir=./target

- name: Deploy API document
if: github.ref == 'refs/heads/main'
Expand Down
25 changes: 17 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude = ["examples/"]
license = "Apache-2.0"
name = "wasmedge-sdk"
readme = "README.md"
repository = "https://github.com/WasmEdge/WasmEdge/blob/master/bindings/rust/wasmedge-sdk"
repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
version = "0.12.0-dev"

[dependencies]
Expand All @@ -17,19 +17,19 @@ num-derive = "0.3"
num-traits = "0.2"
thiserror = "1.0.30"
wasmedge-macro.workspace = true
wasmedge-sys = {path = "crates/wasmedge-sys", version = "0.17", default-features = false}
wasmedge-sys = { path = "crates/wasmedge-sys", version = "0.17", default-features = false }
wasmedge-types.workspace = true

[workspace.dependencies]
async-wasi = {path = "crates/async-wasi", version = "0.1"}
async-wasi = { path = "crates/async-wasi", version = "0.1" }
cfg-if = "1.0.0"
parking_lot = "0.12.1"
wasmedge-macro = {path = "crates/wasmedge-macro", version = "0.6"}
wasmedge-types = {path = "crates/wasmedge-types", version = "0.4"}
wasmedge-macro = { path = "crates/wasmedge-macro", version = "0.6" }
wasmedge-types = { path = "crates/wasmedge-types", version = "0.4" }
wat = "=1.0.67"

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

[features]
aot = ["wasmedge-sys/aot"]
Expand All @@ -43,7 +43,16 @@ wasi_nn = ["wasmedge-sys/wasi_nn"]
wasmedge_process = ["wasmedge-sys/wasmedge_process"]

[dev-dependencies]
tokio = {version = "1", features = ["full"]}
tokio = { version = "1", features = ["full"] }

[package.metadata.docs.rs]
features = ["aot", "wasi_crypto", "wasi_nn", "wasmedge_process", "ffi"]
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
members = ["crates/wasmedge-sys", "crates/wasmedge-types", "crates/wasmedge-macro", "crates/async-wasi"]
members = [
"crates/wasmedge-sys",
"crates/wasmedge-types",
"crates/wasmedge-macro",
"crates/async-wasi",
]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ WasmEdge Rust SDK will search for the WasmEdge library in the following paths in
- `$HOME/.local`

When the `standalone` feature is enabled the correct library will be downloaded during build time and the previous locations are ignored. You can specify a proxy for the download process using the `WASMEDGE_STANDALONE_PROXY`, `WASMEDGE_STANDALONE_PROXY_USER` and `WASMEDGE_STANDALONE_PROXY_PASS` environment variables. You can set the `WASMEDGE_STANDALONE_ARCHIVE` environment variable to use a local archive instead of downloading one.

The following architectures are supported for automatic downloads:

| os | libc | architecture | linking type |
| :---: | :-----: | :-----------------: | :-------------: |
| macos | | `x86_64`, `aarch64` | dynamic |
| macos | - | `x86_64`, `aarch64` | dynamic |
| linux | `glibc` | `x86_64`, `aarch64` | static, dynamic |
| linux | `musl` | `x86_64`, `aarch64` | static |

Expand Down
17 changes: 12 additions & 5 deletions crates/wasmedge-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
version = "0.17.0"

[dependencies]
fiber-for-wasmedge = {version = "8.0.1", optional = true}
fiber-for-wasmedge = { version = "8.0.1", optional = true }
libc = "0.2.94"
paste = "1.0.5"
scoped-tls = "1"
Expand All @@ -27,12 +27,15 @@ rand = "0.8.4"
cfg-if.workspace = true

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

[build-dependencies]
bindgen = {version = "0.65", default-features = false, features = ["runtime"]}
bindgen = { version = "0.65", default-features = false, features = ["runtime"] }
cmake = "0.1"
reqwest = { version = "0.11", default-features = false, features = ["blocking", "rustls-tls"] }
reqwest = { version = "0.11", default-features = false, features = [
"blocking",
"rustls-tls",
] }
flate2 = "1"
tar = "0.4"
sha256 = "1"
Expand All @@ -41,7 +44,11 @@ phf = { version = "0.11", features = ["macros"] }

[dev-dependencies]
anyhow = "1"
tokio = {version = "1", features = ["full"]}
tokio = { version = "1", features = ["full"] }

[package.metadata.docs.rs]
features = ["aot", "wasi_crypto", "wasi_nn", "wasmedge_process", "ffi"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
aot = []
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmedge-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crate defines a group

For developers, it is recommended that the APIs in `wasmedge-sys` are used to construct high-level libraries, while `wasmedge-sdk` is for building up business applications.

* Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.68 or above** in the **stable** channel.
* Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.69 or above** in the **stable** channel.

## Build

Expand Down
3 changes: 3 additions & 0 deletions crates/wasmedge-sys/src/ast_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl Module {

/// Provides a raw pointer to the inner ASTModule context.
#[cfg(feature = "ffi")]
#[cfg_attr(docsrs, doc(cfg(feature = "ffi")))]
pub fn as_ptr(&self) -> *const ffi::WasmEdge_FunctionTypeContext {
self.inner.0 as *const _
}
Expand Down Expand Up @@ -244,6 +245,7 @@ impl<'module> ImportType<'module> {

/// Provides a raw pointer to the inner ImportType context.
#[cfg(feature = "ffi")]
#[cfg_attr(docsrs, doc(cfg(feature = "ffi")))]
pub fn as_ptr(&self) -> *const ffi::WasmEdge_ImportTypeContext {
self.inner.0 as *const _
}
Expand Down Expand Up @@ -401,6 +403,7 @@ impl<'module> ExportType<'module> {

/// Provides a raw pointer to the inner ExportType context.
#[cfg(feature = "ffi")]
#[cfg_attr(docsrs, doc(cfg(feature = "ffi")))]
pub fn as_ptr(&self) -> *const ffi::WasmEdge_ExportTypeContext {
self.inner.0 as *const _
}
Expand Down
2 changes: 2 additions & 0 deletions crates/wasmedge-sys/src/async/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Defines `async` related types.

pub mod fiber;
pub(crate) mod function;
pub mod module;
Expand Down
Loading