Created
January 28, 2020 18:46
-
-
Save asim/d5a8541cf04d96a78f2cb12cb96b066c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
function trap_handler { | |
MYSELF="$0" # equals to my script name | |
LASTLINE="$1" # argument 1: last line of error occurence | |
LASTERR="$2" # argument 2: error code of last command | |
echo "Error: line ${LASTLINE} - exit status of last command: ${LASTERR}" | |
exit $2 | |
} | |
trap 'trap_handler ${LINENO} ${$?}' ERR | |
echo "Checking dependencies..." | |
which protoc | |
which protoc-gen-go | |
echo "Building protobuf code..." | |
DIR=`pwd` | |
SRCDIR=`cd $DIR && cd ../../../.. && pwd` | |
echo "DIR $DIR" | |
echo "SRCDIR $SRCDIR" | |
find $DIR/proto -name '*.pb.go' -exec rm {} \; | |
find $DIR/proto -name '*.micro.go' -exec rm {} \; | |
find $DIR/proto -name '*.proto' -exec echo {} \; | |
find $DIR/proto -name '*.proto' -exec protoc --proto_path=$SRCDIR --micro_out=${SRCDIR} --go_out=${SRCDIR} {} \; | |
#find $DIR/proto -name '*.proto' -exec protoc --proto_path=$SRCDIR --micro_out=${SRCDIR} --go_out=plugins=grpc:${SRCDIR} {} \; | |
echo "Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment