|
| 1 | +PROTO_OUT := ./Sources/Temporal/protos |
| 2 | +PROTO_BASE := ./dependencies/sdk-core/sdk-core-protos/protos |
| 3 | +PROTO_FILES := $(shell find $(PROTO_BASE) -name "*.proto" -not -path "*/google/*" -not -path "*/health/*") |
| 4 | + |
| 5 | +SWIFT_CONFIGURATION ?= debug |
| 6 | +SWIFT_BIN_PATH := $(shell swift build -c $(SWIFT_CONFIGURATION) --show-bin-path) |
| 7 | + |
| 8 | +PROTOC_GEN_SWIFT := $(shell swift build -c release --show-bin-path)/protoc-gen-swift |
| 9 | +PROTOC_GEN_GRPC_SWIFT := $(shell swift build -c release --show-bin-path)/protoc-gen-grpc-swift-2 |
| 10 | + |
| 11 | +# Build swift protobuf generation tool using swift build for use in other steps |
| 12 | +$(PROTOC_GEN_SWIFT): Package.swift |
| 13 | + swift build -c release --product protoc-gen-swift |
| 14 | + swift build -c release --product protoc-gen-grpc-swift-2 |
| 15 | + |
| 16 | +.PHONY: build-protos |
| 17 | +build-protos: $(PROTOC_GEN_SWIFT) $(PROTOC_GEN_GRPC_SWIFT) ./dependencies/sdk-core/sdk-core-protos/protos |
| 18 | + rm -rf $(PROTO_OUT) |
| 19 | + mkdir -p $(PROTO_OUT) |
| 20 | + protoc --plugin $(PROTOC_GEN_SWIFT) \ |
| 21 | + --swift_out $(PROTO_OUT) \ |
| 22 | + --swift_opt=FileNaming=PathToUnderscores \ |
| 23 | + --swift_opt=Visibility=Package \ |
| 24 | + --swift_opt=UseAccessLevelOnImports=true \ |
| 25 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/api_cloud_upstream \ |
| 26 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/api_upstream \ |
| 27 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/google \ |
| 28 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/grpc \ |
| 29 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/local \ |
| 30 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/testsrv_upstream \ |
| 31 | + ${PROTO_FILES} |
| 32 | + protoc --plugin $(PROTOC_GEN_GRPC_SWIFT) \ |
| 33 | + --grpc-swift-2_out $(PROTO_OUT) \ |
| 34 | + --grpc-swift-2_opt=FileNaming=PathToUnderscores \ |
| 35 | + --grpc-swift-2_opt=Visibility=Package \ |
| 36 | + --grpc-swift-2_opt=UseAccessLevelOnImports=true \ |
| 37 | + --grpc-swift-2_opt=Client=true \ |
| 38 | + --grpc-swift-2_opt=Server=false \ |
| 39 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/api_cloud_upstream \ |
| 40 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/api_upstream \ |
| 41 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/google \ |
| 42 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/grpc \ |
| 43 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/local \ |
| 44 | + -I ./dependencies/sdk-core/sdk-core-protos/protos/testsrv_upstream \ |
| 45 | + ${PROTO_FILES} |
0 commit comments