2020-05-31 06:44:34 +00:00
|
|
|
#!/bin/bash
|
2021-03-24 19:57:27 +00:00
|
|
|
. "$(dirname "$0")"/common.sh
|
2020-05-31 06:44:34 +00:00
|
|
|
|
|
|
|
# Script to copy ssz.go files from bazel build folder to appropriate location.
|
|
|
|
# Bazel builds to bazel-bin/... folder, script copies them back to original folder where target is.
|
|
|
|
|
2021-09-16 17:32:51 +00:00
|
|
|
bazel query 'kind(ssz_gen_marshal, //proto/...) union kind(ssz_gen_marshal, //testing/fuzz/...)' | xargs bazel build
|
2020-05-31 06:44:34 +00:00
|
|
|
|
|
|
|
# Get locations of proto ssz.go files.
|
|
|
|
file_list=()
|
2020-06-03 21:15:37 +00:00
|
|
|
while IFS= read -d $'\0' -r file; do
|
2020-05-31 06:44:34 +00:00
|
|
|
file_list=("${file_list[@]}" "$file")
|
2021-03-24 19:57:27 +00:00
|
|
|
done < <($findutil -L "$(bazel info bazel-bin)"/ -type f -regextype sed -regex ".*ssz\.go$" -print0)
|
2020-05-31 06:44:34 +00:00
|
|
|
|
|
|
|
arraylength=${#file_list[@]}
|
|
|
|
searchstring="/bin/"
|
|
|
|
|
|
|
|
# Copy ssz.go files from bazel-bin to original folder where the target is located.
|
2020-12-01 01:55:30 +00:00
|
|
|
for ((i = 0; i < arraylength; i++)); do
|
2020-06-03 21:15:37 +00:00
|
|
|
destination=${file_list[i]#*$searchstring}
|
2021-03-24 19:57:27 +00:00
|
|
|
color "34" "$destination"
|
2021-05-21 16:27:33 +00:00
|
|
|
chmod 644 "$destination"
|
2020-06-03 21:15:37 +00:00
|
|
|
cp -R -L "${file_list[i]}" "$destination"
|
2020-05-31 06:44:34 +00:00
|
|
|
done
|