Skip to content

Commit

Permalink
feat: add support for wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonbrad committed Oct 30, 2023
1 parent bf89337 commit 45076e6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion engine/translator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -14,6 +14,7 @@ authors = ["Brady Fomegne <[email protected]>"]
[features]
default = ["rhai", "strsim"]
rhai = ["dep:rhai"]
rhai-wasm = ["rhai", "rhai/wasm-bindgen", "rhai/internals", "rhai/only_i32"]
strsim = ["dep:strsim"]

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions engine/translator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 45076e6

Please sign in to comment.