MCPcopy Index your code
hub / github.com/encounter/objdiff / run_build

Function run_build

objdiff-core/src/jobs/objdiff.rs:32–182  ·  view source on GitHub ↗
(
    context: &JobContext,
    cancel: Receiver<()>,
    config: ObjDiffConfig,
)

Source from the content-addressed store, hash-verified

30}
31
32fn 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 }

Callers 1

start_buildFunction · 0.85

Calls 4

update_statusFunction · 0.85
readFunction · 0.85
diff_objsFunction · 0.85
is_someMethod · 0.80

Tested by

no test coverage detected