2019-01-06 06:55:10 -08:00
|
|
|
#!/bin/bash
|
2021-03-24 14:57:27 -05:00
|
|
|
. "$(dirname "$0")"/common.sh
|
2019-01-06 06:55:10 -08: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.
|
|
|
|
|
2023-03-10 11:49:34 -06:00
|
|
|
bazel query 'attr(testonly, 0, //proto/...)' | xargs bazel build $@
|
2019-01-06 06:55:10 -08:00
|
|
|
|
|
|
|
file_list=()
|
2020-06-04 00:15:37 +03:00
|
|
|
while IFS= read -d $'\0' -r file; do
|
2019-01-06 06:55:10 -08:00
|
|
|
file_list=("${file_list[@]}" "$file")
|
2021-03-24 14:57:27 -05:00
|
|
|
done < <($findutil -L "$(bazel info bazel-bin)"/proto -type f -regextype sed -regex ".*pb\.\(gw\.\)\?go$" -print0)
|
2020-06-04 00:15:37 +03:00
|
|
|
|
2019-01-06 06:55:10 -08:00
|
|
|
arraylength=${#file_list[@]}
|
2023-03-17 11:52:56 -07:00
|
|
|
searchstring="prysmaticlabs/prysm/v4/"
|
2019-01-06 06:55:10 -08:00
|
|
|
|
|
|
|
# Copy pb.go files from bazel-bin to original folder where .proto is.
|
2020-11-30 19:55:30 -06:00
|
|
|
for ((i = 0; i < arraylength; i++)); do
|
2021-03-24 14:57:27 -05:00
|
|
|
color "34" "$destination"
|
2020-06-04 00:15:37 +03:00
|
|
|
destination=${file_list[i]#*$searchstring}
|
|
|
|
cp -R -L "${file_list[i]}" "$destination"
|
2024-01-23 01:54:30 -06:00
|
|
|
chmod 755 "$destination"
|
2019-01-06 06:55:10 -08:00
|
|
|
done
|
2019-03-17 16:19:38 -04:00
|
|
|
|
2021-05-17 14:32:04 -04:00
|
|
|
# Run goimports on newly generated protos
|
2019-03-17 16:19:38 -04:00
|
|
|
# formats imports properly.
|
|
|
|
# https://github.com/gogo/protobuf/issues/554
|
2021-10-26 05:07:49 -05:00
|
|
|
goimports -w proto
|
|
|
|
gofmt -s -w proto
|