diff --git a/bin-compiler/src/main.rs b/bin-compiler/src/main.rs index 9ab3e1d1bce01f4594b1f0452e1c7c71935b75c2..1482ae752710211bac6dcaab87745d6bbad57d16 100644 --- a/bin-compiler/src/main.rs +++ b/bin-compiler/src/main.rs @@ -31,6 +31,13 @@ fn main() { .long("debug") .short('d') .help("enable debug logging") + ) + .arg( + Arg::new("stdlib") + .long("stdlib") + .short('s') + .help("standard library directory (overrides default)") + .takes_value(true) ); // Retrieve arguments and convert @@ -59,11 +66,15 @@ fn main() { let debug_enabled = app.is_present("debug"); + let standard_library_dir = app.value_of("stdlib") + .map(|v| v.to_string()); + // Add input files to file buffer let input_files = input_files.unwrap(); assert!(input_files.len() > 0); // because arg is required - let mut builder = rw::ProtocolDescriptionBuilder::new().expect("create protocol description builder"); + let mut builder = rw::ProtocolDescriptionBuilder::new(standard_library_dir) + .expect("create protocol description builder"); let mut file_buffer = Vec::with_capacity(4096); for input_file in input_files { @@ -101,9 +112,17 @@ fn main() { println!("Success"); + // Start runtime + print!("Startup of runtime ... "); + let runtime = rw::runtime2::Runtime::new(num_threads, debug_enabled, protocol_description); + if let Err(err) = &runtime { + println!("FAILED\nbecause:\n{}", err); + } + println!("Success"); + // Make sure there is a nameless module with a main component print!("Creating main component ... "); - let runtime = rw::runtime2::Runtime::new(num_threads, debug_enabled, protocol_description); + let runtime = runtime.unwrap(); if let Err(err) = runtime.create_component(b"", b"main") { use rw::ComponentCreationError as CCE; let reason = match err {