Files
matchbox/scripts/codegen
Dalton Hubble 219da4d934 *: Switch to a Makefile driven develop/release process
* Add make targets for vendor, docker-image, and tools
* Move scripts into the scripts folder
2017-01-18 02:11:27 -08:00

23 lines
593 B
Bash
Executable File

#!/usr/bin/env bash
# USAGE ./scripts/codegen
# Generate Go protocol buffer code from proto definitions
set -eu
# Add protoc and protoc-gen-go tools to PATH
export PATH=$PWD/bin:$PATH
# protobuf subpackages end in "pb"
PBUFS=$(go list ./... | grep -v /vendor | grep 'pb$')
# change into each protobuf directory
for pkg in $PBUFS ; do
abs_path=${GOPATH}/src/${pkg}
echo Generating $abs_path
pushd ${abs_path} > /dev/null
# generate protocol buffers, make other .proto files available to import
protoc --go_out=plugins=grpc:. -I=.:"${GOPATH}/src/" *.proto
popd > /dev/null
done