rclone/vendor/google.golang.org/appengine/internal/regen.sh
Nick Craig-Wood f7af730b50 Use a vendor directory for repeatable builds - fixes #816
This is using godep to manage the vendor directory.
2016-11-05 18:18:08 +00:00

37 lines
932 B
Bash
Executable File

#!/bin/bash -e
#
# This script rebuilds the generated code for the protocol buffers.
# To run this you will need protoc and goprotobuf installed;
# see https://github.com/golang/protobuf for instructions.
PKG=google.golang.org/appengine
function die() {
echo 1>&2 $*
exit 1
}
# Sanity check that the right tools are accessible.
for tool in go protoc protoc-gen-go; do
q=$(which $tool) || die "didn't find $tool"
echo 1>&2 "$tool: $q"
done
echo -n 1>&2 "finding package dir... "
pkgdir=$(go list -f '{{.Dir}}' $PKG)
echo 1>&2 $pkgdir
base=$(echo $pkgdir | sed "s,/$PKG\$,,")
echo 1>&2 "base: $base"
cd $base
for f in $(find $PKG/internal -name '*.proto'); do
echo 1>&2 "* $f"
protoc --go_out=. $f
done
# Fix up import lines.
# This should be fixed upstream.
# https://code.google.com/p/goprotobuf/issues/detail?id=32
for f in $(find $PKG/internal -name '*.pb.go'); do
sed -i '/^import.*\.pb"$/s,/[^/]*\.pb"$,",' $f
done