-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation to proto files (#243)
## Description This PR: * makes `protos/protoc.sh` executable in environments without protoc (and c++) installed * docker provides a reproducible protoc environment for regenerating pb.go files (jaegertracing/protobuf, libprotoc 3.8.0) * adds documentation to the hardware.proto file ## Why is this needed This starts the effort needed for #219 Additional .proto file docs would be needed to close that issue. ## How Has This Been Tested? Let me know how I should test this. I would like to include a `make protos` task. Should this be run by CI to check for uncommitted drift? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## How are existing users impacted? What migration steps/scripts do we need? <!--- Fixes a bug, unblocks installation, removes a component of the stack etc --> <!--- Requires a DB migration script, etc. --> ## Checklist: I have: - [x] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
- Loading branch information
Showing
6 changed files
with
753 additions
and
1,346 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# protoc.sh uses the local protoc if installed, otherwise | ||
# docker will be used with a complete environment provided | ||
# by https://github.com/jaegertracing/docker-protobuf. | ||
# Alternative images like grpc/go are very dated and do not | ||
# include the needed plugins and includes. | ||
# | ||
set -e | ||
|
||
GOPATH=${GOPATH:-$(go env GOPATH)} | ||
|
||
if command -v protoc >/dev/null; then | ||
GW_PATH="$GOPATH"/src/github.com/grpc-ecosystem/grpc-gateway | ||
GO111MODULES=on go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway | ||
|
||
PROTOC="protoc -I/usr/local/include -I$GW_PATH/third_party/googleapis --plugin=protoc-gen-grpc-gateway=$GOPATH/bin/protoc-gen-grpc-gateway" | ||
else | ||
IMAGE=jaegertracing/protobuf:0.2.0 | ||
BASE=/protos | ||
PROTOC="docker run -v $(pwd):$BASE -w $BASE --rm $IMAGE " | ||
fi | ||
|
||
for proto in hardware packet template workflow; do | ||
echo "Generating ${proto}.pb.go..." | ||
protoc -I ./ -I ./common/ -I "$GOPATH"/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis "${proto}/${proto}.proto" --go_out=plugins=grpc:./ --grpc-gateway_out=logtostderr=true:. | ||
$PROTOC -I./ \ | ||
-I./common \ | ||
--go_opt=paths=source_relative \ | ||
--go_out=plugins=grpc:./ \ | ||
--grpc-gateway_out=logtostderr=true:. \ | ||
"${proto}/${proto}.proto" | ||
done | ||
goimports -w . |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.