-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmessage.proto
More file actions
67 lines (56 loc) · 1.74 KB
/
Copy pathmessage.proto
File metadata and controls
67 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
syntax = "proto3";
// Namespaced under `gazelle_py` so message FQNs (e.g.
// gazelle_py.import_extractor.PyModule) don't collide with other gazelle
// plugins that happen to define their own `import_extractor` proto package.
// Plain Go imports are unaffected — those are pinned by `go_package` below.
package gazelle_py.import_extractor;
option go_package = "github.com/hermeticbuild/gazelle_py/py/proto";
message Request {
uint32 id = 1;
oneof data {
PyQueryRequest py_query = 2;
}
}
message Response {
uint32 id = 1;
oneof data {
PyResponseResult py_result = 2;
ResponseError error = 4;
}
}
message ResponseError {
string message = 1;
}
// --- Python ---
message PyQueryRequest {
repeated PyFileSpec files = 1;
}
// PyFileSpec describes a single file to parse. We pass both the absolute
// path (so the Rust side can read the bytes off disk) and a workspace-
// relative path (so the resulting PyModule.filepath stays portable across
// sandbox boundaries).
message PyFileSpec {
string path = 1; // absolute or runfiles-resolvable path to read
string rel_path = 2; // workspace-relative path stamped into the output
}
message PyResponseResult {
repeated PyFileOutput results = 1;
}
message PyFileOutput {
string file_name = 1;
repeated PyModule modules = 2;
repeated string comments = 3;
bool has_main = 4;
// is_empty is true when the file's parsed AST contains no top-level
// statements (purely whitespace and/or comments). A bare docstring,
// `pass`, or any import/assignment counts as a statement and yields
// false. Drives `python_skip_empty_init`.
bool is_empty = 5;
}
message PyModule {
string name = 1;
uint32 lineno = 2;
string filepath = 3;
string from = 4;
bool type_checking_only = 5;
}