-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add go protoc plugin install script
- Loading branch information
Showing
4 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
UNAME_OS=$(uname -s) | ||
UNAME_ARCH=$(uname -m) | ||
|
||
NORMALIZED_OS=$UNAME_OS | ||
if [ "$NORMALIZED_OS" = "Linux" ]; then | ||
NORMALIZED_OS="linux" | ||
fi | ||
|
||
NORMALIZED_ARCH=$UNAME_ARCH | ||
if [ "$NORMALIZED_ARCH" = "x86_64" ]; then | ||
NORMALIZED_ARCH="amd64" | ||
fi | ||
|
||
export UNAME_OS | ||
export UNAME_ARCH | ||
export NORMALIZED_OS | ||
export NORMALIZED_ARCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
UNAME_OS=$(uname -s) | ||
UNAME_ARCH=$(uname -m) | ||
source scripts/executor-info.sh | ||
|
||
BUF_VERSION=$1 | ||
|
||
IFS=" " read -r -a PROTOC_PLUGINS <<< "$2" | ||
for part in "${PROTOC_PLUGINS[@]}"; do | ||
IFS="@" read -r -a langAndVersion <<< "$part" | ||
|
||
if [ "${#langAndVersion[@]}" != 2 ]; then | ||
echo "Malformed plugin specifier \"$part\", expected e.g. [email protected]" | ||
exit 1 | ||
fi | ||
|
||
bash "scripts/install-${langAndVersion[0]}-plugin.sh" "${langAndVersion[1]}" | ||
done | ||
|
||
if [ ! -f ".bin/buf" ]; then | ||
echo "Installing buf $BUF_VERSION for OS $UNAME_OS Arch $UNAME_ARCH" | ||
mkdir -p .bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source scripts/executor-info.sh | ||
|
||
GO_PROTOC_VERSION=$1 | ||
|
||
if [ ! -f ".bin/protoc-gen-go" ] || .bin/protoc-gen-go --version | grep -q "$GO_PROTOC_VERSION"; then | ||
echo "Installing protobuf-gen-go $GO_PROTOC_VERSION for OS $UNAME_OS Arch $UNAME_ARCH" | ||
mkdir -p .bin | ||
curl --fail -sSL "https://github.com/protocolbuffers/protobuf-go/releases/download/$GO_PROTOC_VERSION/protoc-gen-go.$GO_PROTOC_VERSION.$NORMALIZED_OS.$NORMALIZED_ARCH.tar.gz" -o .bin/protoc-gen-go.tar.gz | ||
tar -xf .bin/protoc-gen-go.tar.gz -C .bin | ||
chmod +x .bin/protoc-gen-go | ||
fi |