Skip to content

Commit

Permalink
tests(helpers): target grpc service makefile
Browse files Browse the repository at this point in the history
Add a makefile to grpc target service.
  • Loading branch information
gszr committed Jan 23, 2025
1 parent cd9ac02 commit fa95ea4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
20 changes: 20 additions & 0 deletions spec/fixtures/grpc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ALL= targetservice/targetservice.pb.go targetservice/targetservice_grpc.pb.go target

all: $(ALL)

.PHONY: go

clean:
rm -rf $(ALL)

go:
go mod tidy && go mod download all

target: go targetservice/targetservice.pb.go targetservice/targetservice_grpc.pb.go target.go
go build -o $@

targetservice/targetservice.pb.go: proto/targetservice.proto
protoc -I proto/ --go_out=. --go-grpc_out=. proto/targetservice.proto

targetservice/targetservice_grpc.pb.go: proto/targetservice.proto
protoc -I proto/ --go_out=. --go-grpc_out=. proto/targetservice.proto
12 changes: 6 additions & 6 deletions spec/internal/grpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ local function start_grpc_target()
assert(make(CONSTANTS.GRPC_TARGET_SRC_PATH, {
{
target = "targetservice/targetservice.pb.go",
src = { "../targetservice.proto" },
cmd = "protoc --go_out=. --go-grpc_out=. -I ../ ../targetservice.proto",
src = { "proto/targetservice.proto" },
cmd = "protoc --go_out=. --go-grpc_out=. -I proto/ proto/targetservice.proto",
},
{
target = "targetservice/targetservice_grpc.pb.go",
src = { "../targetservice.proto" },
cmd = "protoc --go_out=. --go-grpc_out=. -I ../ ../targetservice.proto",
src = { "proto/targetservice.proto" },
cmd = "protoc --go_out=. --go-grpc_out=. -I proto/ proto/targetservice.proto",
},
{
target = "target",
src = { "grpc-target.go", "targetservice/targetservice.pb.go", "targetservice/targetservice_grpc.pb.go" },
cmd = "go mod tidy && go mod download all && go build",
src = { "target.go", "targetservice/targetservice.pb.go", "targetservice/targetservice_grpc.pb.go" },
cmd = "go mod tidy && go mod download all && go build -o target",
},
}))
grpc_target_proc = assert(ngx_pipe.spawn({ CONSTANTS.GRPC_TARGET_SRC_PATH .. "/target" }, {
Expand Down

0 comments on commit fa95ea4

Please sign in to comment.