Experimental objdiff-cli diff auto-rebuild

This commit is contained in:
2024-10-11 18:37:14 -06:00
parent 10b2a9c129
commit 526e031251
24 changed files with 1587 additions and 1312 deletions

View File

@@ -15,6 +15,7 @@ use globset::Glob;
use objdiff_core::{
config::{ProjectObject, DEFAULT_WATCH_PATTERNS},
diff::{ArmArchVersion, ArmR9Usage, MipsAbi, MipsInstrCategory, X86Formatter},
jobs::{check_update::CheckUpdateResult, Job, JobQueue, JobResult},
};
use strum::{EnumMessage, VariantArray};
@@ -22,11 +23,7 @@ use crate::{
app::{AppConfig, AppState, AppStateRef, ObjectConfig},
config::ProjectObjectNode,
hotkeys,
jobs::{
check_update::{start_check_update, CheckUpdateResult},
update::start_update,
Job, JobQueue, JobResult,
},
jobs::{start_check_update, start_update},
update::RELEASE_URL,
views::{
appearance::Appearance,
@@ -119,11 +116,11 @@ impl ConfigViewState {
if self.queue_check_update {
self.queue_check_update = false;
jobs.push_once(Job::CheckUpdate, || start_check_update(ctx));
start_check_update(ctx, jobs);
}
if let Some(bin_name) = self.queue_update.take() {
jobs.push_once(Job::Update, || start_update(ctx, bin_name));
start_update(ctx, jobs, bin_name);
}
}
}

View File

@@ -1,11 +1,9 @@
use std::cmp::Ordering;
use egui::{ProgressBar, RichText, Widget};
use objdiff_core::jobs::{JobQueue, JobStatus};
use crate::{
jobs::{JobQueue, JobStatus},
views::appearance::Appearance,
};
use crate::views::appearance::Appearance;
pub fn jobs_ui(ui: &mut egui::Ui, jobs: &mut JobQueue, appearance: &Appearance) {
if ui.button("Clear").clicked() {

View File

@@ -6,7 +6,9 @@ use egui::{
};
use objdiff_core::{
arch::ObjArch,
build::BuildStatus,
diff::{display::HighlightKind, ObjDiff, ObjSymbolDiff},
jobs::{create_scratch::CreateScratchResult, objdiff::ObjDiffResult, Job, JobQueue, JobResult},
obj::{
ObjInfo, ObjSection, ObjSectionKind, ObjSymbol, ObjSymbolFlags, SymbolRef, SECTION_COMMON,
},
@@ -16,11 +18,7 @@ use regex::{Regex, RegexBuilder};
use crate::{
app::AppStateRef,
hotkeys,
jobs::{
create_scratch::{start_create_scratch, CreateScratchConfig, CreateScratchResult},
objdiff::{BuildStatus, ObjDiffResult},
Job, JobQueue, JobResult,
},
jobs::{is_create_scratch_available, start_create_scratch},
views::{
appearance::Appearance,
column_layout::{render_header, render_strips},
@@ -182,7 +180,7 @@ impl DiffViewState {
} else {
self.source_path_available = false;
}
self.scratch_available = CreateScratchConfig::is_available(&state.config);
self.scratch_available = is_create_scratch_available(&state.config);
self.object_name =
state.config.selected_obj.as_ref().map(|o| o.name.clone()).unwrap_or_default();
}
@@ -270,14 +268,7 @@ impl DiffViewState {
let Ok(state) = state.read() else {
return;
};
match CreateScratchConfig::from_config(&state.config, function_name) {
Ok(config) => {
jobs.push_once(Job::CreateScratch, || start_create_scratch(ctx, config));
}
Err(err) => {
log::error!("Failed to create scratch config: {err}");
}
}
start_create_scratch(ctx, jobs, &state, function_name);
}
DiffViewAction::OpenSourcePath => {
let Ok(state) = state.read() else {