Skip to content

Commit f1fc29f

Browse files
committed
Split report changes into separate proto
1 parent 7c4f1c5 commit f1fc29f

File tree

4 files changed

+80
-67
lines changed

4 files changed

+80
-67
lines changed

objdiff-core/build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ fn compile_protos() {
1919
.map(|m| m.modified().unwrap())
2020
.unwrap_or(std::time::SystemTime::UNIX_EPOCH);
2121
let mut run_protoc = false;
22-
let proto_files = vec![root.join("report.proto")];
22+
let proto_files = root
23+
.read_dir()
24+
.unwrap()
25+
.filter_map(|e| {
26+
let e = e.unwrap();
27+
let path = e.path();
28+
(path.extension() == Some(std::ffi::OsStr::new("proto"))).then_some(path)
29+
})
30+
.collect::<Vec<_>>();
2331
for proto_file in &proto_files {
2432
println!("cargo:rerun-if-changed={}", proto_file.display());
2533
let mtime = match std::fs::metadata(proto_file) {

objdiff-core/protos/changes.proto

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
syntax = "proto3";
2+
3+
import "report.proto";
4+
5+
package objdiff.report;
6+
7+
// A pair of reports to compare and generate changes
8+
message ChangesInput {
9+
// The previous report
10+
Report from = 1;
11+
// The current report
12+
Report to = 2;
13+
}
14+
15+
// Changes between two reports
16+
message Changes {
17+
// The progress info for the previous report
18+
Measures from = 1;
19+
// The progress info for the current report
20+
Measures to = 2;
21+
// Units that changed
22+
repeated ChangeUnit units = 3;
23+
}
24+
25+
// A changed unit
26+
message ChangeUnit {
27+
// The name of the unit
28+
string name = 1;
29+
// The previous progress info (omitted if new)
30+
optional Measures from = 2;
31+
// The current progress info (omitted if removed)
32+
optional Measures to = 3;
33+
// Sections that changed
34+
repeated ChangeItem sections = 4;
35+
// Functions that changed
36+
repeated ChangeItem functions = 5;
37+
// Extra metadata for this unit
38+
optional ReportUnitMetadata metadata = 6;
39+
}
40+
41+
// A changed section or function
42+
message ChangeItem {
43+
// The name of the item
44+
string name = 1;
45+
// The previous progress info (omitted if new)
46+
optional ChangeItemInfo from = 2;
47+
// The current progress info (omitted if removed)
48+
optional ChangeItemInfo to = 3;
49+
// Extra metadata for this item
50+
optional ReportItemMetadata metadata = 4;
51+
}
52+
53+
// Progress info for a section or function
54+
message ChangeItemInfo {
55+
// The overall match percent for this item
56+
float fuzzy_match_percent = 1;
57+
// The size of the item in bytes
58+
uint64 size = 2;
59+
}
32 Bytes
Binary file not shown.

objdiff-core/protos/report.proto

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ syntax = "proto3";
22

33
package objdiff.report;
44

5+
// Project progress report
6+
message Report {
7+
// Overall progress info
8+
Measures measures = 1;
9+
// Units within this report
10+
repeated ReportUnit units = 2;
11+
// Report version
12+
uint32 version = 3;
13+
// Progress categories
14+
repeated ReportCategory categories = 4;
15+
}
16+
517
// Progress info for a report or unit
618
message Measures {
719
// Overall match percent, including partially matched functions and data
@@ -38,18 +50,6 @@ message Measures {
3850
uint32 complete_units = 16;
3951
}
4052

41-
// Project progress report
42-
message Report {
43-
// Overall progress info
44-
Measures measures = 1;
45-
// Units within this report
46-
repeated ReportUnit units = 2;
47-
// Report version
48-
uint32 version = 3;
49-
// Progress categories
50-
repeated ReportCategory categories = 4;
51-
}
52-
5353
message ReportCategory {
5454
// The ID of the category
5555
string id = 1;
@@ -108,57 +108,3 @@ message ReportItemMetadata {
108108
// The virtual address of the function or section
109109
optional uint64 virtual_address = 2;
110110
}
111-
112-
// A pair of reports to compare and generate changes
113-
message ChangesInput {
114-
// The previous report
115-
Report from = 1;
116-
// The current report
117-
Report to = 2;
118-
}
119-
120-
// Changes between two reports
121-
message Changes {
122-
// The progress info for the previous report
123-
Measures from = 1;
124-
// The progress info for the current report
125-
Measures to = 2;
126-
// Units that changed
127-
repeated ChangeUnit units = 3;
128-
}
129-
130-
// A changed unit
131-
message ChangeUnit {
132-
// The name of the unit
133-
string name = 1;
134-
// The previous progress info (omitted if new)
135-
optional Measures from = 2;
136-
// The current progress info (omitted if removed)
137-
optional Measures to = 3;
138-
// Sections that changed
139-
repeated ChangeItem sections = 4;
140-
// Functions that changed
141-
repeated ChangeItem functions = 5;
142-
// Extra metadata for this unit
143-
optional ReportUnitMetadata metadata = 6;
144-
}
145-
146-
// A changed section or function
147-
message ChangeItem {
148-
// The name of the item
149-
string name = 1;
150-
// The previous progress info (omitted if new)
151-
optional ChangeItemInfo from = 2;
152-
// The current progress info (omitted if removed)
153-
optional ChangeItemInfo to = 3;
154-
// Extra metadata for this item
155-
optional ReportItemMetadata metadata = 4;
156-
}
157-
158-
// Progress info for a section or function
159-
message ChangeItemInfo {
160-
// The overall match percent for this item
161-
float fuzzy_match_percent = 1;
162-
// The size of the item in bytes
163-
uint64 size = 2;
164-
}

0 commit comments

Comments
 (0)