github.com/kaituanwang/hyperledger@v2.0.1+incompatible/scripts/compile_protos.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright IBM Corp. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  set -eux -o pipefail
     9  
    10  # Find all proto dirs to be processed
    11  PROTO_DIRS="$(find "$(pwd)" \
    12      -path "$(pwd)/vendor" -prune -o \
    13      -path "$(pwd)/build" -prune -o \
    14      -name '*.proto' -print0 | \
    15      xargs -0 -n 1 dirname | \
    16      sort -u | grep -v testdata)"
    17  
    18  for dir in ${PROTO_DIRS}; do
    19      protoc --proto_path="$dir" --go_out=plugins=grpc,paths=source_relative:"$dir" "$dir"/*.proto
    20  done