2017-04-27 21:21:10 +03:00
|
|
|
extern crate parity_wasm;
|
2018-03-13 15:58:18 +03:00
|
|
|
extern crate pwasm_utils as utils;
|
2018-05-15 19:17:59 +08:00
|
|
|
extern crate pwasm_utils_cli as logger;
|
2017-04-27 21:21:10 +03:00
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
2018-05-15 08:05:00 +08:00
|
|
|
logger::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
|
|
|
|
2018-03-13 15:58:18 +03:00
|
|
|
let module = utils::externalize(
|
2017-11-06 19:06:26 +03:00
|
|
|
parity_wasm::deserialize_file(&args[1]).expect("Module to deserialize ok"),
|
|
|
|
vec!["_free", "_malloc", "_memcpy", "_memset", "_memmove"],
|
2017-05-19 16:54:53 +03:00
|
|
|
);
|
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
|
|
|
}
|