diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 215fbb1..df54321 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -45,13 +45,13 @@ jobs: - name: build env: RUSTFLAGS: -Cinstrument-coverage - run: cargo build --all-features --verbose + run: cargo build --features inhibit --verbose - name: test env: RUSTFLAGS: -Cinstrument-coverage LLVM_PROFILE_FILE: name-%p-%m.profraw - run: cargo test --all-features --verbose + run: cargo test --verbose - name: Run grcov run: | diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d3eb0b9..c591141 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -46,12 +46,17 @@ jobs: cargo fmt -- --check - name: Clippy - run: cargo clippy --all-features --all-targets -- -D warnings + run: cargo clippy --all-targets -- -D warnings - name: Build - run: cargo build --all-features --verbose + run: cargo build --verbose - name: Run tests run: | - cargo test --all-features --lib --bins --tests --verbose ${{matrix.extra}} + cargo test --lib --bins --tests --verbose ${{matrix.extra}} cargo test --benches ${{matrix.extra}} + + - name: Check compatibility with Wasm + run: | + rustup target add wasm32-unknown-unknown + cargo build -p afrim-translator -p afrim-preprocessor --target wasm32-unknown-unknown --all-features diff --git a/engine/translator/Cargo.toml b/engine/translator/Cargo.toml index a10b1e0..e078dbc 100644 --- a/engine/translator/Cargo.toml +++ b/engine/translator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "afrim-translator" -version = "0.0.2" +version = "0.1.0" edition = "2021" description = "Manage the predication system of the afrim input method." keywords = ["auto-complete", "ime", "predication"] @@ -14,6 +14,7 @@ authors = ["Brady Fomegne "] [features] default = ["rhai", "strsim"] rhai = ["dep:rhai"] +rhai-wasm = ["rhai", "rhai/wasm-bindgen", "rhai/internals", "rhai/only_i32"] strsim = ["dep:strsim"] [dependencies] diff --git a/engine/translator/README.md b/engine/translator/README.md index 71c774c..1e20685 100644 --- a/engine/translator/README.md +++ b/engine/translator/README.md @@ -3,4 +3,5 @@ Handle the predication system for an input method. ### Features - rhai: Enable the usage of the rhai scripting language. +- rhai-wasm: Like rai, but wasm compatible. - strsim: Enable the text similarity algorithm. diff --git a/service/Cargo.toml b/service/Cargo.toml index 63cb55a..8fc0640 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -27,7 +27,7 @@ clap = { version = "4.4.6", features = ["derive"] } enigo = "0.1.3" afrim-config = { version = "0.4.1", path = "../config", default-features = false } afrim-preprocessor = { version = "0.5.0", path = "../engine/preprocessor", default-features = false } -afrim-translator = { version = "0.0.2", path = "../engine/translator", default-features = false } +afrim-translator = { version = "0.1.0", path = "../engine/translator", default-features = false } rdev = "0.5.3" [dev-dependencies]