From 4c70aadf9d3505adaf5a34d372c3cae7d4e7538f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sat, 11 Mar 2023 22:13:57 +0100 Subject: [PATCH] Improve build times by disabling wasm-builder in `no_std` There is no need to compile wasm-builder in `no_std` as we skip the compilation of the crate any way. So, we can also directly disable wasm-builder as dependency in `no_std` to improve build times. --- parachain-template/runtime/Cargo.toml | 3 +- parachain-template/runtime/build.rs | 10 ++++-- .../runtimes/assets/statemine/Cargo.toml | 3 +- parachains/runtimes/assets/statemine/build.rs | 21 +++++++++-- .../runtimes/assets/statemint/Cargo.toml | 3 +- parachains/runtimes/assets/statemint/build.rs | 21 +++++++++-- .../runtimes/assets/westmint/Cargo.toml | 3 +- parachains/runtimes/assets/westmint/build.rs | 21 +++++++++-- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 3 +- .../bridge-hubs/bridge-hub-kusama/build.rs | 21 +++++++++-- .../bridge-hub-polkadot/Cargo.toml | 3 +- .../bridge-hubs/bridge-hub-polkadot/build.rs | 21 +++++++++-- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 3 +- .../bridge-hubs/bridge-hub-rococo/build.rs | 21 +++++++++-- .../collectives-polkadot/Cargo.toml | 3 +- .../collectives/collectives-polkadot/build.rs | 21 +++++++++-- .../contracts/contracts-rococo/Cargo.toml | 3 +- .../contracts/contracts-rococo/build.rs | 21 +++++++++-- .../runtimes/starters/seedling/Cargo.toml | 3 +- .../runtimes/starters/seedling/build.rs | 35 ++++++++++--------- parachains/runtimes/starters/shell/Cargo.toml | 3 +- parachains/runtimes/starters/shell/build.rs | 8 +++-- parachains/runtimes/testing/penpal/Cargo.toml | 3 +- parachains/runtimes/testing/penpal/build.rs | 8 +++-- .../testing/rococo-parachain/Cargo.toml | 3 +- .../testing/rococo-parachain/build.rs | 35 ++++++++++--------- test/runtime/Cargo.toml | 3 +- test/runtime/build.rs | 8 +++-- 28 files changed, 239 insertions(+), 75 deletions(-) diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index ebd9c22a03f..704c9ea39c3 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -121,6 +121,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachain-template/runtime/build.rs b/parachain-template/runtime/build.rs index 9b53d2457df..02d6973f29c 100644 --- a/parachain-template/runtime/build.rs +++ b/parachain-template/runtime/build.rs @@ -1,9 +1,13 @@ -use substrate_wasm_builder::WasmBuilder; - +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +/// The wasm builder is deactivated when compiling +/// this crate for wasm to speed up the compilation. +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/assets/statemine/Cargo.toml b/parachains/runtimes/assets/statemine/Cargo.toml index 0f0921976a8..6f2bbff94ae 100644 --- a/parachains/runtimes/assets/statemine/Cargo.toml +++ b/parachains/runtimes/assets/statemine/Cargo.toml @@ -76,7 +76,7 @@ assets-common = { path = "../common", default-features = false } asset-test-utils = { path = "../test-utils"} [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -188,4 +188,5 @@ std = [ "parachain-info/std", "parachains-common/std", "assets-common/std", + "substrate-wasm-builder", ] diff --git a/parachains/runtimes/assets/statemine/build.rs b/parachains/runtimes/assets/statemine/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/assets/statemine/build.rs +++ b/parachains/runtimes/assets/statemine/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/assets/statemint/Cargo.toml b/parachains/runtimes/assets/statemint/Cargo.toml index f6d54cbd85f..66c8739767e 100644 --- a/parachains/runtimes/assets/statemint/Cargo.toml +++ b/parachains/runtimes/assets/statemint/Cargo.toml @@ -76,7 +76,7 @@ hex-literal = "0.3.4" asset-test-utils = { path = "../test-utils"} [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -178,4 +178,5 @@ std = [ "parachain-info/std", "parachains-common/std", "assets-common/std", + "substrate-wasm-builder", ] diff --git a/parachains/runtimes/assets/statemint/build.rs b/parachains/runtimes/assets/statemint/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/assets/statemint/build.rs +++ b/parachains/runtimes/assets/statemint/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/assets/westmint/Cargo.toml b/parachains/runtimes/assets/westmint/Cargo.toml index 591c7699f8b..31e98071b18 100644 --- a/parachains/runtimes/assets/westmint/Cargo.toml +++ b/parachains/runtimes/assets/westmint/Cargo.toml @@ -78,7 +78,7 @@ hex-literal = "0.3.4" asset-test-utils = { path = "../test-utils"} [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -184,4 +184,5 @@ std = [ "parachain-info/std", "parachains-common/std", "assets-common/std", + "substrate-wasm-builder", ] diff --git a/parachains/runtimes/assets/westmint/build.rs b/parachains/runtimes/assets/westmint/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/assets/westmint/build.rs +++ b/parachains/runtimes/assets/westmint/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index 4bb98bbe30f..6c23da10139 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" description = "Kusama's BridgeHub parachain runtime" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -126,6 +126,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/build.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/build.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index a2dae8c64a7..dfca8c67546 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" description = "Polkadot's BridgeHub parachain runtime" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -126,6 +126,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/build.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/build.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 3e34e1a93b3..08f34916cf2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" description = "Rococo's BridgeHub parachain runtime" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -126,6 +126,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/build.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/build.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml index 49b459bb34f..1a572aef3a6 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml +++ b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml @@ -72,7 +72,7 @@ parachains-common = { path = "../../../common", default-features = false } hex-literal = "0.3.4" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -170,4 +170,5 @@ std = [ "pallet-collator-selection/std", "parachain-info/std", "parachains-common/std", + "substrate-wasm-builder", ] diff --git a/parachains/runtimes/collectives/collectives-polkadot/build.rs b/parachains/runtimes/collectives/collectives-polkadot/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/build.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 142dba5fc9c..a43fce8e1ca 100644 --- a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -129,6 +129,7 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachains/runtimes/contracts/contracts-rococo/build.rs b/parachains/runtimes/contracts/contracts-rococo/build.rs index 9b53d2457df..60f8a125129 100644 --- a/parachains/runtimes/contracts/contracts-rococo/build.rs +++ b/parachains/runtimes/contracts/contracts-rococo/build.rs @@ -1,9 +1,26 @@ -use substrate_wasm_builder::WasmBuilder; +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/starters/seedling/Cargo.toml b/parachains/runtimes/starters/seedling/Cargo.toml index af39b77c50e..7bf6b85dd3f 100644 --- a/parachains/runtimes/starters/seedling/Cargo.toml +++ b/parachains/runtimes/starters/seedling/Cargo.toml @@ -33,7 +33,7 @@ parachains-common = { path = "../../../common", default-features = false } cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -60,4 +60,5 @@ std = [ "cumulus-primitives-core/std", "parachain-info/std", "parachains-common/std", + "substrate-wasm-builder", ] diff --git a/parachains/runtimes/starters/seedling/build.rs b/parachains/runtimes/starters/seedling/build.rs index fe1a2ea911d..60f8a125129 100644 --- a/parachains/runtimes/starters/seedling/build.rs +++ b/parachains/runtimes/starters/seedling/build.rs @@ -1,25 +1,26 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -use substrate_wasm_builder::WasmBuilder; +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/starters/shell/Cargo.toml b/parachains/runtimes/starters/shell/Cargo.toml index 05a7db8ed33..e36d5a30393 100644 --- a/parachains/runtimes/starters/shell/Cargo.toml +++ b/parachains/runtimes/starters/shell/Cargo.toml @@ -37,7 +37,7 @@ parachain-info = { path = "../../../pallets/parachain-info", default-features = parachains-common = { path = "../../../common", default-features = false } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -65,6 +65,7 @@ std = [ "cumulus-primitives-core/std", "parachain-info/std", "parachains-common/std", + "substrate-wasm-builder", ] try-runtime = [ "frame-executive/try-runtime", diff --git a/parachains/runtimes/starters/shell/build.rs b/parachains/runtimes/starters/shell/build.rs index fe1a2ea911d..256e9fb765b 100644 --- a/parachains/runtimes/starters/shell/build.rs +++ b/parachains/runtimes/starters/shell/build.rs @@ -14,12 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use substrate_wasm_builder::WasmBuilder; - +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/testing/penpal/Cargo.toml b/parachains/runtimes/testing/penpal/Cargo.toml index eba4ac2ae11..3e2af43ce63 100644 --- a/parachains/runtimes/testing/penpal/Cargo.toml +++ b/parachains/runtimes/testing/penpal/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -124,6 +124,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ diff --git a/parachains/runtimes/testing/penpal/build.rs b/parachains/runtimes/testing/penpal/build.rs index fe1a2ea911d..256e9fb765b 100644 --- a/parachains/runtimes/testing/penpal/build.rs +++ b/parachains/runtimes/testing/penpal/build.rs @@ -14,12 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use substrate_wasm_builder::WasmBuilder; - +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/parachains/runtimes/testing/rococo-parachain/Cargo.toml index 656f6c3c862..65cd4bafeaa 100644 --- a/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -55,7 +55,7 @@ parachains-common = { path = "../../../common", default-features = false } parachain-info = { path = "../../../pallets/parachain-info", default-features = false } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } [features] default = [ "std" ] @@ -99,6 +99,7 @@ std = [ "cumulus-primitives-utility/std", "parachain-info/std", "parachains-common/std", + "substrate-wasm-builder", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/parachains/runtimes/testing/rococo-parachain/build.rs b/parachains/runtimes/testing/rococo-parachain/build.rs index fe1a2ea911d..60f8a125129 100644 --- a/parachains/runtimes/testing/rococo-parachain/build.rs +++ b/parachains/runtimes/testing/rococo-parachain/build.rs @@ -1,25 +1,26 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of Cumulus. +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -use substrate_wasm_builder::WasmBuilder; +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#[cfg(feature = "std")] fn main() { - WasmBuilder::new() + substrate_wasm_builder::WasmBuilder::new() .with_current_project() .export_heap_base() .import_memory() .build() } + +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/test/runtime/Cargo.toml b/test/runtime/Cargo.toml index 9fa3b8e2c06..c4e350b20b3 100644 --- a/test/runtime/Cargo.toml +++ b/test/runtime/Cargo.toml @@ -35,7 +35,7 @@ cumulus-primitives-core = { path = "../../primitives/core", default-features = f cumulus-primitives-timestamp = { path = "../../primitives/timestamp", default-features = false } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" , optional = true } [features] default = [ "std" ] @@ -64,5 +64,6 @@ std = [ "cumulus-pallet-parachain-system/std", "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", + "substrate-wasm-builder", ] increment-spec-version = [] diff --git a/test/runtime/build.rs b/test/runtime/build.rs index 0b9594e6125..77631afefe6 100644 --- a/test/runtime/build.rs +++ b/test/runtime/build.rs @@ -14,9 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use substrate_wasm_builder::WasmBuilder; - +#[cfg(feature = "std")] fn main() { + use substrate_wasm_builder::WasmBuilder; + WasmBuilder::new() .with_current_project() .export_heap_base() @@ -30,3 +31,6 @@ fn main() { .set_file_name("wasm_binary_spec_version_incremented.rs") .build(); } + +#[cfg(not(feature = "std"))] +fn main() {}