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 zcmZveJ#ZUE6vyvN(%qgutdk{0C!bGe`7Fz_boz+nSRsNqR1{2#%+N77i9-^IeW{XsTnubZnJp)6{N5@d{F_VFYj+){B_SQQCgR6bo{r%tDx3~ZG*H83cpXkqj zX|-MsS$=VNJYSp)ju-QjxmTRudT{6d-MfSISN@{?-I*S}FwP#YZ&~aO9}hMWwauHFpfM;_soo4Wb4ebG(+>u9Dg=$4Kd7OY%rE*8JfVdoLf1MOhmOh z>j(%_4*zr9o@s_|VXPn>5{_GykWTAr&GQHn&T7a4Az^r?%io+d_;2|QwkCeUe1Sim ztU}d%ob4L~}es$olrw5v|q8O#ByqBDtru&p}(sNVx* z0IDm<091F<&R`Bu{X&Cv1%#l%f9}VCOh64)9&NQ@ugJV6tqWVSJankZFAk_Y3s6&K zLL1DcD$fGcROMk|z&{>Pc^MijC<7=^4AP_RKc_Bv}Jw18OVC2Gn+Z3E6Z)umpspQA$OY7Gt;uY8&+H-F4xl`sp30O5)Ki)AfO;xZ!87~F z6z~s6-ecV;0PL%51%Q2(tpKo(Y;>h{qv)B5;rsR0&H2f}`>mtXhqn$Ft@+*7>Cyd@ zN9p~>D(EGukRtRFXIWNXgkDl_ux+7Nf?te`zz_Ls*xjclqjo9Sqyrg_X^ zhKU<(Xf^r~H_p=P?A6rda$27M{>qid!oBQe=`2|77@l8k-Mn|$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Z%6fCievdp-y^&PE$*m0a|$2C@ta%UKTenp%)-DD`lcBZ1sdwi&3G5C^}NBbcXOq`cEj^8LEkN6kZP#h0)aoY z6EYPLQVqw(X+^4GX{3+26H@K++Hlxg9sNhFEs8h_)kG0TwxiTU5l6`st|{HLn0ZUv z;@#z1R?OcmD@BhXi6tzr>l1F1f45xVcb79=yn^PsDh&|A*PWEq1cK%|OVcGu#?l7= zc6kvbVPqpD2_qYhzb&kRw4t_T={U_z-hQ>Xg-0C1W=PT@v8fsYYmnGf4FLp+O*BLa zd$C#cHqjmsf{r-lUA}g4^}XH|Z*6sDM5#j!6L*Dqn^;VCt&JU;ckoqlv$Bq>7q9oc z{#9>ujXztkUQXb%fslxdv8aL&xI=I%3K{~!{|Ri`hA;Cj(Tn`!)7{to0Q9wZMO8dX z0f=!>tCBD=89=DrCAct`rJByndqgkr#F@pjemsgIUIl8X3Sg)v(%&N!S*3=$0Onl` zuJ8u*5#hg|oKjloa=Zw&(B^8iYiY)q)RL-_NhB0sqpJ?CeSKyT;JTLgML#3?EPe9iz%vjK$O z4yiY23k^V7^dZqcAv|@ux+P8=7rgl}IB_aY{L%lNc+XoI^{)GcMHEaS%s+HMXgmrI z9S{j01&2;W)gKeR>bCwp+Jhng;&e$C2r<|Yf&zWf29F6Y6|r5cN(t95HX!sL6BJvt z0mV?5yM#MuUQ}A5`n!i(q6u~nwS=8rg6rCs7RSCz@ZlC$J{4$B6uWxfUlvWUcc>+r zU@s^%qM@}H6dF*nQRpQU+F{WrMEs(;b^dN6!~Z^$nH2TLchP)8tgO5S98vFm!arDQ z9}@|IQQ3WhZ<>OL-Y57gQxF;U31+zkw~pA#Q^L1jn>p$)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; -}