2017-04-27 21:21:10 +03:00
|
|
|
extern crate parity_wasm;
|
2017-05-05 16:05:21 +03:00
|
|
|
extern crate wasm_utils;
|
2017-04-27 21:21:10 +03:00
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
2017-05-19 16:54:53 +03:00
|
|
|
wasm_utils::init_log();
|
2017-05-05 16:06:16 +03:00
|
|
|
|
2017-05-19 16:54:53 +03:00
|
|
|
let args = env::args().collect::<Vec<_>>();
|
|
|
|
if args.len() != 3 {
|
|
|
|
println!("Usage: {} input_file.wasm output_file.wasm", args[0]);
|
|
|
|
return;
|
|
|
|
}
|
2017-04-27 21:21:10 +03:00
|
|
|
|
2017-05-19 16:54:53 +03:00
|
|
|
let module = wasm_utils::externalize(
|
|
|
|
parity_wasm::deserialize_file(&args[1]).expect("Module to deserialize ok"),
|
|
|
|
vec!["_free", "_malloc"],
|
|
|
|
);
|
2017-04-27 21:21:10 +03:00
|
|
|
|
2017-05-19 16:54:53 +03:00
|
|
|
parity_wasm::serialize_to_file(&args[2], module).expect("Module to serialize ok");
|
2017-04-27 21:21:10 +03:00
|
|
|
}
|