diff --git a/objdiff-core/build.rs b/objdiff-core/build.rs index fdd4e63..48e1a34 100644 --- a/objdiff-core/build.rs +++ b/objdiff-core/build.rs @@ -19,7 +19,15 @@ fn compile_protos() { .map(|m| m.modified().unwrap()) .unwrap_or(std::time::SystemTime::UNIX_EPOCH); let mut run_protoc = false; - let proto_files = vec![root.join("report.proto")]; + let proto_files = root + .read_dir() + .unwrap() + .filter_map(|e| { + let e = e.unwrap(); + let path = e.path(); + (path.extension() == Some(std::ffi::OsStr::new("proto"))).then_some(path) + }) + .collect::>(); for proto_file in &proto_files { println!("cargo:rerun-if-changed={}", proto_file.display()); let mtime = match std::fs::metadata(proto_file) { diff --git a/objdiff-core/protos/changes.proto b/objdiff-core/protos/changes.proto new file mode 100644 index 0000000..6355975 --- /dev/null +++ b/objdiff-core/protos/changes.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +import "report.proto"; + +package objdiff.report; + +// A pair of reports to compare and generate changes +message ChangesInput { + // The previous report + Report from = 1; + // The current report + Report to = 2; +} + +// Changes between two reports +message Changes { + // The progress info for the previous report + Measures from = 1; + // The progress info for the current report + Measures to = 2; + // Units that changed + repeated ChangeUnit units = 3; +} + +// A changed unit +message ChangeUnit { + // The name of the unit + string name = 1; + // The previous progress info (omitted if new) + optional Measures from = 2; + // The current progress info (omitted if removed) + optional Measures to = 3; + // Sections that changed + repeated ChangeItem sections = 4; + // Functions that changed + repeated ChangeItem functions = 5; + // Extra metadata for this unit + optional ReportUnitMetadata metadata = 6; +} + +// A changed section or function +message ChangeItem { + // The name of the item + string name = 1; + // The previous progress info (omitted if new) + optional ChangeItemInfo from = 2; + // The current progress info (omitted if removed) + optional ChangeItemInfo to = 3; + // Extra metadata for this item + optional ReportItemMetadata metadata = 4; +} + +// Progress info for a section or function +message ChangeItemInfo { + // The overall match percent for this item + float fuzzy_match_percent = 1; + // The size of the item in bytes + uint64 size = 2; +} diff --git a/objdiff-core/protos/proto_descriptor.bin b/objdiff-core/protos/proto_descriptor.bin index 9312c29..c281ade 100644 Binary files a/objdiff-core/protos/proto_descriptor.bin and b/objdiff-core/protos/proto_descriptor.bin differ diff --git a/objdiff-core/protos/report.proto b/objdiff-core/protos/report.proto index ed7ebb8..279bbb0 100644 --- a/objdiff-core/protos/report.proto +++ b/objdiff-core/protos/report.proto @@ -2,6 +2,18 @@ syntax = "proto3"; package objdiff.report; +// Project progress report +message Report { + // Overall progress info + Measures measures = 1; + // Units within this report + repeated ReportUnit units = 2; + // Report version + uint32 version = 3; + // Progress categories + repeated ReportCategory categories = 4; +} + // Progress info for a report or unit message Measures { // Overall match percent, including partially matched functions and data @@ -38,18 +50,6 @@ message Measures { uint32 complete_units = 16; } -// Project progress report -message Report { - // Overall progress info - Measures measures = 1; - // Units within this report - repeated ReportUnit units = 2; - // Report version - uint32 version = 3; - // Progress categories - repeated ReportCategory categories = 4; -} - message ReportCategory { // The ID of the category string id = 1; @@ -108,57 +108,3 @@ message ReportItemMetadata { // The virtual address of the function or section optional uint64 virtual_address = 2; } - -// A pair of reports to compare and generate changes -message ChangesInput { - // The previous report - Report from = 1; - // The current report - Report to = 2; -} - -// Changes between two reports -message Changes { - // The progress info for the previous report - Measures from = 1; - // The progress info for the current report - Measures to = 2; - // Units that changed - repeated ChangeUnit units = 3; -} - -// A changed unit -message ChangeUnit { - // The name of the unit - string name = 1; - // The previous progress info (omitted if new) - optional Measures from = 2; - // The current progress info (omitted if removed) - optional Measures to = 3; - // Sections that changed - repeated ChangeItem sections = 4; - // Functions that changed - repeated ChangeItem functions = 5; - // Extra metadata for this unit - optional ReportUnitMetadata metadata = 6; -} - -// A changed section or function -message ChangeItem { - // The name of the item - string name = 1; - // The previous progress info (omitted if new) - optional ChangeItemInfo from = 2; - // The current progress info (omitted if removed) - optional ChangeItemInfo to = 3; - // Extra metadata for this item - optional ReportItemMetadata metadata = 4; -} - -// Progress info for a section or function -message ChangeItemInfo { - // The overall match percent for this item - float fuzzy_match_percent = 1; - // The size of the item in bytes - uint64 size = 2; -}