32 lines
929 B
Bash
Executable file
32 lines
929 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
require_binary() {
|
|
local binary="$1"
|
|
local hint="$2"
|
|
if ! command -v "$binary" >/dev/null 2>&1; then
|
|
echo "Missing required binary: $binary" >&2
|
|
echo "$hint" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
require_binary protoc "Install Protocol Buffers compiler and ensure protoc is on PATH."
|
|
require_binary protoc-gen-dart "Install Dart plugin: dart pub global activate protoc_plugin, then add pub-cache/bin to PATH."
|
|
require_binary protoc-gen-go "Install Go plugin: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest, then add GOPATH/bin to PATH."
|
|
|
|
(
|
|
protoc \
|
|
--proto_path="$repo_root/proto" \
|
|
--dart_out="$repo_root/dart/lib/src/packets" \
|
|
message_common.proto
|
|
)
|
|
|
|
(
|
|
cd "$repo_root/go"
|
|
protoc --go_out=. --go_opt=paths=source_relative packets/message_common.proto
|
|
)
|
|
|
|
"$repo_root/tools/check_proto_sync.sh"
|