mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 13:18:20 +00:00
Remove duplicated code paths for create-exe
This commit is contained in:
@@ -190,9 +190,10 @@ impl CreateExe {
|
|||||||
};
|
};
|
||||||
std::fs::create_dir_all(&tempdir)?;
|
std::fs::create_dir_all(&tempdir)?;
|
||||||
|
|
||||||
|
let atoms =
|
||||||
if let Ok(pirita) = WebCMmap::parse(input_path.clone(), &ParseOptions::default()) {
|
if let Ok(pirita) = WebCMmap::parse(input_path.clone(), &ParseOptions::default()) {
|
||||||
// pirita file
|
// pirita file
|
||||||
let atoms = compile_pirita_into_directory(
|
compile_pirita_into_directory(
|
||||||
&pirita,
|
&pirita,
|
||||||
&tempdir,
|
&tempdir,
|
||||||
&self.compiler,
|
&self.compiler,
|
||||||
@@ -202,22 +203,10 @@ impl CreateExe {
|
|||||||
&self.precompiled_atom,
|
&self.precompiled_atom,
|
||||||
AllowMultiWasm::Allow,
|
AllowMultiWasm::Allow,
|
||||||
self.debug_dir.is_some(),
|
self.debug_dir.is_some(),
|
||||||
)?;
|
)
|
||||||
get_module_infos(&tempdir, &atoms, object_format)?;
|
|
||||||
let mut entrypoint = get_entrypoint(&tempdir)?;
|
|
||||||
create_header_files_in_dir(&tempdir, &mut entrypoint, &atoms, &self.precompiled_atom)?;
|
|
||||||
link_exe_from_dir(
|
|
||||||
&tempdir,
|
|
||||||
output_path,
|
|
||||||
&cross_compilation,
|
|
||||||
&self.libraries,
|
|
||||||
self.debug_dir.is_some(),
|
|
||||||
&atoms,
|
|
||||||
&self.precompiled_atom,
|
|
||||||
)?;
|
|
||||||
} else {
|
} else {
|
||||||
// wasm file
|
// wasm file
|
||||||
let atoms = prepare_directory_from_single_wasm_file(
|
prepare_directory_from_single_wasm_file(
|
||||||
&input_path,
|
&input_path,
|
||||||
&tempdir,
|
&tempdir,
|
||||||
&self.compiler,
|
&self.compiler,
|
||||||
@@ -226,7 +215,9 @@ impl CreateExe {
|
|||||||
object_format,
|
object_format,
|
||||||
&self.precompiled_atom,
|
&self.precompiled_atom,
|
||||||
self.debug_dir.is_some(),
|
self.debug_dir.is_some(),
|
||||||
)?;
|
)
|
||||||
|
}?;
|
||||||
|
|
||||||
get_module_infos(&tempdir, &atoms, object_format)?;
|
get_module_infos(&tempdir, &atoms, object_format)?;
|
||||||
let mut entrypoint = get_entrypoint(&tempdir)?;
|
let mut entrypoint = get_entrypoint(&tempdir)?;
|
||||||
create_header_files_in_dir(&tempdir, &mut entrypoint, &atoms, &self.precompiled_atom)?;
|
create_header_files_in_dir(&tempdir, &mut entrypoint, &atoms, &self.precompiled_atom)?;
|
||||||
@@ -239,7 +230,6 @@ impl CreateExe {
|
|||||||
&atoms,
|
&atoms,
|
||||||
&self.precompiled_atom,
|
&self.precompiled_atom,
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
|
|
||||||
if self.target_triple.is_some() {
|
if self.target_triple.is_some() {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
|||||||
Reference in New Issue
Block a user