Skip to content

Commit c87c613

Browse files
authored
Merge pull request #954 from subspace/skip-substrate-wasm-builder
Only use substrate-wasm-builder when std feature is enabled
2 parents e01e3cd + 1973875 commit c87c613

File tree

15 files changed

+89
-74
lines changed

15 files changed

+89
-74
lines changed

crates/subspace-runtime/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ subspace-verification = { version = "0.1.0", default-features = false, path = ".
6161
system-domain-runtime = { version = "0.1.0", default-features = false, path = "../../domains/runtime/system" }
6262

6363
[build-dependencies]
64-
subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../subspace-wasm-tools" }
65-
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535" }
64+
subspace-wasm-tools = { version = "0.1.0", path = "../subspace-wasm-tools" }
65+
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535", optional = true }
6666

6767
[dev-dependencies]
6868
hex-literal = "0.3.3"
@@ -113,6 +113,7 @@ std = [
113113
"subspace-runtime-primitives/std",
114114
"subspace-verification/std",
115115
"system-domain-runtime/std",
116+
"substrate-wasm-builder",
116117
]
117118
runtime-benchmarks = [
118119
"frame-benchmarking/runtime-benchmarks",

crates/subspace-runtime/build.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use substrate_wasm_builder::WasmBuilder;
18-
1917
fn main() {
2018
subspace_wasm_tools::create_runtime_bundle_inclusion_file(
2119
"system-domain-runtime",
2220
"EXECUTION_WASM_BUNDLE",
2321
"execution_wasm_bundle.rs",
2422
);
2523

26-
WasmBuilder::new()
27-
.with_current_project()
28-
.export_heap_base()
29-
.import_memory()
30-
.build();
24+
#[cfg(feature = "std")]
25+
{
26+
substrate_wasm_builder::WasmBuilder::new()
27+
.with_current_project()
28+
.export_heap_base()
29+
.import_memory()
30+
.build();
31+
}
3132
}

domains/runtime/core-payments/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ sp-version = { version = "5.0.0", default-features = false, git = "https://githu
4747
subspace-runtime-primitives = { version = "0.1.0", path = "../../../crates/subspace-runtime-primitives", default-features = false }
4848

4949
[build-dependencies]
50-
subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../../crates/subspace-wasm-tools" }
51-
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535" }
50+
subspace-wasm-tools = { version = "0.1.0", path = "../../../crates/subspace-wasm-tools" }
51+
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535", optional = true }
5252

5353
[features]
5454
default = [
@@ -85,6 +85,7 @@ std = [
8585
"sp-transaction-pool/std",
8686
"sp-version/std",
8787
"subspace-runtime-primitives/std",
88+
"substrate-wasm-builder",
8889
]
8990
# Internal implementation detail, enabled during building of wasm blob.
9091
wasm-builder = []
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use substrate_wasm_builder::WasmBuilder;
2-
31
fn main() {
4-
WasmBuilder::new()
5-
.with_current_project()
6-
.enable_feature("wasm-builder")
7-
.export_heap_base()
8-
.import_memory()
9-
.build();
2+
#[cfg(feature = "std")]
3+
{
4+
substrate_wasm_builder::WasmBuilder::new()
5+
.with_current_project()
6+
.enable_feature("wasm-builder")
7+
.export_heap_base()
8+
.import_memory()
9+
.build();
10+
}
1011

1112
subspace_wasm_tools::export_wasm_bundle_path();
1213
}

domains/runtime/core-payments/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ mod runtime;
1212
#[cfg(any(feature = "wasm-builder", feature = "std"))]
1313
pub use runtime::*;
1414

15-
// Make the WASM binary available, except in wasm builder environment.
16-
#[cfg(not(feature = "wasm-builder"))]
15+
// Make the WASM binary available.
16+
#[cfg(feature = "std")]
1717
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

domains/runtime/system/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ subspace-runtime-primitives = { version = "0.1.0", path = "../../../crates/subsp
4949
system-runtime-primitives = { version = "0.1.0", path = "../../primitives/system-runtime", default-features = false }
5050

5151
[build-dependencies]
52-
subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../../crates/subspace-wasm-tools" }
53-
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535" }
52+
subspace-wasm-tools = { version = "0.1.0", path = "../../../crates/subspace-wasm-tools" }
53+
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535", optional = true }
5454

5555
[features]
5656
default = [
@@ -91,6 +91,7 @@ std = [
9191
"sp-version/std",
9292
"subspace-runtime-primitives/std",
9393
"system-runtime-primitives/std",
94+
"substrate-wasm-builder",
9495
]
9596
# Internal implementation detail, enabled during building of wasm blob.
9697
wasm-builder = []

domains/runtime/system/build.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
use substrate_wasm_builder::WasmBuilder;
2-
31
fn main() {
42
subspace_wasm_tools::create_runtime_bundle_inclusion_file(
53
"core-payments-domain-runtime",
64
"CORE_PAYMENTS_WASM_BUNDLE",
75
"core_payments_wasm_bundle.rs",
86
);
97

10-
WasmBuilder::new()
11-
.with_current_project()
12-
.enable_feature("wasm-builder")
13-
.export_heap_base()
14-
.import_memory()
15-
.build();
8+
#[cfg(feature = "std")]
9+
{
10+
substrate_wasm_builder::WasmBuilder::new()
11+
.with_current_project()
12+
.enable_feature("wasm-builder")
13+
.export_heap_base()
14+
.import_memory()
15+
.build();
16+
}
1617

1718
subspace_wasm_tools::export_wasm_bundle_path();
1819
}

domains/runtime/system/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ mod runtime;
1212
#[cfg(any(feature = "wasm-builder", feature = "std"))]
1313
pub use runtime::*;
1414

15-
// Make the WASM binary available, except in wasm builder environment.
16-
#[cfg(not(feature = "wasm-builder"))]
15+
// Make the WASM binary available.
16+
#[cfg(feature = "std")]
1717
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
1818

1919
#[cfg(feature = "runtime-benchmarks")]

domains/test/runtime/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ links = "domain-test-runtime"
1313
targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[build-dependencies]
16-
subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../../crates/subspace-wasm-tools" }
17-
substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535" }
16+
subspace-wasm-tools = { version = "0.1.0", path = "../../../crates/subspace-wasm-tools" }
17+
substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "6d57dbc639bb3d9460dabeccb063cc6556452535", optional = true }
1818

1919
[dependencies]
2020
codec = { package = "parity-scale-codec", version = "3.2.1", default-features = false, features = ["derive"]}
@@ -88,6 +88,7 @@ std = [
8888
"sp-version/std",
8989
"system-runtime-primitives/std",
9090
"subspace-runtime-primitives/std",
91+
"substrate-wasm-builder",
9192
]
9293
# Internal implementation detail, enabled during building of wasm blob.
9394
wasm-builder = []

domains/test/runtime/build.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use substrate_wasm_builder::WasmBuilder;
2-
31
fn main() {
4-
WasmBuilder::new()
5-
.with_current_project()
6-
.enable_feature("wasm-builder")
7-
.export_heap_base()
8-
.import_memory()
9-
.build();
2+
#[cfg(feature = "std")]
3+
{
4+
substrate_wasm_builder::WasmBuilder::new()
5+
.with_current_project()
6+
.enable_feature("wasm-builder")
7+
.export_heap_base()
8+
.import_memory()
9+
.build();
10+
}
1011

1112
subspace_wasm_tools::export_wasm_bundle_path();
1213
}

0 commit comments

Comments
 (0)