From ce865c1e8a0a19dab49bc43b94be6ba14db9c619 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Fri, 18 May 2018 17:51:37 +0400 Subject: [PATCH] add public api switch --- cli/build/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/build/main.rs b/cli/build/main.rs index ee78c2a..7b90d4f 100644 --- a/cli/build/main.rs +++ b/cli/build/main.rs @@ -137,6 +137,11 @@ fn do_main() -> Result<(), Error> { .help("Shrinks the new stack size for wasm32-unknown-unknown") .takes_value(true) .long("shrink-stack")) + .arg(Arg::with_name("public_api") + .help("Preserves specific imports in the library") + .takes_value(true) + .long("public-api")) + .get_matches(); let target_dir = matches.value_of("target").expect("is required; qed"); @@ -195,10 +200,14 @@ fn do_main() -> Result<(), Error> { let mut ctor_module = module.clone(); + let mut public_api_entries = matches.value_of("public_api") + .map(|val| val.split(",").collect()) + .unwrap_or(Vec::new()); + public_api_entries.push(CALL_SYMBOL); if !matches.is_present("skip_optimization") { utils::optimize( &mut module, - vec![CALL_SYMBOL] + public_api_entries, )?; }