From 2f90a752fabc30121c5c2a08c6c0aae851183f69 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Mon, 19 Aug 2019 20:59:20 +0200 Subject: [PATCH 1/2] Fix errors and warnings for wasm build --- runtime-native/src/lib.rs | 8 ++++---- runtime-native/src/wasm32.rs | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/runtime-native/src/lib.rs b/runtime-native/src/lib.rs index 25ff547c..4b20579a 100644 --- a/runtime-native/src/lib.rs +++ b/runtime-native/src/lib.rs @@ -10,12 +10,12 @@ rust_2018_idioms )] -#[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))] +#[cfg(target_arch = "wasm32")] mod wasm32; -#[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))] +#[cfg(target_arch = "wasm32")] pub use wasm32::Native; -#[cfg(not(all(feature = "wasm-bindgen", target_arch = "wasm32")))] +#[cfg(not(target_arch = "wasm32"))] mod not_wasm32; -#[cfg(not(all(feature = "wasm-bindgen", target_arch = "wasm32")))] +#[cfg(not(target_arch = "wasm32"))] pub use not_wasm32::Native; diff --git a/runtime-native/src/wasm32.rs b/runtime-native/src/wasm32.rs index 6f1aebf1..a5c2746f 100644 --- a/runtime-native/src/wasm32.rs +++ b/runtime-native/src/wasm32.rs @@ -7,16 +7,12 @@ use std::net::SocketAddr; use std::pin::Pin; use std::time::{Duration, Instant}; -use wasm_bindgen::prelude::*; -use wasm_bindgen_futures::future_to_promise; - /// The Native runtime. #[derive(Debug)] pub struct Native; impl runtime_raw::Runtime for Native { fn spawn_boxed(&self, fut: BoxFuture<'static, ()>) -> Result<(), SpawnError> { - use futures01::future::Future; let fut = fut.unit_error().compat(); wasm_bindgen_futures::spawn_local(fut); Ok(()) From e726ed9c3b47f3a72ea5670bbd2e23f074a62aa8 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Mon, 19 Aug 2019 20:59:50 +0200 Subject: [PATCH 2/2] Add CI build for wasm --- azure-pipelines.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c654bef6..7ef43836 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,6 +18,19 @@ jobs: export RUST_BACKTRACE=1 cargo test --all || exit displayName: "Run cargo test" + - job: wasm + pool: + vmImage: 'ubuntu-16.04' + displayName: "build --target wasm32-unknown-unknown" + steps: + - template: ci/install-rust.yml + parameters: + rust_version: nightly + - bash: | + export RUST_BACKTRACE=1 + rustup target add wasm32-unknown-unknown + cargo build --target wasm32-unknown-unknown + displayName: "Run cargo build --target wasm32-unknown-unknown" - job: check_benches pool: vmImage: 'ubuntu-16.04'