diff --git a/spec/fixtures/grpc/Makefile b/spec/fixtures/grpc/Makefile new file mode 100644 index 00000000000..438c74339d9 --- /dev/null +++ b/spec/fixtures/grpc/Makefile @@ -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 diff --git a/spec/internal/grpc.lua b/spec/internal/grpc.lua index 8c49cbda6af..92bd991b9d7 100644 --- a/spec/internal/grpc.lua +++ b/spec/internal/grpc.lua @@ -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" }, {