Rebuild hosts in a separate thread and only optimize when specified

This commit is contained in:
Brendan Hansknecht 2021-09-14 14:46:03 -07:00
parent 22722a3cf4
commit 0ef9498a69
7 changed files with 160 additions and 64 deletions

View file

@ -8,6 +8,7 @@ use object::{
Object, ObjectSection, ObjectSymbol, RelocationKind, RelocationTarget, Section, SectionIndex,
Symbol, SymbolIndex, SymbolSection,
};
use roc_build::link::LinkType;
use roc_collections::all::MutMap;
use std::cmp::Ordering;
use std::convert::TryFrom;
@ -19,6 +20,7 @@ use std::mem;
use std::os::raw::c_char;
use std::path::Path;
use std::time::{Duration, SystemTime};
use target_lexicon::Triple;
mod metadata;
@ -122,6 +124,26 @@ pub fn build_app<'a>() -> App<'a> {
)
}
pub fn supported(link_type: &LinkType, target: &Triple) -> bool {
link_type == &LinkType::Executable
&& target.architecture == target_lexicon::Architecture::X86_64
&& target.operating_system == target_lexicon::OperatingSystem::Linux
&& target.binary_format == target_lexicon::BinaryFormat::Elf
}
pub fn build_and_preprocess_host(
target: &Triple,
host_input_path: &Path,
exposed_to_host: Vec<String>,
) -> io::Result<()> {
let lib = generate_dynamic_lib(exposed_to_host)?;
Ok(())
}
fn generate_dynamic_lib(exposed_to_host: Vec<String>) -> io::Result<()> {
Ok(())
}
// TODO: Most of this file is a mess of giant functions just to check if things work.
// Clean it all up and refactor nicely.
pub fn preprocess(matches: &ArgMatches) -> io::Result<i32> {