|
@@ -15,7 +15,7 @@
|
|
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
use std::{env, process::Command, string::String};
|
|
|
-use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};
|
|
|
+use wasm_builder_runner::{WasmBuilder, WasmBuilderSource};
|
|
|
|
|
|
fn main() {
|
|
|
if !in_real_cargo_environment() {
|
|
@@ -23,13 +23,18 @@ fn main() {
|
|
|
println!("Building DUMMY Wasm binary");
|
|
|
}
|
|
|
|
|
|
- build_current_project_with_rustflags(
|
|
|
- "wasm_binary.rs",
|
|
|
- WasmBuilderSource::Crates("1.0.8"),
|
|
|
- // This instructs LLD to export __heap_base as a global variable, which is used by the
|
|
|
- // external memory allocator.
|
|
|
- "-Clink-arg=--export=__heap_base",
|
|
|
- );
|
|
|
+ let file_name = "wasm_binary.rs";
|
|
|
+ let wasm_builder_source = WasmBuilderSource::Crates("1.0.8");
|
|
|
+ // This instructs LLD to export __heap_base as a global variable, which is used by the
|
|
|
+ // external memory allocator.
|
|
|
+ let default_rust_flags = "-Clink-arg=--export=__heap_base";
|
|
|
+
|
|
|
+ WasmBuilder::new()
|
|
|
+ .with_current_project()
|
|
|
+ .with_wasm_builder_source(wasm_builder_source)
|
|
|
+ .append_to_rust_flags(default_rust_flags)
|
|
|
+ .set_file_name(file_name)
|
|
|
+ .build()
|
|
|
}
|
|
|
|
|
|
fn in_real_cargo_environment() -> bool {
|