Skip to content

Commit 01bc889

Browse files
committed
make: Add check for protobuf dependencies
1 parent 4ebf908 commit 01bc889

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ generate: tools
8888
# If you are working on changes to protobuf interfaces you may either use
8989
# this target or run the individual scripts below directly.
9090
protobuf:
91+
bash scripts/protobuf-check.sh
9192
bash internal/tfplugin5/generate.sh
9293
bash plans/internal/planproto/generate.sh
9394

‎scripts/protobuf-check.sh‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Check whether protobuf & go plugin are installed
4+
PROTOC_HELP_URL="http://google.github.io/proto-lens/installing-protoc.html"
5+
PROTOC_GEN_GO_HELP_URL="https://github.com/golang/protobuf/tree/v1.3.2#installation"
6+
7+
EXIT_CODE=0
8+
9+
which protoc >/dev/null
10+
if [ $? -ne 0 ]; then
11+
echo "Protocol Buffers not found."
12+
echo "Please install Protocol Buffers and ensure 'protoc' is available in your PATH."
13+
echo "See ${PROTOC_HELP_URL} for more."
14+
echo
15+
EXIT_CODE=1
16+
fi
17+
18+
which protoc-gen-go >/dev/null
19+
if [ $? -ne 0 ]; then
20+
echo "Protocol Buffers Go plugin not found."
21+
echo "Please install the plugin and ensure 'protoc-gen-go' is available in your PATH."
22+
echo "See ${PROTOC_GEN_GO_HELP_URL} for more."
23+
echo
24+
EXIT_CODE=1
25+
fi
26+
27+
exit $EXIT_CODE

0 commit comments

Comments
 (0)