diff --git a/matrix_sdk_base/Cargo.toml b/matrix_sdk_base/Cargo.toml index 972aa310..54a35f34 100644 --- a/matrix_sdk_base/Cargo.toml +++ b/matrix_sdk_base/Cargo.toml @@ -54,17 +54,15 @@ features = ["sync", "fs"] [dev-dependencies] matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" } http = "0.2.3" -tracing-subscriber = "0.2.15" + +[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] +tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] } tempfile = "3.2.0" -mockito = "0.29.0" rustyline = "7.1.0" rustyline-derive = "0.4.0" atty = "0.2.14" clap = "2.33.3" syntect = "4.5.0" -[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -tokio = { version = "1.1.0", default-features = false, features = ["rt-multi-thread", "macros"] } - [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3.19" diff --git a/matrix_sdk_base/examples/state_inspector.rs b/matrix_sdk_base/examples/state_inspector.rs index 9b3ba08c..9c358283 100644 --- a/matrix_sdk_base/examples/state_inspector.rs +++ b/matrix_sdk_base/examples/state_inspector.rs @@ -3,8 +3,11 @@ use std::{convert::TryFrom, fmt::Debug, sync::Arc}; use futures::executor::block_on; use serde::Serialize; +#[cfg(not(target_arch = "wasm32"))] use atty::Stream; +#[cfg(not(target_arch = "wasm32"))] use clap::{App as Argparse, AppSettings as ArgParseSettings, Arg, ArgMatches, SubCommand}; +#[cfg(not(target_arch = "wasm32"))] use rustyline::{ completion::{Completer, Pair}, error::ReadlineError, @@ -13,8 +16,10 @@ use rustyline::{ validate::{MatchingBracketValidator, Validator}, CompletionType, Config, Context, EditMode, Editor, OutputStreamType, }; +#[cfg(not(target_arch = "wasm32"))] use rustyline_derive::Helper; +#[cfg(not(target_arch = "wasm32"))] use syntect::{ dumps::from_binary, easy::HighlightLines, @@ -30,12 +35,14 @@ use matrix_sdk_base::{ }; #[derive(Clone)] +#[cfg(not(target_arch = "wasm32"))] struct Inspector { store: Store, printer: Printer, } #[derive(Helper)] +#[cfg(not(target_arch = "wasm32"))] struct InspectorHelper { store: Store, _highlighter: MatchingBracketHighlighter, @@ -43,6 +50,7 @@ struct InspectorHelper { _hinter: HistoryHinter, } +#[cfg(not(target_arch = "wasm32"))] impl InspectorHelper { const EVENT_TYPES: &'static [&'static str] = &[ "m.room.aliases", @@ -105,6 +113,7 @@ impl InspectorHelper { } } +#[cfg(not(target_arch = "wasm32"))] impl Completer for InspectorHelper { type Candidate = Pair; @@ -181,15 +190,19 @@ impl Completer for InspectorHelper { } } +#[cfg(not(target_arch = "wasm32"))] impl Hinter for InspectorHelper { type Hint = String; } +#[cfg(not(target_arch = "wasm32"))] impl Highlighter for InspectorHelper {} +#[cfg(not(target_arch = "wasm32"))] impl Validator for InspectorHelper {} #[derive(Clone, Debug)] +#[cfg(not(target_arch = "wasm32"))] struct Printer { ps: Arc, ts: Arc, @@ -197,6 +210,7 @@ struct Printer { color: bool, } +#[cfg(not(target_arch = "wasm32"))] impl Printer { fn new(json: bool, color: bool) -> Self { let syntax_set: SyntaxSet = from_binary(include_bytes!("./syntaxes.bin")); @@ -244,6 +258,7 @@ impl Printer { } } +#[cfg(not(target_arch = "wasm32"))] impl Inspector { fn new(database_path: &str, json: bool, color: bool) -> Self { let printer = Printer::new(json, color); @@ -388,6 +403,7 @@ impl Inspector { } } +#[cfg(not(target_arch = "wasm32"))] fn main() { let argparse = Argparse::new("state-inspector") .global_setting(ArgParseSettings::DisableVersion) @@ -431,3 +447,8 @@ fn main() { block_on(inspector.run(matches)); } } + +#[cfg(target_arch = "wasm32")] +fn main() { + panic!("This example doesn't run on WASM"); +}