From f1fc29f77eb36a9d623a09d82dc6b0c91877fa68 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 8 Mar 2025 14:39:15 -0700 Subject: [PATCH] Split report changes into separate proto --- objdiff-core/build.rs | 10 ++- objdiff-core/protos/changes.proto | 59 +++++++++++++++++ objdiff-core/protos/proto_descriptor.bin | Bin 17601 -> 17633 bytes objdiff-core/protos/report.proto | 78 ++++------------------- 4 files changed, 80 insertions(+), 67 deletions(-) create mode 100644 objdiff-core/protos/changes.proto 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 9312c29c4cb4829bd2bc9c94a0fe5707ec55ee82..c281ade0bb1343851ead9bd257d3dc12f0df7237 100644 GIT binary patch delta 2599 zcmX@u$@s97al-=zg{KBwJVmJm`9&pq1x5KK`9gg8Nm(hGX=!>8(a9T?&uwN@+{m=K zUPX(A%WJYC7n=|Z14HiQ039(dRW2qL1|b$!2ENHzMv6iVj6%$;9DH0VTr4aMObkNI z?33pjDHt#?F|Y|SvompV@o=$%Bp8L5*|~*bJZ2$gb}?}-b+9HzA!g3WZ;h1g7?>DY zgqS(uni$!Hm^rycp_&*$>cpgBJZ2$gPC0olS+EgILd@Kg{fs3iKjKm2QUVJx3o-Lf zo^C8>$H2tQBE-xKH!-sGBL0UF$*)XgLN}9fx<$V1L8tPCI)69W??ybE-kPo zMj>X=$$GkK28>LMtU}D9OdL>6AhSg|AtA%a#Kr4QD`B*ZK}xkXpofRTxb zRft&}u8E0Jh*_Ky5;BZTOw2;e;u4ZvnqW=LLd=qr@9U}>FfuW-3NcH*t zUS^Owc?GERScI6RC!6SjoX5f{#4HWBiG@*!SsLy<7G@!4X}I%Pg_vb0cjftdEX1rREyJY-*2E#itUS3-U&(-xiGx*$ zSsAX0gHecCnNtd?iGx{)Sy@(&OAoAxQ;1o0@&kP>14brJRv~6pxbrv}g_u=26rq|p znT42DRn)jF!J4>)nAIo$GmxDeZXjX6$i&4e#H%wj0Wfo%A zRZs$FX+|bKA!dChDJgM-m_4nDxaaxpcr@<`-gSHDr>NlAmm6AURpzh+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{$vrMA jCJ@bxtU@e{V9~-24z@+GXyFD2+ag8*!6Y_tOVbzt>GB!9 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; -}