Refactor to tolk feature.

This commit is contained in:
Nolan Darilek 2021-01-21 11:26:59 -06:00
parent 5c1cf59d98
commit b43b4fe19b
3 changed files with 4 additions and 8 deletions

View File

@ -32,7 +32,7 @@ jobs:
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- run: | - run: |
choco install -qy llvm choco install -qy llvm
cargo build --all-features --release cargo build --features tolk --features tts/tolk --release
move target windows move target windows
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:

View File

@ -7,14 +7,10 @@ edition = "2018"
[lib] [lib]
crate-type = ["staticlib", "cdylib"] crate-type = ["staticlib", "cdylib"]
[features]
use_tolk = ["tolk", "tts/use_tolk"]
[dependencies] [dependencies]
env_logger = "0.8" env_logger = "0.8"
gdnative = "0.9" gdnative = "0.9"
tts = "0.13" tts = "0.14"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
tolk = { version = "0.3", optional = true } tolk = { version = "0.3", optional = true }

View File

@ -127,13 +127,13 @@ impl TTS {
.done(); .done();
builder builder
.add_property("can_detect_screen_reader") .add_property("can_detect_screen_reader")
.with_getter(|_: &TTS, _| cfg!(all(windows, features = "use_tolk"))) .with_getter(|_: &TTS, _| cfg!(all(windows, features = "tolk")))
.done(); .done();
#[allow(unreachable_code)] #[allow(unreachable_code)]
builder builder
.add_property("has_screen_reader") .add_property("has_screen_reader")
.with_getter(|_: &TTS, _| { .with_getter(|_: &TTS, _| {
#[cfg(all(windows, features = "use_tolk"))] #[cfg(all(windows, features = "tolk"))]
{ {
let tolk = tolk::Tolk::new(); let tolk = tolk::Tolk::new();
return tolk.detect_screen_reader().is_some(); return tolk.detect_screen_reader().is_some();