2019-01-06 14:55:10 +00:00
|
|
|
#!/bin/bash
|
2021-03-24 19:57:27 +00:00
|
|
|
. "$(dirname "$0")"/common.sh
|
2019-01-06 14:55:10 +00:00
|
|
|
|
|
|
|
# Script to copy pb.go files from bazel build folder to appropriate location.
|
|
|
|
# Bazel builds to bazel-bin/... folder, script copies them back to original folder where .proto is.
|
|
|
|
|
|
|
|
bazel build //proto/...
|
|
|
|
|
|
|
|
file_list=()
|
2020-06-03 21:15:37 +00:00
|
|
|
while IFS= read -d $'\0' -r file; do
|
2019-01-06 14:55:10 +00:00
|
|
|
file_list=("${file_list[@]}" "$file")
|
2021-03-24 19:57:27 +00:00
|
|
|
done < <($findutil -L "$(bazel info bazel-bin)"/proto -type f -regextype sed -regex ".*pb\.\(gw\.\)\?go$" -print0)
|
2020-06-03 21:15:37 +00:00
|
|
|
|
2019-01-06 14:55:10 +00:00
|
|
|
arraylength=${#file_list[@]}
|
2020-01-23 10:33:11 +00:00
|
|
|
searchstring="prysmaticlabs/prysm/"
|
2019-01-06 14:55:10 +00:00
|
|
|
|
|
|
|
# Copy pb.go files from bazel-bin to original folder where .proto is.
|
2020-12-01 01:55:30 +00:00
|
|
|
for ((i = 0; i < arraylength; i++)); do
|
2021-03-24 19:57:27 +00:00
|
|
|
color "34" "$destination"
|
2020-06-03 21:15:37 +00:00
|
|
|
destination=${file_list[i]#*$searchstring}
|
|
|
|
chmod 755 "$destination"
|
|
|
|
cp -R -L "${file_list[i]}" "$destination"
|
2019-01-06 14:55:10 +00:00
|
|
|
done
|
2019-03-17 20:19:38 +00:00
|
|
|
|
2020-06-03 21:15:37 +00:00
|
|
|
# Run goimports on newly generated protos until gogo protobuf's proto-gen-go
|
2019-03-17 20:19:38 +00:00
|
|
|
# formats imports properly.
|
|
|
|
# https://github.com/gogo/protobuf/issues/554
|
|
|
|
goimports -w proto/**/*.pb.go
|
2020-05-14 22:11:52 +00:00
|
|
|
gofmt -s -w proto/
|