-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add Cloud API #157
Add Cloud API #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "proto/api"] | ||
path = proto/api | ||
url = https://github.com/temporalio/api | ||
[submodule "proto/api-cloud"] | ||
path = proto/api-cloud | ||
url = https://github.com/temporalio/api-cloud |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,7 @@ COLOR := "\e[1;36m%s\e[0m\n" | |
PINNED_DEPENDENCIES := \ | ||
|
||
PROTO_ROOT := proto/api | ||
PROTO_FILES = $(shell find $(PROTO_ROOT)/temporal -name "*.proto") | ||
PROTO_DIRS = $(sort $(dir $(PROTO_FILES))) | ||
PROTO_ENUMS := $(shell grep -R '^enum ' $(PROTO_ROOT) | cut -d ' ' -f2) | ||
PROTO_CLOUD_ROOT := proto/api-cloud | ||
PROTO_OUT := . | ||
PROTO_IMPORTS = \ | ||
-I=$(PROTO_ROOT) | ||
|
@@ -57,10 +55,10 @@ go-grpc: clean .go-helpers-installed $(PROTO_OUT) | |
printf $(COLOR) "Compile for go-gRPC..." | ||
go run ./cmd/protogen \ | ||
--root=$(PROTO_ROOT) \ | ||
--root=$(PROTO_CLOUD_ROOT) \ | ||
--output=$(PROTO_OUT) \ | ||
--exclude=internal \ | ||
--exclude=proto/api/google \ | ||
-I $(PROTO_ROOT) \ | ||
-p go-grpc_out=$(PROTO_PATHS) \ | ||
-p grpc-gateway_out=allow_patch_feature=false,$(PROTO_PATHS) \ | ||
-p go-helpers_out=$(PROTO_PATHS) | ||
|
@@ -80,14 +78,11 @@ copy-helpers: | |
cp $(PROTO_OUT)/internal/temporalcommonv1/payload_json.go $(PROTO_OUT)/common/v1/ | ||
chmod -w $(PROTO_OUT)/common/v1/payload_json.go | ||
|
||
# All generated service files pathes relative to PROTO_OUT. | ||
PROTO_GRPC_SERVICES = $(patsubst $(PROTO_OUT)/%,%,$(shell find $(PROTO_OUT) -name "service_grpc.pb.go")) | ||
service_name = $(firstword $(subst /, ,$(1))) | ||
mock_file_name = $(call service_name,$(1))mock/$(subst $(call service_name,$(1))/,,$(1:go=mock.go)) | ||
|
||
grpc-mock: | ||
printf $(COLOR) "Generate gRPC mocks..." | ||
$(foreach PROTO_GRPC_SERVICE,$(PROTO_GRPC_SERVICES),cd $(PROTO_OUT) && mockgen -package $(call service_name,$(PROTO_GRPC_SERVICE))mock -source $(PROTO_GRPC_SERVICE) -destination $(call mock_file_name,$(PROTO_GRPC_SERVICE))$(NEWLINE) ) | ||
mockgen -package operatorservicemock -source operatorservice/v1/service_grpc.pb.go -destination operatorservicemock/v1/service_grpc.pb.mock.go | ||
mockgen -package workflowservicemock -source workflowservice/v1/service_grpc.pb.go -destination workflowservicemock/v1/service_grpc.pb.mock.go | ||
mockgen -package cloudservicemock -source cloud/cloudservice/v1/service_grpc.pb.go -destination cloud/cloudservicemock/v1/service_grpc.pb.mock.go | ||
|
||
.PHONY: proxy | ||
proxy: | ||
|
@@ -146,3 +141,5 @@ clean: | |
printf $(COLOR) "Deleting generated go files..." | ||
# Delete all directories with *.pb.go and *.mock.go files from $(PROTO_OUT) | ||
find $(PROTO_OUT) \( -name "*.pb.go" -o -name "*.mock.go" -o -name "*.go-helpers.go" \) | xargs -I{} dirname {} | egrep -v 'testprotos' | sort -u | xargs rm -rf | ||
# Delete entire cloud dir | ||
rm -rf cloud | ||
Comment on lines
+144
to
+145
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't the line above delete this dir? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This came from my last tests with #155 where I believe it only worked one directory deep, but I can test again. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,15 @@ _Note that any changes merged to [api](https://github.com/temporalio/api) will a | |
|
||
To install in your project run: | ||
``` | ||
go get -u go.temporal.io/api | ||
go get go.temporal.io/api | ||
``` | ||
|
||
## Rebuild | ||
|
||
Run `make` once to install all plugins and tools (`protoc` and `go` must be installed manually). | ||
|
||
Run `make update-proto` to update submodule and recompile proto files. | ||
Run `make update-proto` to update the `proto/api` submodule and recompile proto files. The `proto/api-cloud` submodule | ||
must be updated manually. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "manually" because you didn't create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I didn't want this to be with that other make target because that is run automatically via GH workflow, and we don't want to pull in this repo automatically because it may break in here (there are not checks in that repo that match this repo like the |
||
|
||
## License | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? (it was silly to have all these lines of complexity for two lines of
mockgen
call)