This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use otel docker to build proto, update deps
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
- Loading branch information
1 parent
b738430
commit df83da2
Showing
4 changed files
with
98 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,9 @@ | ||
PROTOC := protoc | ||
PROTO_INCLUDES := \ | ||
-I proto \ | ||
-I $(shell go env GOPATH)/pkg/mod/github.com/gogo/protobuf@v1.3.1 | ||
OTEL_DOCKER_PROTOBUF ?= otel/build-protobuf:0.2.1 | ||
|
||
# Remapping of std types to gogo types (must not contain spaces) | ||
PROTO_GOGO_MAPPINGS := $(shell echo \ | ||
Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/types, \ | ||
Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/types, \ | ||
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types, \ | ||
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types, \ | ||
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types, \ | ||
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api, \ | ||
| sed 's/ //g') | ||
PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD}/$(OTLP_PROTO_INTERMEDIATE_DIR) ${OTEL_DOCKER_PROTOBUF} --proto_path=${PWD}/$(OTLP_PROTO_INTERMEDIATE_DIR) | ||
PROTO_INCLUDES := -I/usr/include/github.com/gogo/protobuf | ||
|
||
.PHONY: proto | ||
proto: | ||
# -I declares import folders, in order of importance | ||
# This is how proto resolves the protofile imports. | ||
# It will check for the protofile relative to each of these | ||
# folders and use the first one it finds. | ||
$(PROTOC) \ | ||
$(PROTO_INCLUDES) \ | ||
--gogo_out=plugins=grpc,$(PROTO_GOGO_MAPPINGS):$(PWD)/model/ \ | ||
proto/signalfx_metrics.proto | ||
|
||
.PHONY: proto-install | ||
proto-install: | ||
go get -u github.com/golang/glog | ||
go install \ | ||
github.com/golang/protobuf/protoc-gen-go \ | ||
github.com/gogo/protobuf/protoc-gen-gogo | ||
$(PROTOC) $(PROTO_INCLUDES) --gogo_out=plugins=grpc,:./ proto/signalfx_metrics.proto | ||
mv proto/signalfx_metrics.pb.go model/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.