(
context: &JobContext,
cancel: Receiver<()>,
config: ObjDiffConfig,
)
| 30 | } |
| 31 | |
| 32 | fn run_build( |
| 33 | context: &JobContext, |
| 34 | cancel: Receiver<()>, |
| 35 | config: ObjDiffConfig, |
| 36 | ) -> Result<Box<ObjDiffResult>> { |
| 37 | let mut target_path_rel = None; |
| 38 | let mut base_path_rel = None; |
| 39 | if config.build_target || config.build_base { |
| 40 | let project_dir = config |
| 41 | .build_config |
| 42 | .project_dir |
| 43 | .as_ref() |
| 44 | .ok_or_else(|| Error::msg("Missing project dir"))?; |
| 45 | if let Some(target_path) = &config.target_path { |
| 46 | target_path_rel = match target_path.strip_prefix(project_dir) { |
| 47 | Ok(p) => Some(p.with_unix_encoding()), |
| 48 | Err(_) => { |
| 49 | bail!("Target path '{}' doesn't begin with '{}'", target_path, project_dir); |
| 50 | } |
| 51 | }; |
| 52 | } |
| 53 | if let Some(base_path) = &config.base_path { |
| 54 | base_path_rel = match base_path.strip_prefix(project_dir) { |
| 55 | Ok(p) => Some(p.with_unix_encoding()), |
| 56 | Err(_) => { |
| 57 | bail!("Base path '{}' doesn't begin with '{}'", base_path, project_dir); |
| 58 | } |
| 59 | }; |
| 60 | }; |
| 61 | } |
| 62 | |
| 63 | let mut total = 1; |
| 64 | if config.build_target && target_path_rel.is_some() { |
| 65 | total += 1; |
| 66 | } |
| 67 | if config.build_base && base_path_rel.is_some() { |
| 68 | total += 1; |
| 69 | } |
| 70 | if config.target_path.is_some() { |
| 71 | total += 1; |
| 72 | } |
| 73 | if config.base_path.is_some() { |
| 74 | total += 1; |
| 75 | } |
| 76 | |
| 77 | let mut step_idx = 0; |
| 78 | let mut first_status = match target_path_rel { |
| 79 | Some(target_path_rel) if config.build_target => { |
| 80 | update_status( |
| 81 | context, |
| 82 | format!("Building target {target_path_rel}"), |
| 83 | step_idx, |
| 84 | total, |
| 85 | &cancel, |
| 86 | )?; |
| 87 | step_idx += 1; |
| 88 | run_make(&config.build_config, target_path_rel.as_ref()) |
| 89 | } |
no test coverage detected