# Code generation for the gateway's Connect edge contract. The generated Go is
# COMMITTED; CI only builds it (the same dev-time model as backend/cmd/jetgen and
# pkg/Makefile). The FlatBuffers payloads live in pkg (generate them with
# `make -C ../pkg fbs`).
#
# Prerequisites:
#   make tools     # go install the local protoc-gen-* plugins
# Then:
#   make gen       # buf generate (protobuf-go + connect-go)
.PHONY: gen tools

GOBIN := $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN := $(shell go env GOPATH)/bin
endif

# tools installs the local buf plugins, pinned to the connect-go and protobuf
# runtime versions in go.mod.
tools:
	go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
	go install connectrpc.com/connect/cmd/protoc-gen-connect-go@v1.19.2

gen:
	PATH="$(GOBIN):$$PATH" buf generate
