mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 22:40:03 +00:00
Improve import handling for proto conversion (#5673)
* Keep include prefix when converting from proto. This change preserves the include prefix when generating flatbuffers from proto (with FBS_GEN_INCLUDES) defined. * Improve handling of imports in proto conversion. Previously, there was no runtime flag to make proto->fbs conversion keep the import structure of a collection of files. This change makes proto conversion respect the --no-gen-includes flag and skip the output of "generated" symbols.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
ce3a1c43a2
commit
13c05f4da3
57
tests/prototest/test_include.golden
Normal file
57
tests/prototest/test_include.golden
Normal file
@@ -0,0 +1,57 @@
|
||||
// Generated from test.proto
|
||||
|
||||
include "imported.fbs";
|
||||
|
||||
namespace proto.test;
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum : int {
|
||||
NUL = 0,
|
||||
FOO = 1,
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5,
|
||||
}
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
table ProtoMessage {
|
||||
c:int = 16;
|
||||
d:long;
|
||||
p:uint;
|
||||
e:ulong;
|
||||
/// doc comment for f.
|
||||
f:int = -1;
|
||||
g:long;
|
||||
h:uint;
|
||||
q:ulong;
|
||||
i:int;
|
||||
j:long;
|
||||
/// doc comment for k.
|
||||
k:bool;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
l:string (required);
|
||||
m:[ubyte];
|
||||
n:proto.test.ProtoMessage_.OtherMessage;
|
||||
o:[string];
|
||||
z:proto.test.ImportedMessage;
|
||||
/// doc comment for r.
|
||||
r:proto.test.ProtoMessage_.Anonymous0;
|
||||
}
|
||||
|
||||
namespace proto.test.ProtoMessage_;
|
||||
|
||||
table OtherMessage {
|
||||
a:double;
|
||||
/// doc comment for b.
|
||||
b:float = 3.14149;
|
||||
}
|
||||
|
||||
table Anonymous0 {
|
||||
/// doc comment for s.
|
||||
s:proto.test.ImportedMessage;
|
||||
/// doc comment for t on 2
|
||||
/// lines.
|
||||
t:proto.test.ProtoMessage_.OtherMessage;
|
||||
}
|
||||
|
||||
61
tests/prototest/test_union_include.golden
Normal file
61
tests/prototest/test_union_include.golden
Normal file
@@ -0,0 +1,61 @@
|
||||
// Generated from test.proto
|
||||
|
||||
include "imported.fbs";
|
||||
|
||||
namespace proto.test;
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum : int {
|
||||
NUL = 0,
|
||||
FOO = 1,
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5,
|
||||
}
|
||||
|
||||
namespace proto.test.ProtoMessage_;
|
||||
|
||||
union RUnion {
|
||||
/// doc comment for s.
|
||||
proto.test.ImportedMessage,
|
||||
/// doc comment for t on 2
|
||||
/// lines.
|
||||
proto.test.ProtoMessage_.OtherMessage,
|
||||
}
|
||||
|
||||
namespace proto.test;
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
table ProtoMessage {
|
||||
c:int = 16;
|
||||
d:long;
|
||||
p:uint;
|
||||
e:ulong;
|
||||
/// doc comment for f.
|
||||
f:int = -1;
|
||||
g:long;
|
||||
h:uint;
|
||||
q:ulong;
|
||||
i:int;
|
||||
j:long;
|
||||
/// doc comment for k.
|
||||
k:bool;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
l:string (required);
|
||||
m:[ubyte];
|
||||
n:proto.test.ProtoMessage_.OtherMessage;
|
||||
o:[string];
|
||||
z:proto.test.ImportedMessage;
|
||||
/// doc comment for r.
|
||||
r:proto.test.ProtoMessage_.RUnion;
|
||||
}
|
||||
|
||||
namespace proto.test.ProtoMessage_;
|
||||
|
||||
table OtherMessage {
|
||||
a:double;
|
||||
/// doc comment for b.
|
||||
b:float = 3.14149;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user