complete_usage/
complete_usage.rsuse parabuild::{
CompliationErrorHandlingMethod, Parabuilder, RunMethod, IGNORE_ON_ERROR_DEFAULT_RUN_FUNC,
};
use serde_json::{json, Value as JsonValue};
fn main() {
let project_path = "tests/example_run_time_consuming_project"; let workspaces_path = "workspaces"; let template_path = "src/main.cpp.template"; let target_executable_file = "build/main"; let mut datas = (1..=100)
.map(|i| json!({"N": i}))
.collect::<Vec<JsonValue>>();
let error_data = json!({"N": "a"});
datas.push(error_data.clone());
let init_bash_script = r#"cmake -B build -S . -DPARABUILD=ON"#;
let compile_bash_script = r#"cmake --build build --target all -- -B"#;
let mut parabuilder = Parabuilder::new(
project_path,
workspaces_path,
template_path,
&[target_executable_file],
)
.init_bash_script(init_bash_script)
.compile_bash_script(compile_bash_script)
.build_workers(4)
.run_method(RunMethod::OutOfPlace(2)) .compilation_error_handling_method(CompliationErrorHandlingMethod::Collect) .auto_gather_array_data(true) .run_func(IGNORE_ON_ERROR_DEFAULT_RUN_FUNC)
.in_place_template(false)
.disable_progress_bar(false);
parabuilder.set_datas(datas).unwrap();
parabuilder.init_workspace().unwrap();
let (run_data, compile_error_datas): (JsonValue, Vec<JsonValue>) = parabuilder.run().unwrap();
println!("run_data: {:?}", run_data);
println!("compile_error_datas: {:?}", compile_error_datas);
}