-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add go:generate directive for protobuf (#11997)
* Add go:generate directive for protobuf * Add protoc to Makefile * Add protoc binary * Attempt install protoc-gen-go-wsrpc * w * w * w * executable * Update versions
- Loading branch information
Showing
7 changed files
with
67 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 |
---|---|---|
|
@@ -5,4 +5,4 @@ postgres 13.3 | |
helm 3.10.3 | ||
zig 0.10.1 | ||
golangci-lint 1.55.2 | ||
protoc 23.2 | ||
protoc 25.1 |
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 |
---|---|---|
|
@@ -88,7 +88,7 @@ abigen: ## Build & install abigen. | |
./tools/bin/build_abigen | ||
|
||
.PHONY: generate | ||
generate: abigen codecgen mockery ## Execute all go:generate commands. | ||
generate: abigen codecgen mockery protoc ## Execute all go:generate commands. | ||
go generate -x ./... | ||
|
||
.PHONY: testscripts | ||
|
@@ -124,6 +124,11 @@ mockery: $(mockery) ## Install mockery. | |
codecgen: $(codecgen) ## Install codecgen | ||
go install github.com/ugorji/go/codec/[email protected] | ||
|
||
.PHONY: protoc | ||
protoc: ## Install protoc | ||
core/scripts/install-protoc.sh 25.1 / | ||
go install google.golang.org/protobuf/cmd/protoc-gen-go@`go list -m -json google.golang.org/protobuf | jq -r .Version` | ||
|
||
.PHONY: telemetry-protobuf | ||
telemetry-protobuf: $(telemetry-protobuf) ## Generate telemetry protocol buffers. | ||
protoc \ | ||
|
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,54 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
|
||
VERSION=$1 | ||
|
||
if [ "$VERSION" == "" ]; then | ||
echo "version required" | ||
exit 1 | ||
fi | ||
|
||
os=$(uname) | ||
arch=$(uname -m) | ||
|
||
install_dir=$HOME/.local | ||
$install_dir/bin/protoc --version | grep $VERSION | ||
rc=$? | ||
if [ $rc -eq 0 ]; then | ||
# we have the current VERSION | ||
echo "protoc up-to-date @ $VERSION" | ||
exit 0 | ||
fi | ||
|
||
|
||
if [ "$os" == "Linux" ] ; then | ||
os="linux" | ||
if [$arch != "x86_64"]; then | ||
echo "unsupported os $os-$arch update $0" | ||
exit 1 | ||
fi | ||
elif [ "$os" == "Darwin" ] ; then | ||
os="osx" | ||
# make life simply and download the universal binary | ||
arch="universal_binary" | ||
else | ||
echo "unsupported os $os. update $0" | ||
exit 1 | ||
fi | ||
|
||
workdir=$(mktemp -d) | ||
pushd $workdir | ||
pb_url="https://github.com/protocolbuffers/protobuf/releases" | ||
artifact=protoc-$VERSION-$os-$arch.zip | ||
curl -LO $pb_url/download/v${VERSION}/$artifact | ||
if [[ ! -d $install_dir ]]; then | ||
mkdir $install_dir | ||
fi | ||
unzip -uo $artifact -d $install_dir | ||
rm $artifact | ||
|
||
echo "protoc $VERSION installed in $install_dir" | ||
echo "Add $install_dir/bin to PATH" | ||
export PATH=$install_dir/bin:$PATH | ||
popd |
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,2 @@ | ||
//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-wsrpc_out=. --go-wsrpc_opt=paths=source_relative mercury.proto | ||
package pb |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.