github.com/coreos/rocket@v1.30.1-0.20200224141603-171c416fac02/scripts/genproto.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Generate rkt protobuf bindings. 4 # Run from repository root. 5 # 6 set -e 7 8 if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then 9 echo "must be run from repository root" 10 exit 255 11 fi 12 13 if ! [[ $(protoc --version) =~ "3.1.0" ]]; then 14 echo "could not find protoc 3.1.0, is it installed + in PATH?" 15 exit 255 16 fi 17 18 export PATH=.:${PATH} 19 cd $GOPATH/src/github.com/rkt/rkt 20 21 echo "building protoc-gen-go" 22 pushd vendor/github.com/golang/protobuf/protoc-gen-go 23 go build 24 mv protoc-gen-go $(dirs -l +1) 25 popd 26 27 trap 'rm -f "protoc-gen-go"' EXIT 28 29 echo "generating code" 30 API_DIR="${PWD}/api/v1alpha" 31 protoc -I "${API_DIR}" "${API_DIR}"/*.proto --go_out=plugins=grpc:"${API_DIR}" 32 echo "generating HTML documentation" 33 sudo rkt \ 34 --insecure-options=image \ 35 run \ 36 --volume=volume-out,kind=host,source="${API_DIR}"/docs \ 37 --volume=volume-protos,kind=host,source="${API_DIR}" \ 38 docker://pseudomuto/protoc-gen-doc:1.0.0 \ 39 --user=$UID \ 40 --group=$GID 41 echo "generating Markdown documentation" 42 sudo rkt \ 43 --insecure-options=image \ 44 run \ 45 --volume=volume-out,kind=host,source="${API_DIR}"/docs \ 46 --volume=volume-protos,kind=host,source="${API_DIR}" \ 47 docker://pseudomuto/protoc-gen-doc:1.0.0 \ 48 --user=$UID \ 49 --group=$GID \ 50 --exec=/entrypoint.sh \ 51 -- \ 52 --doc_opt=markdown,docs.md