started working on build system
This commit is contained in:
@@ -24,5 +24,22 @@ pub mod prelude {
|
||||
pub use crate::tooling::project;
|
||||
}
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use num_cpus as _;
|
||||
use threadpool as _;
|
||||
|
||||
use crate::prelude::CompilerEngine;
|
||||
|
||||
pub fn assemble_file(input: &str, output: &str) -> Result<(), std::io::Error> {
|
||||
let mut engine = CompilerEngine::new();
|
||||
engine.start_compilation(Path::new(input));
|
||||
let result = engine.wait_for_result().unwrap();
|
||||
for instruction in result {
|
||||
if let Err(e) = std::fs::write(output, instruction.encode().to_be_bytes()) {
|
||||
eprintln!("Failed to write to output file: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user