File tree 4 files changed +30
-11
lines changed
4 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 1
1
# CustomProtobufPluginExample
2
- Custom Protobuf Plugin Example in Python
2
+ An example about making a custom Protocol Buffers plugin in python with custom options
3
+
4
+ # What is Protocol Buffers :
5
+
6
+ https://developers.google.com/protocol-buffers
7
+
8
+ https://github.com/protocolbuffers/protobuf
9
+
10
+ # Plugin
11
+
12
+ We defined an custom option for protocol buffer in custom_options.proto.
13
+ And we use this custom option in our test.proto as an example.
14
+
15
+ Plugin read the input .proto files and generate an header .h file based on that.
16
+ Header .h file contain information about which fields use custom options in our custom_options.proto.
17
+
18
+ # Generate plugin
19
+
20
+ Run 'gen_plugin.sh' to generate our custom plugin
21
+
22
+ # Use plugin
23
+
24
+ After plugin has generated.
25
+ Run 'run_plugin.sh' to use plugin.
Original file line number Diff line number Diff line change
1
+ rm -rf dist
2
+ mkdir dist
3
+
4
+ protoc --proto_path=. --python_out=. custom_options.proto
5
+ pyinstaller --onefile custom_plugin.py
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ protoc --plugin=protoc-gen-custom=dist/custom_plugin --custom_out=./build test.proto
You can’t perform that action at this time.
0 commit comments