Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds processing logic for bpmetadata to use protobuf #1705

Merged
merged 12 commits into from
Jul 31, 2023
Merged
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ config-connector/tests/testcases/environments.yaml
.DS_Store
.vscode
*.pyc
cli/bpmetadata/proto/out*
cli/bpmetadata/int-test/.working
28 changes: 20 additions & 8 deletions cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

# Changing this value will trigger a new release
VERSION=v1.1.10
VERSION=v1.2.0
BINARY=bin/cft
GITHUB_REPO=github.com/GoogleCloudPlatform/cloud-foundation-toolkit
PLATFORMS := linux windows darwin
Expand All @@ -10,21 +10,33 @@ NAME=cft
BUCKET=gs://cft-cli
INT_TEST_DIR=./bpmetadata/int-test
SCHEMA_DIR=./bpmetadata/schema
PROTO_DIR=./bpmetadata/proto
SRC_PROTO_DIR=./bpmetadata/proto
PROTOC_DIR=./bpmetadata

# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X $(GITHUB_REPO)/cli/cmd.Version=$(VERSION)"

# need an extra build command to embed an most up to date schema in the binary
.PHONY: build
build:
go run ./${SCHEMA_DIR} -output=${SCHEMA_DIR}
build: build-schema
go build ${LDFLAGS} -o ${BUILD_DIR}/${NAME}

.PHONY: build-schema
build-schema:
go run ./${SCHEMA_DIR} -output=${SCHEMA_DIR}

.PHONY: protoc
protoc:
protoc --go_out=${PROTO_DIR}/out --go_opt=paths=source_relative ${PROTO_DIR}/*.proto
go build ${PROTO_DIR}/out/...
protoc: protoc-deps protoc-gen

.PHONY: protoc-gen
protoc-gen:
protoc -I=${SRC_PROTO_DIR} --go_opt=paths=source_relative --go_out=${PROTOC_DIR} ${SRC_PROTO_DIR}/*.proto
protoc-go-inject-tag -input="${PROTOC_DIR}/*.pb.go"

.PHONY: protoc-deps
protoc-deps:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/favadi/[email protected]
g-awmalik marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: publish
publish:
Expand Down
Loading