Skip to content

Commit 0fe0dd5

Browse files
spkane31claude
andauthored
Generate nexus service definitions (#245)
* first iteration of generating * getting latest changes * broke code gen * generate code after a fix * removing * updating * update Makefile to clone from branch, regen for json files * update from main * comments * add todo * remove json service * rely on master * Update proto submodule to master and fix protogen vet error Bumps proto/api submodule to f5b514e (master HEAD) to pick up the merged temporalio/api PR #736 (system nexus endpoint "exposed" op) and regenerates the Go bindings. Also fixes a non-constant format string in cmd/protogen/main.go that Go 1.25's stricter vet flagged, which broke the Update Proto CI job. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d1423d2 commit 0fe0dd5

4 files changed

Lines changed: 48 additions & 6 deletions

File tree

Makefile

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,25 @@ update-proto-submodule:
4040
printf $(COLOR) "Update proto-submodule..."
4141
git -c protocol.file.allow=always submodule update --init --force --remote $(PROTO_ROOT)
4242

43-
##### Compile proto files for go #####
44-
grpc: http-api-docs go-grpc copy-helpers
43+
NEXUS_SCHEMA_ROOT := $(PROTO_ROOT)/nexus
44+
NEXUS_PROTO_OUT := workflowservice/v1/workflowservicenexus
4545

46-
# Only install helper when its source has changed
46+
##### Compile proto files for go #####
47+
grpc: http-api-docs go-grpc copy-helpers nexus-gen
48+
49+
nexus-gen:
50+
printf $(COLOR) "Generate nexus service definitions..."
51+
mkdir -p $(NEXUS_PROTO_OUT)
52+
cd $(NEXUS_SCHEMA_ROOT) && nexus-rpc-gen \
53+
--lang go \
54+
--package workflowservicenexus \
55+
--out-file $(CURDIR)/$(NEXUS_PROTO_OUT)/service_nexus.pb.go \
56+
temporal-proto-models-nexusrpc.yaml
57+
58+
# Only install helpers when their source has changed
4759
HELPER_FILES = $(shell find ./cmd/protoc-gen-go-helpers)
4860
.go-helpers-installed: $(HELPER_FILES)
49-
printf $(COLOR) "Installing protoc plugin"
61+
printf $(COLOR) "Installing protoc-gen-go-helpers plugin"
5062
@go install ./cmd/protoc-gen-go-helpers
5163
@touch $@
5264

@@ -105,12 +117,23 @@ gen-proto-desc:
105117
--output-descriptor=$(PROTO_OUT)/descriptor_set.pb
106118

107119
##### Plugins & tools #####
108-
grpc-install:
120+
grpc-install: nexus-rpc-gen-install
109121
@printf $(COLOR) "Install/update grpc and plugins..."
110-
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
122+
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
111123
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
112124
@go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
113125

126+
NEXUS_RPC_GEN_CACHE := $(HOME)/.cache/nexus-rpc-gen
127+
128+
.PHONY: nexus-rpc-gen-install
129+
nexus-rpc-gen-install:
130+
@printf $(COLOR) "Install nexus-rpc-gen from main..."
131+
@rm -rf $(NEXUS_RPC_GEN_CACHE)
132+
@git clone --depth 1 https://github.com/nexus-rpc/nexus-rpc-gen.git $(NEXUS_RPC_GEN_CACHE)
133+
@cd $(NEXUS_RPC_GEN_CACHE)/src && pnpm install && pnpm run build
134+
@chmod +x $(NEXUS_RPC_GEN_CACHE)/src/packages/nexus-rpc-gen/dist/index.js
135+
@cd $(NEXUS_RPC_GEN_CACHE)/src/packages/nexus-rpc-gen && pnpm link --global
136+
114137
mockgen-install:
115138
printf $(COLOR) "Install/update mockgen..."
116139
go install -modfile=build/go.mod github.com/golang/mock/mockgen

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/golang/mock v1.6.0
77
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
88
github.com/nexus-rpc/nexus-proto-annotations v0.1.0
9+
github.com/nexus-rpc/sdk-go v0.6.0
910
github.com/stretchr/testify v1.9.0
1011
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed
1112
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
1313
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1414
github.com/nexus-rpc/nexus-proto-annotations v0.1.0 h1:2fELd+9sqUtNu6Fg//pw8YFsxOvp8vZ8hfP0nHhNI80=
1515
github.com/nexus-rpc/nexus-proto-annotations v0.1.0/go.mod h1:n3UjF1bPCW8llR8tHvbxJ+27yPWrhpo8w/Yg1IOuY0Y=
16+
github.com/nexus-rpc/sdk-go v0.6.0 h1:QRgnP2zTbxEbiyWG/aXH8uSC5LV/Mg1fqb19jb4DBlo=
17+
github.com/nexus-rpc/sdk-go v0.6.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk=
1618
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1719
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1820
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=

workflowservice/v1/workflowservicenexus/service_nexus.pb.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)