Skip to content

Commit

Permalink
chore: simplify protoc scripts
Browse files Browse the repository at this point in the history
The bin/protoc script is ancient and not useful, especially in light of tools
provided by dev containers. Furthermore, it includes a reference to an old gross
sourcefource downlaod page for unzip.

Furthermore, the protoc-go.sh script does seperate version pinning of build
dependencies.

To simplify all of this, this change removes the bin/protoc and bin/protoc-diff
scripts. The "proto" CI workflow is updated to use the protoc-go.sh script
directly.
  • Loading branch information
olix0r committed Dec 11, 2024
1 parent bc8866e commit c3377ae
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
- run: apt update && apt install -y unzip
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: bin/protoc-diff
- run: bin/protoc-go.sh
- run: git diff --exit-code
40 changes: 0 additions & 40 deletions bin/protoc

This file was deleted.

16 changes: 0 additions & 16 deletions bin/protoc-diff

This file was deleted.

17 changes: 5 additions & 12 deletions bin/protoc-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@

set -eu

bindir=$( cd "${0%/*}" && pwd )

if ! command -v protoc-gen-go-grpc >/dev/null ; then
go install -mod=readonly google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install -mod=readonly google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
fi

rm -rf controller/gen/common controller/gen/config viz/metrics-api/gen viz/tap/gen
mkdir -p controller/gen/common/net viz/metrics-api/gen/viz viz/tap/gen/tap

"$bindir"/protoc -I proto --go_out=paths=source_relative:controller/gen proto/common/net.proto
"$bindir"/protoc -I proto -I viz/metrics-api/proto --go_out=paths=source_relative:viz/metrics-api/gen viz/metrics-api/proto/viz.proto
"$bindir"/protoc -I proto -I viz/metrics-api/proto --go-grpc_out=paths=source_relative:viz/metrics-api/gen/viz viz/metrics-api/proto/viz.proto
"$bindir"/protoc -I proto -I viz/tap/proto -I viz/metrics-api/proto --go_out=paths=source_relative:viz/tap/gen viz/tap/proto/viz_tap.proto
"$bindir"/protoc -I proto -I viz/tap/proto -I viz/metrics-api/proto --go-grpc_out=paths=source_relative:viz/tap/gen/tap viz/tap/proto/viz_tap.proto
protoc -I proto --go_out=paths=source_relative:controller/gen proto/common/net.proto
protoc -I proto -I viz/metrics-api/proto --go_out=paths=source_relative:viz/metrics-api/gen viz/metrics-api/proto/viz.proto
protoc -I proto -I viz/metrics-api/proto --go-grpc_out=paths=source_relative:viz/metrics-api/gen/viz viz/metrics-api/proto/viz.proto
protoc -I proto -I viz/tap/proto -I viz/metrics-api/proto --go_out=paths=source_relative:viz/tap/gen viz/tap/proto/viz_tap.proto
protoc -I proto -I viz/tap/proto -I viz/metrics-api/proto --go-grpc_out=paths=source_relative:viz/tap/gen/tap viz/tap/proto/viz_tap.proto

mv controller/gen/common/net.pb.go controller/gen/common/net/
mv viz/metrics-api/gen/viz.pb.go viz/metrics-api/gen/viz/viz.pb.go
Expand Down
2 changes: 1 addition & 1 deletion controller/gen/common/net/net.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion viz/metrics-api/gen/viz/viz.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion viz/metrics-api/gen/viz/viz_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion viz/tap/gen/tap/viz_tap.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion viz/tap/gen/tap/viz_tap_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c3377ae

Please sign in to comment.