From fd8d0fb60ebbf8d1c24f7b5eb0453b09bfed626c Mon Sep 17 00:00:00 2001
From: Daniel Upton <daniel@floppy.co>
Date: Mon, 15 May 2023 16:44:20 +0100
Subject: [PATCH] tooling: generate protoset file

Extends the `proto` make target to generate a protoset file for use with
grpcurl etc.
---
 build-support/scripts/protobuf.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/build-support/scripts/protobuf.sh b/build-support/scripts/protobuf.sh
index 420d66d6a11b..19d241a1aa27 100755
--- a/build-support/scripts/protobuf.sh
+++ b/build-support/scripts/protobuf.sh
@@ -72,6 +72,10 @@ function main {
 
     status "Generated gRPC rate limit mapping file"
 
+    generate_protoset_file
+
+    status "Generated protoset file"
+
     return 0
 }
 
@@ -152,5 +156,9 @@ function generate_rate_limit_mappings {
     }
 }
 
+function generate_protoset_file {
+  print_run buf build -o "${SOURCE_DIR}/pkg/consul.protoset"
+}
+
 main "$@"
 exit $?