github.com/grafana/synthetic-monitoring-agent@v0.64.2/scripts/genproto.sh (about)

     1  #!/usr/bin/env bash
     2  # shellcheck disable=SC3044
     3  #
     4  # Generate all protobuf bindings.
     5  # Run from repository root.
     6  set -e
     7  set -u
     8  
     9  if test ! -e "scripts/genproto.sh" ; then
    10  	echo "must be run from repository root"
    11  	exit 255
    12  fi
    13  
    14  DIRS="pkg/pb/synthetic_monitoring"
    15  
    16  for dir in ${DIRS}; do
    17  	echo "Generating Protocol Buffers code in ${dir}"
    18  	pushd "${dir}" > /dev/null
    19  
    20  	# Check that are no breaking changes
    21  	buf breaking . --against ./checks.binpb
    22  
    23  	# Generate new code
    24  	buf generate
    25  	goimports -w .
    26  
    27  	# Capture the new data to validate future changes against
    28  	buf build --output checks.binpb
    29  	popd > /dev/null
    30  done