From e89c81ef286fc2167ac36e806520ee34fa87e539 Mon Sep 17 00:00:00 2001 From: George Barnett Date: Mon, 9 Dec 2019 10:46:37 +0000 Subject: [PATCH] Build protoc plugins in release mode Motivation: It's easy for users to build the protoc plugins in debug mode (the default for the Makefile) without realising. They then have to dig through the build output to find the right binaries. This should be easier for users. Modifications: - Build the plugins in release mode when invoked via `make plugins` - Copy the plugins to the current directory after building them Result: Easier to find the protoc plugins. --- .gitignore | 2 +- Makefile | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index ded731b49..faeab1ead 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ DerivedData/ .build build /protoc-gen-swift -/protoc-gen-swiftgrpc +/protoc-gen-grpc-swift third_party/** /Echo /EchoNIO diff --git a/Makefile b/Makefile index 1fa6582b3..e37494a67 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,17 @@ SWIFT:=swift # Where products will be built; this is the SPM default. SWIFT_BUILD_PATH:=./.build -SWIFT_BUILD_CONFIGURATION:=debug -SWIFT_FLAGS:=--build-path=${SWIFT_BUILD_PATH} --configuration=${SWIFT_BUILD_CONFIGURATION} +SWIFT_BUILD_CONFIGURATION=debug +SWIFT_FLAGS=--build-path=${SWIFT_BUILD_PATH} --configuration=${SWIFT_BUILD_CONFIGURATION} +# Force release configuration (for plugins) +SWIFT_FLAGS_RELEASE=$(patsubst --configuration=%,--configuration=release,$(SWIFT_FLAGS)) # protoc plugins. -PROTOC_GEN_SWIFT=${SWIFT_BUILD_PATH}/${SWIFT_BUILD_CONFIGURATION}/protoc-gen-swift -PROTOC_GEN_GRPC_SWIFT=${SWIFT_BUILD_PATH}/${SWIFT_BUILD_CONFIGURATION}/protoc-gen-grpc-swift +PROTOC_GEN_SWIFT=${SWIFT_BUILD_PATH}/release/protoc-gen-swift +PROTOC_GEN_GRPC_SWIFT=${SWIFT_BUILD_PATH}/release/protoc-gen-grpc-swift SWIFT_BUILD:=${SWIFT} build ${SWIFT_FLAGS} +SWIFT_BUILD_RELEASE:=${SWIFT} build ${SWIFT_FLAGS_RELEASE} SWIFT_TEST:=${SWIFT} test ${SWIFT_FLAGS} SWIFT_PACKAGE:=${SWIFT} package ${SWIFT_FLAGS} @@ -23,12 +26,13 @@ all: .PHONY: plugins: ${PROTOC_GEN_SWIFT} ${PROTOC_GEN_GRPC_SWIFT} + cp $^ . ${PROTOC_GEN_SWIFT}: - ${SWIFT_BUILD} --product protoc-gen-swift + ${SWIFT_BUILD_RELEASE} --product protoc-gen-swift ${PROTOC_GEN_GRPC_SWIFT}: - ${SWIFT_BUILD} --product protoc-gen-grpc-swift + ${SWIFT_BUILD_RELEASE} --product protoc-gen-grpc-swift interop-test-runner: ${SWIFT_BUILD} --product GRPCInteroperabilityTests