Skip to content

Commit d8e556d

Browse files
Update README.
1 parent 344d303 commit d8e556d

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
# 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.

gen_plugin.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rm -rf dist
2+
mkdir dist
3+
4+
protoc --proto_path=. --python_out=. custom_options.proto
5+
pyinstaller --onefile custom_plugin.py

run.sh

-10
This file was deleted.

run_plugin.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
protoc --plugin=protoc-gen-custom=dist/custom_plugin --custom_out=./build test.proto

0 commit comments

Comments
 (0)