Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 5a6e41e

Browse files
author
Andronik Ordian
committed
introduce activate-wasm-bindgen-features crate
1 parent 7a69a1a commit 5a6e41e

File tree

7 files changed

+52
-19
lines changed

7 files changed

+52
-19
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,8 @@ check-web-wasm:
303303
script:
304304
# WASM support is in progress. As more and more crates support WASM, we
305305
# should add entries here. See https://github.com/paritytech/substrate/issues/2416
306-
- time cargo build --target=wasm32-unknown-unknown -p sp-io
307-
- time cargo build --target=wasm32-unknown-unknown -p sp-runtime
308-
- time cargo build --target=wasm32-unknown-unknown -p sp-std
309-
- time cargo build --target=wasm32-unknown-unknown -p sc-consensus-aura
310-
- time cargo build --target=wasm32-unknown-unknown -p sc-consensus-babe
311-
- time cargo build --target=wasm32-unknown-unknown -p sp-consensus
312-
- time cargo build --target=wasm32-unknown-unknown -p sc-telemetry
306+
# Note: we don't need to test crates imported in `bin/node/cli`
307+
- time cargo build --manifest-path=client/consensus/aura/Cargo.toml --target=wasm32-unknown-unknown --features activate-wasm-bindgen-features
313308
# Note: the command below is a bit weird because several Cargo issues prevent us from compiling the node in a more straight-forward way.
314309
- time cargo +nightly build --manifest-path=bin/node/cli/Cargo.toml --no-default-features --features browser --target=wasm32-unknown-unknown -Z features=itarget
315310
# with-tracing must be explicitly activated, we run a test to ensure this works as expected in both cases

Cargo.lock

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ members = [
178178
"test-utils/runtime/client",
179179
"test-utils/runtime/transaction-pool",
180180
"test-utils/test-crate",
181+
"utils/activate-wasm-bindgen-features",
181182
"utils/browser",
182183
"utils/build-script-utils",
183184
"utils/fork-tree",

client/consensus/aura/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sp-timestamp = { version = "2.0.0", path = "../../../primitives/timestamp" }
3737
sp-keystore = { version = "0.8.0", path = "../../../primitives/keystore" }
3838
sc-telemetry = { version = "2.0.0", path = "../../telemetry" }
3939
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus", version = "0.8.0"}
40+
activate-wasm-bindgen-features = { version = "0.1.0", path = "../../../utils/activate-wasm-bindgen-features", optional = true }
4041

4142
[dev-dependencies]
4243
sp-keyring = { version = "2.0.0", path = "../../../primitives/keyring" }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "activate-wasm-bindgen-features"
3+
version = "0.1.0"
4+
authors = ["Parity Technologies <[email protected]>"]
5+
edition = "2018"
6+
license = "Apache-2.0"
7+
homepage = "https://substrate.dev"
8+
repository = "https://github.com/paritytech/substrate/"
9+
publish = false
10+
11+
[dependencies]
12+
getrandom = { version = "0.2", features = ["js"] }
13+
rand = { version = "0.7", features = ["wasm-bindgen"] }
14+
futures-timer = { version = "3.0.1", features = ["wasm-bindgen"] }
15+
chrono = { version = "0.4", features = ["wasmbind"] }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
//! Activates `wasm-bindgen` features of various crates that we use.

utils/browser/Cargo.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ kvdb-web = "0.8.0"
2626
sp-database = { version = "2.0.0", path = "../../primitives/database" }
2727
sc-informant = { version = "0.8.0", path = "../../client/informant" }
2828
sc-service = { version = "0.8.0", path = "../../client/service", default-features = false }
29-
sc-network = { path = "../../client/network", version = "0.8.0"}
30-
sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0"}
31-
32-
# Imported just for the `wasm-bindgen` feature
33-
getrandom = { version = "0.2", features = ["js"] }
34-
rand = { version = "0.7", features = ["wasm-bindgen"] }
35-
futures-timer = { version = "3.0.1", features = ["wasm-bindgen"]}
36-
chrono = { version = "0.4", features = ["wasmbind"] }
29+
sc-network = { path = "../../client/network", version = "0.8.0" }
30+
sc-chain-spec = { path = "../../client/chain-spec", version = "2.0.0" }
31+
activate-wasm-bindgen-features = { version = "0.1.0", path = "../activate-wasm-bindgen-features" }

0 commit comments

Comments
 (0)