From 02039a25c7a906cabbdca8b2cc04b5ace6039394 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sun, 2 Aug 2015 16:26:59 -0700 Subject: Fail early and explicitly if protoc, pod, or xcodebuild are missing --- src/objective-c/tests/build_tests.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh index d98e0a769c..a8b7503032 100755 --- a/src/objective-c/tests/build_tests.sh +++ b/src/objective-c/tests/build_tests.sh @@ -32,6 +32,10 @@ set -e cd $(dirname $0) +hash protoc 2>/dev/null || { echo >&2 "protoc needs to be installed."; exit 1; } +hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { echo >&2 "XCode command-line tools need to be installed."; exit 1; } + # The local test server needs to be compiled before this because pod install of # gRPC renames some C gRPC files and not the server's code references to them. # -- cgit v1.2.3 From e95f241c96a5232d0da5004539f3d0e82e87816d Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sun, 2 Aug 2015 16:27:53 -0700 Subject: Reactivate Cocoapods error output --- src/objective-c/tests/build_tests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh index a8b7503032..3ac43fb510 100755 --- a/src/objective-c/tests/build_tests.sh +++ b/src/objective-c/tests/build_tests.sh @@ -38,6 +38,4 @@ hash xcodebuild 2>/dev/null || { echo >&2 "XCode command-line tools need to be i # The local test server needs to be compiled before this because pod install of # gRPC renames some C gRPC files and not the server's code references to them. -# -# Suppress error output because Cocoapods issue #3823 causes a flooding warning. -pod install 2>/dev/null +pod install -- cgit v1.2.3 From 37a44d875f4f9520a58bf817315ef18f5da7c2a7 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 3 Aug 2015 15:40:54 -0700 Subject: Use the protoc made when one isn’t yet installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RemoteTestClient/RemoteTest.podspec | 5 ++++- .../RouteGuideClient/RouteGuide.podspec | 5 ++++- src/objective-c/tests/build_tests.sh | 25 +++++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec index 6b00efebb8..8710753e59 100644 --- a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec @@ -8,7 +8,10 @@ Pod::Spec.new do |s| # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.prepare_command = <<-CMD - protoc --plugin=protoc-gen-grpc=../../../../bins/$CONFIG/grpc_objective_c_plugin --objc_out=. --grpc_out=. *.proto + BINDIR=../../../../bins/$CONFIG + PROTOC=$BINDIR/protobuf/protoc + PLUGIN=$BINDIR/grpc_objective_c_plugin + $PROTOC --plugin=protoc-gen-grpc=$PLUGIN --objc_out=. --grpc_out=. *.proto CMD s.subspec "Messages" do |ms| diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec index 2c9cead7cf..23ccffe69d 100644 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec @@ -8,7 +8,10 @@ Pod::Spec.new do |s| # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.prepare_command = <<-CMD - protoc --plugin=protoc-gen-grpc=../../../../bins/$CONFIG/grpc_objective_c_plugin --objc_out=. --grpc_out=. *.proto + BINDIR=../../../../bins/$CONFIG + PROTOC=$BINDIR/protobuf/protoc + PLUGIN=$BINDIR/grpc_objective_c_plugin + $PROTOC --plugin=protoc-gen-grpc=$PLUGIN --objc_out=. --grpc_out=. *.proto CMD s.subspec "Messages" do |ms| diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh index 3ac43fb510..9a1bf7fd58 100755 --- a/src/objective-c/tests/build_tests.sh +++ b/src/objective-c/tests/build_tests.sh @@ -32,10 +32,29 @@ set -e cd $(dirname $0) -hash protoc 2>/dev/null || { echo >&2 "protoc needs to be installed."; exit 1; } hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } hash xcodebuild 2>/dev/null || { echo >&2 "XCode command-line tools need to be installed."; exit 1; } -# The local test server needs to be compiled before this because pod install of -# gRPC renames some C gRPC files and not the server's code references to them. +BINDIR=../../../bins/$CONFIG + +if [ ! -f $BINDIR/protobuf/protoc ]; then + hash protoc 2>/dev/null || { + echo >&2 "Can't find protoc. Make sure run_tests.py is making" \ + "grpc_objective_c_plugin before calling this script." + exit 1 + } + # When protoc is already installed, make doesn't compile one. Put a link + # there so the podspecs can do codegen using that path. + mkdir -p $BINDIR/protobuf + ln -s `which protoc` $BINDIR/protobuf/protoc +fi + +[ -f $BINDIR/interop_server ] || { + echo >&2 "Can't find the test server. Make sure run_tests.py is making" \ + "interop_server before calling this script. It needs to be done" \ + "before because pod install of gRPC renames some C gRPC files" \ + "and not the server's code references to them." + exit 1 +} + pod install -- cgit v1.2.3 From e8d953557dd9254b68f9b39e936585a7524b0388 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 3 Aug 2015 15:41:11 -0700 Subject: Formatting and documentation --- src/objective-c/tests/build_tests.sh | 8 +++++++- src/objective-c/tests/run_tests.sh | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh index 9a1bf7fd58..e7ad31e403 100755 --- a/src/objective-c/tests/build_tests.sh +++ b/src/objective-c/tests/build_tests.sh @@ -28,12 +28,18 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + set -e cd $(dirname $0) hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } -hash xcodebuild 2>/dev/null || { echo >&2 "XCode command-line tools need to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { + echo >&2 "XCode command-line tools need to be installed." + exit 1 +} BINDIR=../../../bins/$CONFIG diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 9afec687d6..b13c0f0633 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -28,6 +28,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + set -e cd $(dirname $0) -- cgit v1.2.3