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
- run: |
choco install -qy llvm
cargo build --all-features --release
cargo build --features tolk --features tts/tolk --release
move target windows
- uses: actions/upload-artifact@v1
with:

View File

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

View File

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