mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-05-29 15:41:20 +00:00
add public api switch
This commit is contained in:
parent
2d60c0bb0e
commit
ce865c1e8a
@ -137,6 +137,11 @@ fn do_main() -> Result<(), Error> {
|
|||||||
.help("Shrinks the new stack size for wasm32-unknown-unknown")
|
.help("Shrinks the new stack size for wasm32-unknown-unknown")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.long("shrink-stack"))
|
.long("shrink-stack"))
|
||||||
|
.arg(Arg::with_name("public_api")
|
||||||
|
.help("Preserves specific imports in the library")
|
||||||
|
.takes_value(true)
|
||||||
|
.long("public-api"))
|
||||||
|
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let target_dir = matches.value_of("target").expect("is required; qed");
|
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 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") {
|
if !matches.is_present("skip_optimization") {
|
||||||
utils::optimize(
|
utils::optimize(
|
||||||
&mut module,
|
&mut module,
|
||||||
vec![CALL_SYMBOL]
|
public_api_entries,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user