Browse Source

Update obsolete code in the runtime/build.rs

Migrated to the WasmBuilder.
Shamil Gadelshin 5 years ago
parent
commit
bfcab70f42
1 changed files with 13 additions and 8 deletions
  1. 13 8
      runtime/build.rs

+ 13 - 8
runtime/build.rs

@@ -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 {