github.com/prysmaticlabs/prysm@v1.4.4/scripts/update-go-ssz.sh (about)

     1  #!/bin/bash
     2  . "$(dirname "$0")"/common.sh
     3  
     4  # Script to copy ssz.go files from bazel build folder to appropriate location.
     5  # Bazel builds to bazel-bin/... folder, script copies them back to original folder where target is.
     6  
     7  bazel query 'kind(ssz_gen_marshal, //proto/...) union kind(ssz_gen_marshal, //fuzz/...)' | xargs bazel build
     8  
     9  # Get locations of proto ssz.go files.
    10  file_list=()
    11  while IFS= read -d $'\0' -r file; do
    12      file_list=("${file_list[@]}" "$file")
    13  done < <($findutil -L "$(bazel info bazel-bin)"/ -type f -regextype sed -regex ".*ssz\.go$" -print0)
    14  
    15  arraylength=${#file_list[@]}
    16  searchstring="/bin/"
    17  
    18  # Copy ssz.go files from bazel-bin to original folder where the target is located.
    19  for ((i = 0; i < arraylength; i++)); do
    20      destination=${file_list[i]#*$searchstring}
    21      color "34" "$destination"
    22      chmod 644 "$destination"
    23      cp -R -L "${file_list[i]}" "$destination"
    24  done