Skip to content

Commit

Permalink
Responded to Arvind's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
aranjans committed May 30, 2024
1 parent 5878795 commit 77ac334
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
24 changes: 12 additions & 12 deletions scripts/install_protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ set -eu -o pipefail

source "$(dirname $0)/vet-common.sh"

# Perform installation of protoc from source based on OS.

# The version of protoc that will be installed.
PROTOC_VERSION="25.2"

# Function to download pre-built binaries for Linux with
Expand All @@ -32,7 +31,7 @@ download_binary() {
return
else
echo "Existing protoc version ($installed_version) differs. Kindly make sure you have $PROTOC_VERSION installed."
# exit 1
exit 1
fi
else
echo "Unable to determine installed protoc version. Starting the installation."
Expand All @@ -46,18 +45,19 @@ download_binary() {
rm "protoc-${PROTOC_VERSION}-$2-$1.zip"
}

# Determine architecture
if [[ $(uname -m) == "x86_64" ]]; then
ARCH="x86_64"
elif [[ $(uname -m) == "aarch64" ]] || [[ $(uname -m) == "arm64" ]] ; then
ARCH="aarch_64"
else
die "Unsupported architecture. Please consider manual installation."
fi
# Detect the architecture
case "$(uname -m)" in
"x86_64") ARCH="x86_64";;
"aarch64") ARCH="aarch_64";;
"arm64") ARCH="aarch_64";;
*) die "Unsupported architecture. Please consider manual installation from \
https://github.com/protocolbuffers/protobuf/releases/ and add to PATH."
esac

# Detect the Operating System
case "$(uname -s)" in
"Darwin") download_binary $ARCH "osx" "$1";;
"Linux") download_binary $ARCH "linux" "$1";;
*) echo "Please consider manual installation from \
*) die "Unsupported OS. Please consider manual installation from \
https://github.com/protocolbuffers/protobuf/releases/ and add to PATH" ;;
esac
7 changes: 3 additions & 4 deletions scripts/regenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ WORKDIR=$(mktemp -d)
function finish {
rm -rf "$WORKDIR"
# Revert back the PATH to client's original value
export PATH=$RESTORED_PATH
echo "Restored PATH to older value: $PATH"
export PATH=$ORIGINAL_PATH
echo "Restored PATH variable to original value."
}
trap finish EXIT

GOBIN="${WORKDIR}"/bin
RESTORED_PATH=$PATH
ORIGINAL_PATH=$PATH
export PATH="${GOBIN}:${PATH}"
mkdir -p "${GOBIN}"

Expand All @@ -52,7 +52,6 @@ mkdir -p "${WORKDIR}/googleapis/google/rpc"
echo "curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto"
curl --silent https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > "${WORKDIR}/googleapis/google/rpc/code.proto"

#chmod +x ./scripts/install_protoc.sh
source ./scripts/install_protoc.sh $WORKDIR

mkdir -p "${WORKDIR}/out"
Expand Down
13 changes: 5 additions & 8 deletions scripts/vet-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ trap cleanup EXIT
# consistent with the place where all binaries installed by scripts in this repo
# go.)
if [[ "$1" = "-install" ]]; then
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then
PROTOBUF_VERSION=25.2 # Shows up in pb.go files as v4.22.0
PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
source ./scripts/install_protoc.sh "/home/runner/go"
else
# TODO: replace with install protoc when https://github.com/grpc/grpc-go/pull/7064 is merged.
die "-install currently intended for use in CI only."
fi
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then
source ./scripts/install_protoc.sh "/home/runner/go"
else
die "run protoc installer https://github.com/grpc/grpc-go/scripts/install_protoc.sh."
fi
echo SUCCESS
exit 0
elif [[ "$#" -ne 0 ]]; then
Expand Down

0 comments on commit 77ac334

Please sign in to comment.