1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use std::path::Path;
use std::collections::HashMap;
use time;
pub mod types;
pub mod utils;
#[macro_use] pub mod load;
pub mod vars;
pub mod link;
pub mod locs;
#[cfg(feature = "serde_codegen")]
include!(concat!(env!("OUT_DIR"), "/serde_types.rs"));
#[cfg(feature = "serde_derive")]
include!("serde_types.in.rs");
mod serialize;
#[cfg(test)]
mod tests;
pub use core::utils::find_repo;
pub use core::types::{
LoadResult, LoadError,
Artifact, Artifacts,
ArtType, Loc,
ArtName, ArtNameRc, ArtNames,
Settings, LoadFromStr,
PARENT_PATH};
pub use core::load::load_toml;
#[cfg(test)]
use super::init_logger;
#[cfg(test)]
pub fn init_logger_test() {
match init_logger(false, 3, false) {
Ok(_) => {},
Err(_) => {},
}
}
pub fn load_path(path: &Path) -> LoadResult<(Artifacts, Settings, HashMap<ArtName, Loc>)>{
let start = time::get_time();
info!("loading path: {}", path.to_string_lossy().as_ref());
let (mut artifacts, mut settings, loaded_vars, mut repo_map) = try!(load::load_raw(path));
info!("resolving and filling variables");
let mut variables = try!(vars::resolve_loaded_vars(loaded_vars, &mut repo_map));
try!(vars::fill_text_fields(&mut artifacts, &mut variables, &mut repo_map));
info!("finding and attaching locations");
let locs = try!(locs::find_locs(&mut settings));
let dne_locs = locs::attach_locs(&mut artifacts, locs);
try!(link::do_links(&mut artifacts));
let total = time::get_time() - start;
info!("Done loading: {} artifacts loaded successfullly in {:.3} seconds",
artifacts.len(), total.num_milliseconds() as f64 * 1e-3);
Ok((artifacts, settings, dne_locs))
}