From 81719815927e4d8a0621ab97d5fde5a0af6c61f3 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 5 Aug 2019 16:37:33 -0700 Subject: [PATCH 01/24] Added Bazel BUILD for tests/ A few test failures to resolve --- src/objective-c/BUILD | 40 +++- .../GRPCClient/private/GRPCOpBatchLog.h | 1 + .../grpc_objc_internal_library.bzl | 174 +++++++++++++++ src/objective-c/tests/BUILD | 202 ++++++++++++++++++ .../tests/InteropTests/InteropTests.h | 6 + .../tests/InteropTests/InteropTests.m | 8 + .../InteropTestsMultipleChannels.m | 3 +- src/objective-c/tests/MacTests/StressTests.h | 6 + src/objective-c/tests/MacTests/StressTests.m | 8 + 9 files changed, 446 insertions(+), 2 deletions(-) create mode 100644 src/objective-c/grpc_objc_internal_library.bzl create mode 100644 src/objective-c/tests/BUILD diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 2492ce8a21f..c3629d0ada4 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -87,10 +87,48 @@ grpc_objc_library( # Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, # use the real paths of @com_google_protobuf//:protobuf_objc instead defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], - includes = ["src/objective-c"], deps = [ ":grpc_objc_client", ":rx_library", "@com_google_protobuf//:protobuf_objc", ], ) + +grpc_objc_library( + name = "grpc_objc_client_internal_testing", + srcs = glob( + [ + "GRPCClient/*.m", + "GRPCClient/private/*.m", + "GRPCClient/internal_testing/*.m", + "ProtoRPC/*.m", + ], + exclude = ["GRPCClient/GRPCCall+GID.m"], + ), + hdrs = glob( + [ + "GRPCClient/*.h", + "GRPCClient/internal/*.h", + "GRPCClient/internal_testing/*.h", + "ProtoRPC/*.h", + ], + exclude = ["GRPCClient/GRPCCall+GID.h"], + ), + includes = ["."], + data = ["//:gRPCCertificates"], + defines = [ + "GRPC_TEST_OBJC=1", + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + ], + textual_hdrs = glob( + [ + "GRPCClient/private/*.h", + ], + ), + deps = [ + ":rx_library", + "//:grpc_objc", + "@com_google_protobuf//:protobuf_objc", + ], + visibility = ["//visibility:public"], +) diff --git a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h index 700d19a206b..1235a5e8d05 100644 --- a/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h +++ b/src/objective-c/GRPCClient/private/GRPCOpBatchLog.h @@ -17,6 +17,7 @@ */ #ifdef GRPC_TEST_OBJC +#import /** * Logs the op batches of a client. Used for testing. diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl new file mode 100644 index 00000000000..b043a0f6880 --- /dev/null +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -0,0 +1,174 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# This is for the gRPC build system. This isn't intended to be used outsite of +# the BUILD file for gRPC. It contains the mapping for the template system we +# use to generate other platform's build system files. +# +# Please consider that there should be a high bar for additions and changes to +# this file. +# Each rule listed must be re-written for Google's internal build system, and +# each change must be ported from one to the other. +# + +load( + "//bazel:generate_objc.bzl", + "generate_objc", + "generate_objc_hdrs", + "generate_objc_srcs", + "generate_objc_non_arc_srcs" +) +load("//bazel:protobuf.bzl", "well_known_proto_libs") + +def grpc_objc_testing_library( + name, + srcs = [], + hdrs = [], + textual_hdrs = [], + data = [], + deps = [], + defines = [], + includes = []): + """objc_library for testing, only works in //src/objective-c/tests + + Args: + name: name of target + hdrs: public headers + srcs: all source files (.m) + textual_hdrs: private headers + data: any other bundle resources + defines: preprocessors + includes: added to search path, always [the path to objc directory] + deps: dependencies + """ + + additional_deps = [ + ":RemoteTest", + "//src/objective-c:grpc_objc_client_internal_testing", + ] + + if not name == "TestConfigs": + additional_deps += [":TestConfigs"] + + native.objc_library( + name = name, + hdrs = hdrs, + srcs = srcs, + textual_hdrs = textual_hdrs, + data = data, + defines = defines, + includes = includes, + deps = deps + additional_deps, + ) + +def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): + """!!For local targets within the gRPC repository only!! Will not work outside of the repo + """ + objc_grpc_library_name = "_" + name + "_objc_grpc_library" + + generate_objc( + name = objc_grpc_library_name, + srcs = srcs, + deps = deps, + use_well_known_protos = use_well_known_protos, + **kwargs + ) + + generate_objc_hdrs( + name = objc_grpc_library_name + "_hdrs", + src = ":" + objc_grpc_library_name, + ) + + generate_objc_non_arc_srcs( + name = objc_grpc_library_name + "_non_arc_srcs", + src = ":" + objc_grpc_library_name, + ) + + arc_srcs = None + if len(srcs) > 0: + generate_objc_srcs( + name = objc_grpc_library_name + "_srcs", + src = ":" + objc_grpc_library_name, + ) + arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + + native.objc_library( + name = name, + hdrs = [":" + objc_grpc_library_name + "_hdrs"], + non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], + srcs = arc_srcs, + defines = [ + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", + ], + includes = [ + "_generated_protos", + "src/objective-c", + ], + deps = [ + "//src/objective-c:proto_objc_rpc", + "@com_google_protobuf//:protobuf_objc", + ], + ) + +def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): + """!!For testing within the gRPC repository only!! Will not work outside of the repo + """ + objc_grpc_library_name = "_" + name + "_objc_grpc_library" + + generate_objc( + name = objc_grpc_library_name, + srcs = srcs, + deps = deps, + use_well_known_protos = use_well_known_protos, + **kwargs + ) + + generate_objc_hdrs( + name = objc_grpc_library_name + "_hdrs", + src = ":" + objc_grpc_library_name, + ) + + generate_objc_non_arc_srcs( + name = objc_grpc_library_name + "_non_arc_srcs", + src = ":" + objc_grpc_library_name, + ) + + arc_srcs = None + if len(srcs) > 0: + generate_objc_srcs( + name = objc_grpc_library_name + "_srcs", + src = ":" + objc_grpc_library_name, + ) + arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + + native.objc_library( + name = name, + hdrs = [":" + objc_grpc_library_name + "_hdrs"], + non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], + srcs = arc_srcs, + defines = [ + "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", + "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", + ], + includes = [ + "_generated_protos", + "src/objective-c", + ], + deps = [ + "//src/objective-c:grpc_objc_client_internal_testing", + "@com_google_protobuf//:protobuf_objc", + ], + ) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD new file mode 100644 index 00000000000..2718cca5880 --- /dev/null +++ b/src/objective-c/tests/BUILD @@ -0,0 +1,202 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//visibility:private"]) + +load( + "//src/objective-c:grpc_objc_internal_library.bzl", + "grpc_objc_testing_library", + "testing_objc_grpc_library" +) +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") +load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_unit_test") + +exports_files(["LICENSE"]) + +proto_library( + name = "messages_proto", + srcs = ["RemoteTestClient/messages.proto"], +) + +proto_library( + name = "test_proto", + srcs = ["RemoteTestClient/test.proto"], + deps = [":messages_proto"], +) + +testing_objc_grpc_library( + name = "RemoteTest", + srcs = ["RemoteTestClient/test.proto"], + use_well_known_protos = True, + deps = [":test_proto"], +) + +apple_resource_bundle( + name = "TestCertificates", + resources = ["TestCertificates.bundle/test-certificates.pem"], +) + +# TestConfigs is added to each grpc_objc_testing_library's deps +grpc_objc_testing_library( + name = "TestConfigs", + hdrs = ["version.h"], + data = [":TestCertificates"], + defines = [ + "HOST_PORT_LOCALSSL=localhost:5051", + "HOST_PORT_LOCAL=localhost:5050", + "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", + ], +) + +grpc_objc_testing_library( + name = "CronetConfig", + srcs = ["ConfigureCronet.m"], + hdrs = ["ConfigureCronet.h"], +) + +grpc_objc_testing_library( + name = "InteropTests-lib", + hdrs = ["InteropTests/InteropTests.h"], + srcs = ["InteropTests/InteropTests.m"], + deps = [ + ":InteropTestsBlockCallbacks-lib", + ":CronetConfig", + ], +) + +grpc_objc_testing_library( + name = "InteropTestsRemote-lib", + srcs = ["InteropTests/InteropTestsRemote.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsBlockCallbacks-lib", + hdrs = ["InteropTests/InteropTestsBlockCallbacks.h"], + srcs = ["InteropTests/InteropTestsBlockCallbacks.m"], +) + +grpc_objc_testing_library( + name = "InteropTestsLocalSSL-lib", + srcs = ["InteropTests/InteropTestsLocalSSL.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsLocalCleartext-lib", + srcs = ["InteropTests/InteropTestsLocalCleartext.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "InteropTestsMultipleChannels-lib", + srcs = ["InteropTests/InteropTestsMultipleChannels.m"], + deps = [":InteropTests-lib"], +) + +grpc_objc_testing_library( + name = "RxLibraryUnitTests-lib", + srcs = ["UnitTests/RxLibraryUnitTests.m"], +) + +grpc_objc_testing_library( + name = "GRPCClientTests-lib", + srcs = ["UnitTests/GRPCClientTests.m"], +) + +grpc_objc_testing_library( + name = "APIv2Tests-lib", + srcs = ["UnitTests/APIv2Tests.m"], +) + +grpc_objc_testing_library( + name = "ChannelPoolTest-lib", + srcs = ["UnitTests/ChannelPoolTest.m"], +) + +grpc_objc_testing_library( + name = "ChannelTests-lib", + srcs = ["UnitTests/ChannelTests.m"], +) + +grpc_objc_testing_library( + name = "NSErrorUnitTests-lib", + srcs = ["UnitTests/NSErrorUnitTests.m"], +) + +grpc_objc_testing_library( + name = "MacStressTests-lib", + srcs = glob([ + "MacTests/*.m", + ]), + hdrs = ["MacTests/StressTests.h"], +) + +ios_unit_test( + name = "UnitTests", + minimum_os_version = "8.0", + deps = [ + ":RxLibraryUnitTests-lib", + ":GRPCClientTests-lib", + ":APIv2Tests-lib", + ":ChannelPoolTest-lib", + ":ChannelTests-lib", + ":NSErrorUnitTests-lib", + ] +) + +ios_unit_test( + name = "InteropTests", + minimum_os_version = "8.0", + deps = [ + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + # ":InteropTestsMultipleChannels-lib", #??????? Cronet must be used? + ], +) + +macos_unit_test( + name = "MacTests", + minimum_os_version = "10.9", + deps = [ + ":APIv2Tests-lib", + ":RxLibraryUnitTests-lib", + ":NSErrorUnitTests-lib", + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + ":MacStressTests-lib", + ] +) + +# cares does not support tvOS CPU architecture with Bazel yet +tvos_unit_test( + name = "TvTests", + minimum_os_version = "10.0", + deps = [ + ":APIv2Tests-lib", + ":RxLibraryUnitTests-lib", + ":NSErrorUnitTests-lib", + ":InteropTestsRemote-lib", + ":InteropTestsLocalSSL-lib", + ":InteropTestsLocalCleartext-lib", + ] +) \ No newline at end of file diff --git a/src/objective-c/tests/InteropTests/InteropTests.h b/src/objective-c/tests/InteropTests/InteropTests.h index cffa90ac497..28fcbff9695 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.h +++ b/src/objective-c/tests/InteropTests/InteropTests.h @@ -27,6 +27,12 @@ * This is an abstract class that needs to be subclassed. See |+host|. */ @interface InteropTests : XCTestCase +/** + * The test suite to run, checking if the current XCTestCase instance is the base class. + * If so, run no tests (disabled). Otherwise, proceed to normal execution. + */ +@property(class, readonly) XCTestSuite *defaultTestSuite; + /** * Host to send the RPCs to. The base implementation returns nil, which would make all tests to * fail. diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index c13dd1e2b35..a8f7db7ee93 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -406,6 +406,14 @@ static dispatch_once_t initGlobalInterceptorFactory; RMTTestService *_service; } ++ (XCTestSuite *)defaultTestSuite { + if (self == [InteropTests class]) { + return [XCTestSuite testSuiteWithName:@"InteropTestsEmptySuite"]; + } else { + return super.defaultTestSuite; + } +} + + (NSString *)host { return nil; } diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index a2a3e64b1b1..c363e523250 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -86,8 +86,9 @@ dispatch_once_t initCronet; self.continueAfterFailure = NO; _remoteService = [RMTTestService serviceWithHost:kRemoteSSLHost callOptions:nil]; - +#ifdef GRPC_COMPILE_WITH_CRONET configureCronet(); +#endif // Default stack with remote host GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; diff --git a/src/objective-c/tests/MacTests/StressTests.h b/src/objective-c/tests/MacTests/StressTests.h index 8bee0e66274..2608a710845 100644 --- a/src/objective-c/tests/MacTests/StressTests.h +++ b/src/objective-c/tests/MacTests/StressTests.h @@ -21,6 +21,12 @@ #import @interface StressTests : XCTestCase +/** + * The test suite to run, checking if the current XCTestCase instance is the base class. + * If so, run no tests (disabled). Otherwise, proceed to normal execution. + */ +@property(class, readonly) XCTestSuite *defaultTestSuite; + /** * Host to send the RPCs to. The base implementation returns nil, which would make all tests to * fail. diff --git a/src/objective-c/tests/MacTests/StressTests.m b/src/objective-c/tests/MacTests/StressTests.m index c7020740eac..622c80ea91a 100644 --- a/src/objective-c/tests/MacTests/StressTests.m +++ b/src/objective-c/tests/MacTests/StressTests.m @@ -89,6 +89,14 @@ extern const char *kCFStreamVarName; RMTTestService *_service; } ++ (XCTestSuite *)defaultTestSuite { + if (self == [StressTests class]) { + return [XCTestSuite testSuiteWithName:@"StressTestsEmptySuite"]; + } else { + return super.defaultTestSuite; + } +} + + (NSString *)host { return nil; } From 4c958e8745ba5d6715561bdcf16e15c23096fd65 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Mon, 5 Aug 2019 20:15:49 -0700 Subject: [PATCH 02/24] Modified BUILD for examples --- src/objective-c/examples/BUILD | 84 ++-- .../BazelBuildSamples/ios-sample/Podfile | 31 -- .../ios-sample.xcodeproj/project.pbxproj | 413 ------------------ .../ios-sample/ios-sample/AppDelegate.h | 25 -- .../ios-sample/ios-sample/AppDelegate.m | 63 --- .../AppIcon.appiconset/Contents.json | 98 ----- .../ios-sample/Assets.xcassets/Contents.json | 6 - .../Base.lproj/LaunchScreen.storyboard | 25 -- .../ios-sample/Base.lproj/Main.storyboard | 38 -- .../ios-sample/ios-sample/Info.plist | 45 -- .../ios-sample/ios-sample/ViewController.h | 23 - .../ios-sample/ios-sample/ViewController.m | 86 ---- .../ios-sample/ios-sample/main.m | 26 -- .../examples/BazelBuildSamples/messages.proto | 118 ----- .../examples/BazelBuildSamples/rmt/BUILD | 28 -- .../examples/BazelBuildSamples/rmt/test.proto | 57 --- .../InterceptorSample/Info.plist | 2 +- 17 files changed, 57 insertions(+), 1111 deletions(-) delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m delete mode 100644 src/objective-c/examples/BazelBuildSamples/messages.proto delete mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/BUILD delete mode 100644 src/objective-c/examples/BazelBuildSamples/rmt/test.proto diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 27ddfcd6031..d3a5a76b89a 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -15,55 +15,83 @@ # limitations under the License. +load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") -load( - "@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", - "objc_grpc_library", -) +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") +load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application") proto_library( name = "messages_proto", - srcs = ["BazelBuildSamples/messages.proto"], - visibility = ["//visibility:public"], + srcs = ["RemoteTestClient/messages.proto"], ) -objc_grpc_library( +proto_library( + name = "test_proto", + srcs = ["RemoteTestClient/test.proto"], + deps = [":messages_proto"], +) + +# use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo +local_objc_grpc_library( name = "test_grpc_objc", - srcs = ["BazelBuildSamples/rmt/test.proto"], + srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, deps = [ - "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", + "//src/objective-c/examples:test_proto", ], ) # Proof that without this works without srcs -objc_grpc_library( +local_objc_grpc_library( name = "test_objc", use_well_known_protos = True, deps = [ - "//src/objective-c/examples/BazelBuildSamples/rmt:test_proto", - ] + "//src/objective-c/examples:test_proto", + ], ) objc_library( - name = "ios-sample-lib", - srcs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.m"]), - hdrs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.h"]), + name = "Sample-lib", + srcs = glob(["Sample/**/*.m"]), + hdrs = glob(["Sample/**/*.h"]), data = glob([ - "BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/**/*", - "BazelBuildSamples/ios-sample/ios-sample/Base.lproj/**/*" + "Sample/Sample/Base.lproj/**", + "Sample/Sample/Images.xcassets/**", ]), - deps = [ - ":test_grpc_objc", - ] + deps = [":test_grpc_objc"], ) ios_application( - name = "ios-sample", - bundle_id = "com.google.ios-sample-objc-bazel", - families = ["iphone"], - minimum_os_version = "9.0", - infoplists = ["BazelBuildSamples/ios-sample/ios-sample/Info.plist"], - visibility = ["//visibility:public"], - deps = [":ios-sample-lib"], -) \ No newline at end of file + name = "Sample", + bundle_id = "grpc.objc.examples.Sample", + minimum_os_version = "8.0", + infoplists = ["Sample/Sample/Info.plist"], + families = [ + "iphone", + "ipad", + ], + deps = ["Sample-lib"], +) + +objc_library( + name = "InterceptorSample-lib", + srcs = glob(["InterceptorSample/**/*.m"]), + hdrs = glob(["InterceptorSample/**/*.h"]), + data = glob([ + "InterceptorSample/InterceptorSample/Base.lproj/**", + "InterceptorSample/InterceptorSample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +ios_application( + name = "InterceptorSample", + bundle_id = "grpc.objc.examples.InterceptorSample", + minimum_os_version = "9.0", # Safe Area Layout Guide used + infoplists = ["InterceptorSample/InterceptorSample/Info.plist"], + families = [ + "iphone", + "ipad", + ], + deps = ["InterceptorSample-lib"], +) diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile b/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile deleted file mode 100644 index 8648992d84f..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile +++ /dev/null @@ -1,31 +0,0 @@ -platform :ios, '8.0' - -install! 'cocoapods', :deterministic_uuids => false - -ROOT_DIR = '../../../../..' - -target 'ios-sample' do - pod 'gRPC-ProtoRPC', :path => ROOT_DIR - pod 'gRPC', :path => ROOT_DIR - pod 'gRPC-Core', :path => ROOT_DIR - pod 'gRPC-RxLibrary', :path => ROOT_DIR - pod 'RemoteTest', :path => "../../RemoteTestClient" - pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" -end - -pre_install do |installer| - grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec - - src_root = "$(PODS_TARGET_SRCROOT)" - grpc_core_spec.pod_target_xcconfig = { - 'GRPC_SRC_ROOT' => src_root, - 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', - 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', - # If we don't set these two settings, `include/grpc/support/time.h` and - # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the - # build. - 'USE_HEADERMAP' => 'NO', - 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - } -end - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj deleted file mode 100644 index 05344a69bfc..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,413 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CC822D7E38000D579CC /* AppDelegate.m */; }; - AB433CCC22D7E38000D579CC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CCB22D7E38000D579CC /* ViewController.m */; }; - AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CCD22D7E38000D579CC /* Main.storyboard */; }; - AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD022D7E38100D579CC /* Assets.xcassets */; }; - AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */; }; - AB433CD722D7E38100D579CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CD622D7E38100D579CC /* main.m */; }; - ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.release.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.release.xcconfig"; sourceTree = ""; }; - 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.debug.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.debug.xcconfig"; sourceTree = ""; }; - AB433CC422D7E38000D579CC /* ios-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - AB433CC722D7E38000D579CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - AB433CC822D7E38000D579CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - AB433CCA22D7E38000D579CC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - AB433CCB22D7E38000D579CC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - AB433CCE22D7E38000D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - AB433CD022D7E38100D579CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - AB433CD322D7E38100D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - AB433CD522D7E38100D579CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB433CD622D7E38100D579CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - AB433CC122D7E38000D579CC /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2A170580B60E92B1A65525D4 /* Pods */ = { - isa = PBXGroup; - children = ( - 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */, - 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - AB433CBB22D7E38000D579CC = { - isa = PBXGroup; - children = ( - AB433CC622D7E38000D579CC /* ios-sample */, - AB433CC522D7E38000D579CC /* Products */, - 2A170580B60E92B1A65525D4 /* Pods */, - FD148AE940967C50DB2C12CB /* Frameworks */, - ); - sourceTree = ""; - }; - AB433CC522D7E38000D579CC /* Products */ = { - isa = PBXGroup; - children = ( - AB433CC422D7E38000D579CC /* ios-sample.app */, - ); - name = Products; - sourceTree = ""; - }; - AB433CC622D7E38000D579CC /* ios-sample */ = { - isa = PBXGroup; - children = ( - AB433CC722D7E38000D579CC /* AppDelegate.h */, - AB433CC822D7E38000D579CC /* AppDelegate.m */, - AB433CCA22D7E38000D579CC /* ViewController.h */, - AB433CCB22D7E38000D579CC /* ViewController.m */, - AB433CCD22D7E38000D579CC /* Main.storyboard */, - AB433CD022D7E38100D579CC /* Assets.xcassets */, - AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */, - AB433CD522D7E38100D579CC /* Info.plist */, - AB433CD622D7E38100D579CC /* main.m */, - ); - path = "ios-sample"; - sourceTree = ""; - }; - FD148AE940967C50DB2C12CB /* Frameworks */ = { - isa = PBXGroup; - children = ( - 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - AB433CC322D7E38000D579CC /* ios-sample */ = { - isa = PBXNativeTarget; - buildConfigurationList = AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */; - buildPhases = ( - 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */, - AB433CC022D7E38000D579CC /* Sources */, - AB433CC122D7E38000D579CC /* Frameworks */, - AB433CC222D7E38000D579CC /* Resources */, - 630985F7228D41528084692C /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ios-sample"; - productName = "ios-sample"; - productReference = AB433CC422D7E38000D579CC /* ios-sample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - AB433CBC22D7E38000D579CC /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1010; - ORGANIZATIONNAME = "Tony Lu"; - TargetAttributes = { - AB433CC322D7E38000D579CC = { - CreatedOnToolsVersion = 10.1; - }; - }; - }; - buildConfigurationList = AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = AB433CBB22D7E38000D579CC; - productRefGroup = AB433CC522D7E38000D579CC /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - AB433CC322D7E38000D579CC /* ios-sample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - AB433CC222D7E38000D579CC /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */, - AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */, - AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 630985F7228D41528084692C /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ios-sample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - AB433CC022D7E38000D579CC /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AB433CCC22D7E38000D579CC /* ViewController.m in Sources */, - AB433CD722D7E38100D579CC /* main.m in Sources */, - AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - AB433CCD22D7E38000D579CC /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB433CCE22D7E38000D579CC /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AB433CD322D7E38100D579CC /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - AB433CD822D7E38100D579CC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - AB433CD922D7E38100D579CC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - AB433CDB22D7E38100D579CC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "ios-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - AB433CDC22D7E38100D579CC /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 6T98ZJNPG5; - INFOPLIST_FILE = "ios-sample/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB433CD822D7E38100D579CC /* Debug */, - AB433CD922D7E38100D579CC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AB433CDB22D7E38100D579CC /* Debug */, - AB433CDC22D7E38100D579CC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = AB433CBC22D7E38000D579CC /* Project object */; -} diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h deleted file mode 100644 index 183abcf4ec8..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -@interface AppDelegate : UIResponder - -@property(strong, nonatomic) UIWindow* window; - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m deleted file mode 100644 index d78f5f2175c..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for - // certain types of temporary interruptions (such as an incoming phone call or SMS message) or - // when the user quits the application and it begins the transition to the background state. Use - // this method to pause ongoing tasks, disable timers, and invalidate graphics rendering - // callbacks. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store - // enough application state information to restore your application to its current state in case - // it is terminated later. If your application supports background execution, this method is - // called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo - // many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If - // the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also - // applicationDidEnterBackground:. -} - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d8db8d65fd7..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index bfa36129419..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard deleted file mode 100644 index 5e257390b33..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist deleted file mode 100644 index e5d82108923..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en_US - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h deleted file mode 100644 index 0aa0b2a73a7..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import - -@interface ViewController : UIViewController - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m deleted file mode 100644 index 6cb5a0be9df..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "ViewController.h" - -#import -#if COCOAPODS -#import -#import -#else -#import "src/objective-c/examples/BazelBuildSamples/Messages.pbobjc.h" -#import "src/objective-c/examples/BazelBuildSamples/rmt/Test.pbrpc.h" -#endif - -static NSString *const kPackage = @"grpc.testing"; -static NSString *const kService = @"TestService"; - -@interface ViewController () - -@end - -@implementation ViewController { - GRPCCallOptions *_options; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; - // optionally modify options - _options = options; -} - -- (IBAction)tapCall:(id)sender { - GRPCProtoMethod *kUnaryCallMethod = - [[GRPCProtoMethod alloc] initWithPackage:kPackage service:kService method:@"UnaryCall"]; - - GRPCRequestOptions *requestOptions = - [[GRPCRequestOptions alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" - path:kUnaryCallMethod.HTTPPath - safety:GRPCCallSafetyCacheableRequest]; - - GRPCCall2 *call = [[GRPCCall2 alloc] initWithRequestOptions:requestOptions - responseHandler:self - callOptions:_options]; - - RMTSimpleRequest *request = [RMTSimpleRequest message]; - request.responseSize = 100; - - [call start]; - [call writeData:[request data]]; - [call finish]; -} - -- (dispatch_queue_t)dispatchQueue { - return dispatch_get_main_queue(); -} - -- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { - NSLog(@"Header: %@", initialMetadata); -} - -- (void)didReceiveData:(id)data { - NSLog(@"Message: %@", data); -} - -- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - NSLog(@"Trailer: %@\nError: %@", trailingMetadata, error); -} - -@end diff --git a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m b/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m deleted file mode 100644 index 2797c6f17f2..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/main.m +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/src/objective-c/examples/BazelBuildSamples/messages.proto b/src/objective-c/examples/BazelBuildSamples/messages.proto deleted file mode 100644 index 128efd9337e..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/messages.proto +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto3"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; - - // Uncompressable binary format. - UNCOMPRESSABLE = 1; - - // Randomly chosen from all other formats defined in this enum. - RANDOM = 2; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - PayloadType type = 1; - // Primary contents of payload. - bytes body = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - PayloadType response_type = 1; - - // Desired payload size in the response from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 response_size = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether SimpleResponse should include username. - bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - bool fill_oauth_scope = 5; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - string username = 2; - // OAuth scope. - string oauth_scope = 3; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - Payload payload = 1; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - int32 interval_us = 2; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - PayloadType response_type = 1; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - Payload payload = 1; -} diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/BUILD b/src/objective-c/examples/BazelBuildSamples/rmt/BUILD deleted file mode 100644 index 5264196c08e..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/rmt/BUILD +++ /dev/null @@ -1,28 +0,0 @@ -# gRPC Bazel BUILD file. -# -# Copyright 2019 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -licenses(["notice"]) # Apache v2 - -package(default_visibility = ["//visibility:public"]) - -exports_files(["LICENSE"]) - -proto_library( - name = "test_proto", - srcs = ["test.proto"], - deps = ["//src/objective-c/examples:messages_proto"], - visibility = ["//visibility:public"], -) \ No newline at end of file diff --git a/src/objective-c/examples/BazelBuildSamples/rmt/test.proto b/src/objective-c/examples/BazelBuildSamples/rmt/test.proto deleted file mode 100644 index ddc511e1428..00000000000 --- a/src/objective-c/examples/BazelBuildSamples/rmt/test.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto3"; - -import "google/protobuf/empty.proto"; -import "src/objective-c/examples/BazelBuildSamples/messages.proto"; - -package grpc.testing; - -option objc_class_prefix = "RMT"; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); -} diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist b/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist index 16be3b68112..e5d82108923 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From d12f310b0d6c26f09eee4c3909eca9788d373e23 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 6 Aug 2019 17:48:53 -0700 Subject: [PATCH 03/24] Added targets for examples --- src/objective-c/BUILD | 1 - src/objective-c/examples/BUILD | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index c3629d0ada4..3a71086f0f6 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -130,5 +130,4 @@ grpc_objc_library( "//:grpc_objc", "@com_google_protobuf//:protobuf_objc", ], - visibility = ["//visibility:public"], ) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index d3a5a76b89a..d6e1140d8f5 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -52,8 +52,8 @@ local_objc_grpc_library( objc_library( name = "Sample-lib", - srcs = glob(["Sample/**/*.m"]), - hdrs = glob(["Sample/**/*.h"]), + srcs = glob(["Sample/Sample/**/*.m"]), + hdrs = glob(["Sample/Sample/**/*.h"]), data = glob([ "Sample/Sample/Base.lproj/**", "Sample/Sample/Images.xcassets/**", @@ -71,12 +71,13 @@ ios_application( "ipad", ], deps = ["Sample-lib"], + visibility = ["//visibility:public"], ) objc_library( name = "InterceptorSample-lib", - srcs = glob(["InterceptorSample/**/*.m"]), - hdrs = glob(["InterceptorSample/**/*.h"]), + srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]), + hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]), data = glob([ "InterceptorSample/InterceptorSample/Base.lproj/**", "InterceptorSample/InterceptorSample/Images.xcassets/**", From b892ea749c0af8bee6146e12f41170fc9a013c13 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 6 Aug 2019 17:49:16 -0700 Subject: [PATCH 04/24] Fixed address resolution failure by attaching to a host application Added copyright statements Fix clang format code --- src/objective-c/tests/BUILD | 45 ++++++++++++++++--- .../tests/Hosts/ios-host/AppDelegate.h | 25 +++++++++++ .../tests/Hosts/ios-host/AppDelegate.m | 27 +++++++++++ .../tests/Hosts/ios-host/Info.plist | 41 +++++++++++++++++ src/objective-c/tests/Hosts/ios-host/main.m | 26 +++++++++++ 5 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 src/objective-c/tests/Hosts/ios-host/AppDelegate.h create mode 100644 src/objective-c/tests/Hosts/ios-host/AppDelegate.m create mode 100644 src/objective-c/tests/Hosts/ios-host/Info.plist create mode 100644 src/objective-c/tests/Hosts/ios-host/main.m diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 2718cca5880..0817bbdd6c7 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -24,9 +24,9 @@ load( "testing_objc_grpc_library" ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") -load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_unit_test") +load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_test") exports_files(["LICENSE"]) @@ -59,12 +59,42 @@ grpc_objc_testing_library( hdrs = ["version.h"], data = [":TestCertificates"], defines = [ + "DEBUG=1", + "PB_FIELD_32BIT=1", + "PB_NO_PACKED_STRUCTS=1", + "PB_ENABLE_MALLOC=1", "HOST_PORT_LOCALSSL=localhost:5051", "HOST_PORT_LOCAL=localhost:5050", "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", ], ) +objc_library( + name = "host-lib", + srcs = glob(["Hosts/ios-host/*.m"]), + hdrs = glob(["Hosts/ios-host/*.h"]), +) + +ios_application( + name = "ios-host", + bundle_id = "grpc.objc.tests.ios-host", + infoplists = ["Hosts/ios-host/Info.plist"], + minimum_os_version = "9.0", + families = [ + "iphone", + "ipad", + ], + deps = ["host-lib"], +) + +tvos_application( + name = "tvos-host", + bundle_id = "grpc.objc.tests.tvos-host", + infoplists = ["Hosts/ios-host/Info.plist"], + minimum_os_version = "10.0", + deps = ["host-lib"], +) + grpc_objc_testing_library( name = "CronetConfig", srcs = ["ConfigureCronet.m"], @@ -159,7 +189,8 @@ ios_unit_test( ":ChannelPoolTest-lib", ":ChannelTests-lib", ":NSErrorUnitTests-lib", - ] + ], + test_host = ":ios-host", ) ios_unit_test( @@ -169,8 +200,9 @@ ios_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", - # ":InteropTestsMultipleChannels-lib", #??????? Cronet must be used? + # ":InteropTestsMulitpleChannels-lib", # needs Cronet ], + test_host = ":ios-host", ) macos_unit_test( @@ -187,7 +219,7 @@ macos_unit_test( ] ) -# cares does not support tvOS CPU architecture with Bazel yet +# c-ares does not support tvOS CPU architecture with Bazel yet tvos_unit_test( name = "TvTests", minimum_os_version = "10.0", @@ -198,5 +230,6 @@ tvos_unit_test( ":InteropTestsRemote-lib", ":InteropTestsLocalSSL-lib", ":InteropTestsLocalCleartext-lib", - ] + ], + test_host = ":tvos-host", ) \ No newline at end of file diff --git a/src/objective-c/tests/Hosts/ios-host/AppDelegate.h b/src/objective-c/tests/Hosts/ios-host/AppDelegate.h new file mode 100644 index 00000000000..183abcf4ec8 --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/AppDelegate.h @@ -0,0 +1,25 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +@interface AppDelegate : UIResponder + +@property(strong, nonatomic) UIWindow* window; + +@end diff --git a/src/objective-c/tests/Hosts/ios-host/AppDelegate.m b/src/objective-c/tests/Hosts/ios-host/AppDelegate.m new file mode 100644 index 00000000000..4a76f4c488c --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/AppDelegate.m @@ -0,0 +1,27 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +@end diff --git a/src/objective-c/tests/Hosts/ios-host/Info.plist b/src/objective-c/tests/Hosts/ios-host/Info.plist new file mode 100644 index 00000000000..e5baf19b85c --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/Info.plist @@ -0,0 +1,41 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/objective-c/tests/Hosts/ios-host/main.m b/src/objective-c/tests/Hosts/ios-host/main.m new file mode 100644 index 00000000000..2797c6f17f2 --- /dev/null +++ b/src/objective-c/tests/Hosts/ios-host/main.m @@ -0,0 +1,26 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} From 0f02911d3d8258d958cfd2938c37a01458cc147b Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 14:52:09 -0700 Subject: [PATCH 05/24] Added targets for tv and watch samples --- src/objective-c/examples/BUILD | 72 ++++++++++++++++++- .../tvOS-sample/tvOS-sample/Info.plist | 2 +- .../AppIcon.appiconset/Contents.json | 21 ++++++ .../watchOS-sample/WatchKit-App/Info.plist | 2 +- .../WatchKit-Extension/Info.plist | 2 +- .../watchOS-sample/watchOS-sample/Info.plist | 2 +- 6 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index d6e1140d8f5..5e3e4f9badd 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -18,7 +18,7 @@ load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") -load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application") +load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension") proto_library( name = "messages_proto", @@ -96,3 +96,73 @@ ios_application( ], deps = ["InterceptorSample-lib"], ) + +objc_library( + name = "tvOS-sample-lib", + srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]), + hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]), + data = glob([ + "tvOS-sample/tvOS-sample/Base.lproj/**", + "tvOS-sample/tvOS-sample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +# c-ares does not support tvOS CPU architecture with Bazel yet +tvos_application( + name = "tvOS-sample", + bundle_id = "grpc.objc.examples.tvOS-sample", + minimum_os_version = "10.0", + infoplists = ["tvOS-sample/tvOS-sample/Info.plist"], + deps = [":tvOS-sample-lib"], +) + +objc_library( + name = "watchOS-sample-iOS-lib", + srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]), + hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]), + data = glob([ + "watchOS-sample/watchOS-sample/Base.lproj/**", + "watchOS-sample/watchOS-sample/Images.xcassets/**", + ]), + deps = [":test_grpc_objc"], +) + +objc_library( + name = "watchOS-sample-extension-lib", + srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]), + hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]), + deps = [":test_grpc_objc"], + sdk_frameworks = [ + "WatchConnectivity", + "WatchKit", + ], +) + +ios_application( + name = "watchOS-sample", + bundle_id = "com.google.watchOS-sample", + minimum_os_version = "9.0", # Safe Area Layout Guide used + families = ["iphone"], + infoplists = ["watchOS-sample/watchOS-sample/Info.plist"], + deps = [":watchOS-sample-iOS-lib"], + watch_application = "watchOS-sample-watchApp", +) + +# c-ares does not support watchOS CPU architecture with Bazel yet +watchos_application( + name = "watchOS-sample-watchApp", + bundle_id = "com.google.watchOS-sample.watchkitapp", + minimum_os_version = "4.0", + storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"], + infoplists = ["watchOS-sample/WatchKit-App/Info.plist"], + extension = ":watchOS-sample-extension", +) + +watchos_extension( + name = "watchOS-sample-extension", + bundle_id = "com.google.watchOS-sample.watchkitapp.watchkitextension", + minimum_os_version = "4.0", + infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"], + deps = [":watchOS-sample-extension-lib"], +) diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist index 02942a34f3e..63dcd6c1d26 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json index 215c1ddfee9..6c0f2b4204b 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -33,6 +33,20 @@ "role" : "appLauncher", "subtype" : "38mm" }, + { + "size" : "44x44", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "40mm" + }, + { + "size" : "50x50", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "44mm" + }, { "size" : "86x86", "idiom" : "watch", @@ -47,6 +61,13 @@ "role" : "quickLook", "subtype" : "42mm" }, + { + "size" : "108x108", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "44mm" + }, { "idiom" : "watch-marketing", "size" : "1024x1024", diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index 309d7867639..6dbcfe04d53 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleDisplayName WatchKit-App CFBundleExecutable diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index bc09fa0f786..4a0a252b854 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleDisplayName watchOS-sample WatchKit Extension CFBundleExecutable diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist index 16be3b68112..d0524738680 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From 820a0892ac1e3ff954d0309e9fd0ead2688ca3e9 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:00:59 -0700 Subject: [PATCH 06/24] Updated comments (notice) on tvtests --- src/objective-c/tests/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 0817bbdd6c7..5d8042ca20a 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -219,7 +219,7 @@ macos_unit_test( ] ) -# c-ares does not support tvOS CPU architecture with Bazel yet +# bazel run tvos_unit_test is not yet supported by xctestrunner tvos_unit_test( name = "TvTests", minimum_os_version = "10.0", From c81dfd91dedd0828c89fe2b185c2e11c6e153e7f Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:01:37 -0700 Subject: [PATCH 07/24] Added cpu architecture for tvos and watchos --- third_party/cares/cares.BUILD | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 78a4590c3e0..596dd06f88e 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -44,6 +44,36 @@ config_setting( values = {"cpu": "ios_arm64"}, ) +config_setting( + name = "tvos_x86_64", + values = {"cpu": "tvos_x86_64"}, +) + +config_setting( + name = "tvos_arm64", + values = {"cpu": "tvos_arm64"} +) + +config_setting( + name = "watchos_i386", + values = {"cpu": "watchos_i386"}, +) + +config_setting( + name = "watchos_x86_64", + values = {"cpu": "watchos_x86_64"} +) + +config_setting( + name = "watchos_armv7k", + values = {"cpu": "watchos_armv7k"}, +) + +config_setting( + name = "watchos_arm64_32", + values = {"cpu": "watchos_arm64_32"} +) + genrule( name = "ares_build_h", srcs = ["@com_github_grpc_grpc//third_party/cares:ares_build.h"], @@ -58,6 +88,12 @@ genrule( ":ios_armv7": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":ios_armv7s": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":ios_arm64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":tvos_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":tvos_arm64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_i386": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_armv7k": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], + ":watchos_arm64_32": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":darwin": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":darwin_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"], ":windows": ["@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h"], From ddf3f7ffb1c3d877e09118fb41a17a7b3619b238 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 17:26:06 -0700 Subject: [PATCH 08/24] Experimentally changed non-framework builds to bazel build Experimentally run Unit/MacTests with Bazel --- src/objective-c/tests/build_one_example.sh | 69 ++++++++++++--------- src/objective-c/tests/run_one_test_bazel.sh | 44 +++++++++++++ tools/run_tests/run_tests.py | 4 +- 3 files changed, 84 insertions(+), 33 deletions(-) create mode 100755 src/objective-c/tests/run_one_test_bazel.sh diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index caa048e258b..0a62008f8de 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -29,36 +29,43 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH -# clean the directory -rm -rf Pods -rm -rf *.xcworkspace -rm -f Podfile.lock - -pod install - -set -o pipefail -XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' -if [ "$SCHEME" == "tvOS-sample" ]; then - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=tvOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - +if [ "$FRAMEWORKS" == "NO" ]; then + if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then + SCHEME="watchOS-sample" + fi + cd .. + ../../../tools/bazel build $SCHEME else - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=iOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - -fi + # clean the directory + rm -rf Pods + rm -rf *.xcworkspace + rm -f Podfile.lock + pod install + + set -o pipefail + XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' + if [ "$SCHEME" == "tvOS-sample" ]; then + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=tvOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - + else + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=iOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - + fi +fi diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh new file mode 100755 index 00000000000..41ffa21490c --- /dev/null +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -ev + +cd $(dirname $0) + +BINDIR=../../../bins/$CONFIG + +[ -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." + exit 1 +} + +[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { + echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." + exit 1 +} + +PLAIN_PORT=$(curl localhost:32766/get) +TLS_PORT=$(curl localhost:32766/get) + +$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & + +trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT + +../../../tools/bazel run $SCHEME \ No newline at end of file diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index d3b028d4590..1cbf50e5264 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1150,7 +1150,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test.sh'], + ['src/objective-c/tests/run_one_test_bazel.sh'], timeout_seconds=60 * 60, shortname='ios-test-unittests', cpu_cost=1e6, @@ -1184,7 +1184,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test.sh'], + ['src/objective-c/tests/run_one_test_bazel.sh'], timeout_seconds=60 * 60, shortname='mac-test-basictests', cpu_cost=1e6, From 42737d976aa842d82afb7eea327a3ec6b97c8587 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 7 Aug 2019 19:37:19 -0700 Subject: [PATCH 09/24] Fixed prepare command to let bazel work after replacement --- gRPC-C++.podspec | 6 ++---- templates/gRPC-C++.podspec.template | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 7e728026e68..fd25efda82a 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -797,10 +797,8 @@ Pod::Spec.new do |s| end s.prepare_command = <<-END_OF_COMMAND - find src/cpp/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm - find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include ;g' - find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm - find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include ;g' - find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm + sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include \\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/cpp -type f -print | xargs grep -H -c '#include Date: Thu, 8 Aug 2019 11:50:38 -0700 Subject: [PATCH 10/24] Isolated test-specific build steps so that unrelated tasks don't run them Move interop making back to run_tests.py --- src/objective-c/tests/build_one_example.sh | 69 +++++++++---------- .../tests/build_one_example_bazel.sh | 35 ++++++++++ src/objective-c/tests/run_one_test.sh | 4 ++ .../{run_tests.sh => build_and_run_tests.sh} | 4 ++ ...{build_tests.sh => build_and_run_tests.sh} | 0 test/cpp/ios/run_tests.sh | 5 ++ tools/run_tests/run_tests.py | 18 ++--- 7 files changed, 86 insertions(+), 49 deletions(-) create mode 100755 src/objective-c/tests/build_one_example_bazel.sh rename test/core/iomgr/ios/CFStreamTests/{run_tests.sh => build_and_run_tests.sh} (97%) rename test/cpp/ios/{build_tests.sh => build_and_run_tests.sh} (100%) diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 0a62008f8de..caa048e258b 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -29,43 +29,36 @@ cd `dirname $0`/../../.. cd $EXAMPLE_PATH -if [ "$FRAMEWORKS" == "NO" ]; then - if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then - SCHEME="watchOS-sample" - fi - cd .. - ../../../tools/bazel build $SCHEME +# clean the directory +rm -rf Pods +rm -rf *.xcworkspace +rm -f Podfile.lock + +pod install + +set -o pipefail +XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' +if [ "$SCHEME" == "tvOS-sample" ]; then + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=tvOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - else - # clean the directory - rm -rf Pods - rm -rf *.xcworkspace - rm -f Podfile.lock - - pod install - - set -o pipefail - XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' - if [ "$SCHEME" == "tvOS-sample" ]; then - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=tvOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - - else - xcodebuild \ - build \ - -workspace *.xcworkspace \ - -scheme $SCHEME \ - -destination generic/platform=iOS \ - -derivedDataPath Build/Build \ - CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_REQUIRED=NO \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v "^$" - - fi + xcodebuild \ + build \ + -workspace *.xcworkspace \ + -scheme $SCHEME \ + -destination generic/platform=iOS \ + -derivedDataPath Build/Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - fi + diff --git a/src/objective-c/tests/build_one_example_bazel.sh b/src/objective-c/tests/build_one_example_bazel.sh new file mode 100755 index 00000000000..c3fb3f232b5 --- /dev/null +++ b/src/objective-c/tests/build_one_example_bazel.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2016 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -ev + +# Params: +# EXAMPLE_PATH - directory of the example +# SCHEME - scheme of the example, used by xcodebuild + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + +cd `dirname $0`/../../.. + +cd $EXAMPLE_PATH/.. + +if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then + SCHEME="watchOS-sample watchOS-sample-watchApp" +fi +../../../tools/bazel build $SCHEME \ No newline at end of file diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index b74107e4a66..a643740b64e 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -22,6 +22,10 @@ cd $(dirname $0) BINDIR=../../../bins/$CONFIG +[ -d Tests.xcworkspace/ ] || { + ./build_tests.sh +} + [ -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." diff --git a/test/core/iomgr/ios/CFStreamTests/run_tests.sh b/test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh similarity index 97% rename from test/core/iomgr/ios/CFStreamTests/run_tests.sh rename to test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh index e49a2e0b65e..933af6c8d9e 100755 --- a/test/core/iomgr/ios/CFStreamTests/run_tests.sh +++ b/test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh @@ -23,6 +23,10 @@ cd "$(dirname "$0")" echo "TIME: $(date)" +./build_tests.sh + +echo "TIME: $(date)" + XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' xcodebuild \ diff --git a/test/cpp/ios/build_tests.sh b/test/cpp/ios/build_and_run_tests.sh similarity index 100% rename from test/cpp/ios/build_tests.sh rename to test/cpp/ios/build_and_run_tests.sh diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/run_tests.sh index 9eee0cd28ca..83db83fd199 100755 --- a/test/cpp/ios/run_tests.sh +++ b/test/cpp/ios/run_tests.sh @@ -20,6 +20,11 @@ set -ev cd "$(dirname "$0")" +echo "TIME: $(date)" + +./build_tests.sh + +echo "TIME: $(date)" set -o pipefail diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 1cbf50e5264..0f42b52c50e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1060,7 +1060,7 @@ class ObjCLanguage(object): out = [] out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=10 * 60, shortname='ios-buildtest-example-sample', cpu_cost=1e6, @@ -1092,7 +1092,7 @@ class ObjCLanguage(object): })) out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=10 * 60, shortname='ios-buildtest-example-tvOS-sample', cpu_cost=1e6, @@ -1114,7 +1114,7 @@ class ObjCLanguage(object): # })) out.append( self.config.job_spec( - ['src/objective-c/tests/build_one_example.sh'], + ['src/objective-c/tests/build_one_example_bazel.sh'], timeout_seconds=20 * 60, shortname='ios-buildtest-example-watchOS-sample', cpu_cost=1e6, @@ -1143,7 +1143,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['test/core/iomgr/ios/CFStreamTests/run_tests.sh'], + ['test/core/iomgr/ios/CFStreamTests/build_and_run_tests.sh'], timeout_seconds=20 * 60, shortname='ios-test-cfstream-tests', cpu_cost=1e6, @@ -1177,14 +1177,14 @@ class ObjCLanguage(object): })) out.append( self.config.job_spec( - ['test/cpp/ios/run_tests.sh'], + ['test/cpp/ios/build_and_run_tests.sh'], timeout_seconds=20 * 60, shortname='ios-cpp-test-cronet', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test_bazel.sh'], + ['src/objective-c/tests/run_one_test.sh'], timeout_seconds=60 * 60, shortname='mac-test-basictests', cpu_cost=1e6, @@ -1215,11 +1215,7 @@ class ObjCLanguage(object): return [] def build_steps(self): - return [ - ['src/objective-c/tests/build_tests.sh'], - ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], - ['test/cpp/ios/build_tests.sh'], - ] + return [] def post_tests_steps(self): return [] From 4be53843d3f25025cf8f65d5644143305e8a8e54 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 14:41:46 -0700 Subject: [PATCH 11/24] Use bazel to run interop server Removed commented tests --- src/objective-c/tests/run_one_test.sh | 14 ++++------- src/objective-c/tests/run_one_test_bazel.sh | 12 +++++----- src/objective-c/tests/run_tests.sh | 13 +++++------ tools/run_tests/run_tests.py | 26 ++------------------- 4 files changed, 18 insertions(+), 47 deletions(-) diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index a643740b64e..8fb26d75b72 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -20,18 +20,12 @@ set -ev cd $(dirname $0) -BINDIR=../../../bins/$CONFIG +BAZEL=../../../tools/bazel -[ -d Tests.xcworkspace/ ] || { +[ -d Tests.xcworkspace ] || { ./build_tests.sh } -[ -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." - exit 1 -} - [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -40,8 +34,8 @@ BINDIR=../../../bins/$CONFIG PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 41ffa21490c..39c28fb28a5 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -22,10 +22,10 @@ cd $(dirname $0) BINDIR=../../../bins/$CONFIG -[ -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." - exit 1 +BAZEL=../../../tools/bazel + +[ -d Tests.xcworkspace ] || { + ./build_tests.sh } [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { @@ -36,8 +36,8 @@ BINDIR=../../../bins/$CONFIG PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -$BINDIR/interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -$BINDIR/interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 24185c561ec..916ca15b39f 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -22,15 +22,14 @@ cd $(dirname $0) # Run the tests server. -BINDIR=../../../bins/$CONFIG +BAZEL=../../../tools/bazel -[ -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." - exit 1 +[ -d Tests.xcworkspace ] || { + ./build_tests.sh } -$BINDIR/interop_server --port=5050 --max_send_message_size=8388608 & -$BINDIR/interop_server --port=5051 --max_send_message_size=8388608 --use_tls & +BAZEL run -- //test/cpp/interop:interop_server --port=5050 --max_send_message_size=8388608 & +BAZEL run -- //test/cpp/interop:interop_server --port=5051 --max_send_message_size=8388608 --use_tls & + # Kill them when this script exits. trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0f42b52c50e..0c3ef0bd57f 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1101,17 +1101,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=10 * 60, - # shortname='ios-buildtest-example-tvOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'tvOS-sample', - # 'EXAMPLE_PATH': 'src/objective-c/examples/tvOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example_bazel.sh'], @@ -1123,17 +1112,6 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', 'FRAMEWORKS': 'NO' })) - # out.append( - # self.config.job_spec( - # ['src/objective-c/tests/build_one_example.sh'], - # timeout_seconds=20 * 60, - # shortname='ios-buildtest-example-watchOS-sample-framework', - # cpu_cost=1e6, - # environ={ - # 'SCHEME': 'watchOS-sample-WatchKit-App', - # 'EXAMPLE_PATH': 'src/objective-c/examples/watchOS-sample', - # 'FRAMEWORKS': 'YES' - # })) out.append( self.config.job_spec( ['src/objective-c/tests/run_plugin_tests.sh'], @@ -1150,7 +1128,7 @@ class ObjCLanguage(object): environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( - ['src/objective-c/tests/run_one_test_bazel.sh'], + ['src/objective-c/tests/run_one_test.sh'], timeout_seconds=60 * 60, shortname='ios-test-unittests', cpu_cost=1e6, @@ -1209,7 +1187,7 @@ class ObjCLanguage(object): return [] def make_targets(self): - return ['interop_server'] + return [] def make_options(self): return [] From e00d7fc179a6eabaf7febe6e1468bff5a0078a98 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 8 Aug 2019 17:53:27 -0700 Subject: [PATCH 12/24] Run executable from bazel instead of bazel run (which did not seem to work) Increased timout limit because no interop_server was make'd b4 hand --- src/objective-c/tests/run_one_test.sh | 10 ++++++++-- src/objective-c/tests/run_one_test_bazel.sh | 12 ++++++++---- src/objective-c/tests/run_tests.sh | 19 +++++++++++++++++-- tools/run_tests/run_tests.py | 4 ++-- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/objective-c/tests/run_one_test.sh b/src/objective-c/tests/run_one_test.sh index 8fb26d75b72..2453072a9d5 100755 --- a/src/objective-c/tests/run_one_test.sh +++ b/src/objective-c/tests/run_one_test.sh @@ -22,10 +22,16 @@ cd $(dirname $0) BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -34,8 +40,8 @@ BAZEL=../../../tools/bazel PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 39c28fb28a5..97065e8545a 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -20,14 +20,18 @@ set -ev cd $(dirname $0) -BINDIR=../../../bins/$CONFIG - BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + [ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." exit 1 @@ -36,8 +40,8 @@ BAZEL=../../../tools/bazel PLAIN_PORT=$(curl localhost:32766/get) TLS_PORT=$(curl localhost:32766/get) -BAZEL run -- //test/cpp/interop:interop_server --port=$PLAIN_PORT --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 916ca15b39f..4ffb0e072d9 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -24,11 +24,26 @@ cd $(dirname $0) BAZEL=../../../tools/bazel +INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server + [ -d Tests.xcworkspace ] || { ./build_tests.sh } -BAZEL run -- //test/cpp/interop:interop_server --port=5050 --max_send_message_size=8388608 & -BAZEL run -- //test/cpp/interop:interop_server --port=5051 --max_send_message_size=8388608 --use_tls & + +[ -f $INTEROP ] || { + BAZEL build //test/cpp/interop:interop_server +} + +[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { + echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." + exit 1 +} + +PLAIN_PORT=$(curl localhost:32766/get) +TLS_PORT=$(curl localhost:32766/get) + +$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & +$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & # Kill them when this script exits. trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0c3ef0bd57f..c0b87d38087 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1072,7 +1072,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-sample-frameworks', cpu_cost=1e6, environ={ @@ -1083,7 +1083,7 @@ class ObjCLanguage(object): out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], - timeout_seconds=10 * 60, + timeout_seconds=20 * 60, shortname='ios-buildtest-example-switftsample', cpu_cost=1e6, environ={ From 422a7773aeb60e5847e1964089d842a1c93db6e2 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Fri, 9 Aug 2019 12:27:39 -0700 Subject: [PATCH 13/24] Replace making protoc and plugins with bazel build Fixed templates and plugin-tests --- .../!ProtoCompiler-gRPCCppPlugin.podspec | 12 +-- .../!ProtoCompiler-gRPCPlugin.podspec | 12 +-- src/objective-c/!ProtoCompiler.podspec | 17 +--- .../RemoteTestClient/RemoteTest.podspec | 6 +- .../tests/RemoteTestClient/RemoteTest.podspec | 34 +++---- src/objective-c/tests/run_plugin_tests.sh | 12 ++- ...otoCompiler-gRPCCppPlugin.podspec.template | 12 +-- ...!ProtoCompiler-gRPCPlugin.podspec.template | 12 +-- .../RemoteTestClientCpp/RemoteTestCpp.podspec | 89 ++++++------------- 9 files changed, 58 insertions(+), 148 deletions(-) diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 56ca7ce6ae4..67faaeb2567 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -94,6 +94,7 @@ Pod::Spec.new do |s| } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_cpp_plugin' s.preserve_paths = plugin @@ -111,15 +112,6 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_cpp_plugin CMD end diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 8509d465901..f65086b6df5 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -96,6 +96,7 @@ Pod::Spec.new do |s| } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_objective_c_plugin' s.preserve_paths = plugin @@ -115,15 +116,6 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_objective_c_plugin CMD end diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index b75d93a58be..9d036ac0b5b 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -120,20 +120,9 @@ Pod::Spec.new do |s| # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, build it from the local sources. repo_root = '../..' - plugin = 'grpc_objective_c_plugin' + bazel = "#{repo_root}/tools/bazel" + s.prepare_command = <<-CMD - if [ ! -f bin/protoc ]; then - cd #{repo_root} - # This will build protoc from the Protobuf submodule of gRPC, and put it in - # #{repo_root}/bins/opt/protobuf. - # - # TODO(jcanizales): Make won't build protoc from sources if one's locally installed, which - # _we do not want_. Find a way for this to always build from source. - make #{plugin} - cd - - else - mv bin/protoc . - mv include/google . - fi + #{bazel} build @com_google_protobuf//:protoc CMD end diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index e3dbf4fe7ef..ca45fd063bd 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -16,11 +16,11 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - bin_dir = "#{repo_root}/bins/$CONFIG" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_objective_c_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin" # Since we switched to importing full path, -I needs to be set to the directory # from which the imported file can be found, which is the grpc's root here diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index d772163e117..4a35328f73f 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -16,34 +16,20 @@ Pod::Spec.new do |s| s.dependency "!ProtoCompiler-gRPCPlugin" repo_root = '../../../..' - config = ENV['CONFIG'] || 'opt' - bin_dir = "#{repo_root}/bins/#{config}" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_objective_c_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin" s.prepare_command = <<-CMD - if [ -f #{protoc} ]; then - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto - else - # protoc was not found bin_dir, use installed version instead - (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") - - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto - fi + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto CMD s.subspec "Messages" do |ms| diff --git a/src/objective-c/tests/run_plugin_tests.sh b/src/objective-c/tests/run_plugin_tests.sh index bcab3bb9cff..760103eb7cd 100755 --- a/src/objective-c/tests/run_plugin_tests.sh +++ b/src/objective-c/tests/run_plugin_tests.sh @@ -22,9 +22,15 @@ cd $(dirname $0) # Run the tests server. -BINDIR=../../../bins/$CONFIG -PROTOC=$BINDIR/protobuf/protoc -PLUGIN=$BINDIR/grpc_objective_c_plugin +ROOT_DIR=../../.. +BAZEL=$ROOT_DIR/tools/bazel +BAZEL_EXEC_ROOT=$ROOT_DIR/bazel-out/darwin-fastbuild/bin +PROTOC=$BAZEL_EXEC_ROOT/external/com_google_protobuf/protoc +PLUGIN=$BAZEL_EXEC_ROOT/src/compiler/grpc_objective_c_plugin + +[ -f $PROTOC ] && [ -f $PLUGIN ] || { + BAZEL build @com_google_protobuf//:protoc //src/compiler:grpc_objective_c_plugin +} rm -rf PluginTest/*pb* diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template index 259a5c54f24..072a59657da 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template @@ -96,6 +96,7 @@ } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_cpp_plugin' s.preserve_paths = plugin @@ -113,15 +114,6 @@ # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_cpp_plugin CMD end diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index f612bd56cff..6286e3369e2 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -98,6 +98,7 @@ } repo_root = '../..' + bazel = "#{repo_root}/tools/bazel" plugin = 'grpc_objective_c_plugin' s.preserve_paths = plugin @@ -117,15 +118,6 @@ # present in this pod's directory. We use that knowledge to check for the existence of the file # and, if absent, compile the plugin from the local sources. s.prepare_command = <<-CMD - if [ ! -f #{plugin} ]; then - cd #{repo_root} - # This will build the plugin and put it in #{repo_root}/bins/opt. - # - # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and - # library binary) if found, which _we do not want_. Find a way for this to always use the - # sources in the repo. - make #{plugin} - cd - - fi + #{bazel} build //src/compiler:grpc_objective_c_plugin CMD end diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec index 0d51fdab31e..a0f0e2e436a 100644 --- a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -15,78 +15,39 @@ Pod::Spec.new do |s| s.dependency "Protobuf-C++" s.dependency "gRPC-C++" s.source_files = "src/proto/grpc/testing/*.pb.{h,cc}" - s.header_mappings_dir = "RemoteTestCpp" + s.header_mappings_dir = "." s.requires_arc = false repo_root = '../../../..' - config = ENV['CONFIG'] || 'opt' - bin_dir = "#{repo_root}/bins/#{config}" + bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" - protoc = "#{bin_dir}/protobuf/protoc" + protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" well_known_types_dir = "#{repo_root}/third_party/protobuf/src" - plugin = "#{bin_dir}/grpc_cpp_plugin" + plugin = "#{bazel_exec_root}/src/compiler/grpc_cpp_plugin" proto_dir = "#{repo_root}/src/proto/grpc/testing" s.prepare_command = <<-CMD - if [ -f #{protoc} ]; then - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto - else - # protoc was not found bin_dir, use installed version instead - - if ! [ -x "$(command -v protoc)" ]; then - (>&2 echo "\nERROR: protoc not found") - exit 1 - fi - (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") - - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - protoc \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{proto_dir} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto - fi + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto CMD s.pod_target_xcconfig = { From 1d981068475d6b938b6df0132e14e3a0f0e93229 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 10:45:52 -0700 Subject: [PATCH 14/24] Renaming the correct files --- test/cpp/ios/build_and_run_tests.sh | 31 +++++++++---------- test/cpp/ios/{run_tests.sh => build_tests.sh} | 31 ++++++++++--------- 2 files changed, 31 insertions(+), 31 deletions(-) rename test/cpp/ios/{run_tests.sh => build_tests.sh} (61%) diff --git a/test/cpp/ios/build_and_run_tests.sh b/test/cpp/ios/build_and_run_tests.sh index ead0159dcc9..83db83fd199 100755 --- a/test/cpp/ios/build_and_run_tests.sh +++ b/test/cpp/ios/build_and_run_tests.sh @@ -14,27 +14,26 @@ # limitations under the License. # Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l objc +# ./tools/run_tests/run_tests.py -l c++ -set -e - -# CocoaPods requires the terminal to be using UTF-8 encoding. -export LANG=en_US.UTF-8 +set -ev 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 -} +echo "TIME: $(date)" -# clean the directory -rm -rf Pods -rm -rf Tests.xcworkspace -rm -f Podfile.lock -rm -rf RemoteTestClientCpp/src +./build_tests.sh echo "TIME: $(date)" -pod install +set -o pipefail + +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' + +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme CronetTests \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' - diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/build_tests.sh similarity index 61% rename from test/cpp/ios/run_tests.sh rename to test/cpp/ios/build_tests.sh index 83db83fd199..ead0159dcc9 100755 --- a/test/cpp/ios/run_tests.sh +++ b/test/cpp/ios/build_tests.sh @@ -14,26 +14,27 @@ # limitations under the License. # Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l c++ +# ./tools/run_tests/run_tests.py -l objc -set -ev +set -e + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 cd "$(dirname "$0")" -echo "TIME: $(date)" +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 +} -./build_tests.sh +# clean the directory +rm -rf Pods +rm -rf Tests.xcworkspace +rm -f Podfile.lock +rm -rf RemoteTestClientCpp/src echo "TIME: $(date)" +pod install -set -o pipefail - -XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' - -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme CronetTests \ - -destination name="iPhone 8" \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' - From 4c893d8cdc279c8d460a53ed4dd809761588361d Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:04:18 -0700 Subject: [PATCH 15/24] Changed dev languages and bundle ids --- src/objective-c/examples/BUILD | 12 +++---- .../Sample/Sample.xcodeproj/project.pbxproj | 4 +-- .../examples/Sample/Sample/Info.plist | 2 +- .../tvOS-sample.xcodeproj/project.pbxproj | 6 ++-- .../tvOS-sample/tvOS-sample/Info.plist | 2 +- .../watchOS-sample/WatchKit-App/Info.plist | 4 +-- .../WatchKit-Extension/Info.plist | 4 +-- .../watchOS-sample.xcodeproj/project.pbxproj | 36 ++++--------------- .../watchOS-sample/watchOS-sample/Info.plist | 2 +- 9 files changed, 24 insertions(+), 48 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 5e3e4f9badd..4f333cd7502 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -63,7 +63,7 @@ objc_library( ios_application( name = "Sample", - bundle_id = "grpc.objc.examples.Sample", + bundle_id = "io.grpc.Sample", minimum_os_version = "8.0", infoplists = ["Sample/Sample/Info.plist"], families = [ @@ -87,7 +87,7 @@ objc_library( ios_application( name = "InterceptorSample", - bundle_id = "grpc.objc.examples.InterceptorSample", + bundle_id = "io.grpc.InterceptorSample", minimum_os_version = "9.0", # Safe Area Layout Guide used infoplists = ["InterceptorSample/InterceptorSample/Info.plist"], families = [ @@ -111,7 +111,7 @@ objc_library( # c-ares does not support tvOS CPU architecture with Bazel yet tvos_application( name = "tvOS-sample", - bundle_id = "grpc.objc.examples.tvOS-sample", + bundle_id = "io.grpc.tvOS-sample", minimum_os_version = "10.0", infoplists = ["tvOS-sample/tvOS-sample/Info.plist"], deps = [":tvOS-sample-lib"], @@ -141,7 +141,7 @@ objc_library( ios_application( name = "watchOS-sample", - bundle_id = "com.google.watchOS-sample", + bundle_id = "io.grpc.watchOS-sample", minimum_os_version = "9.0", # Safe Area Layout Guide used families = ["iphone"], infoplists = ["watchOS-sample/watchOS-sample/Info.plist"], @@ -152,7 +152,7 @@ ios_application( # c-ares does not support watchOS CPU architecture with Bazel yet watchos_application( name = "watchOS-sample-watchApp", - bundle_id = "com.google.watchOS-sample.watchkitapp", + bundle_id = "io.grpc.watchOS-sample.watchkitapp", minimum_os_version = "4.0", storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"], infoplists = ["watchOS-sample/WatchKit-App/Info.plist"], @@ -161,7 +161,7 @@ watchos_application( watchos_extension( name = "watchOS-sample-extension", - bundle_id = "com.google.watchOS-sample.watchkitapp.watchkitextension", + bundle_id = "io.grpc.watchOS-sample.watchkitapp.watchkitextension", minimum_os_version = "4.0", infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"], deps = [":watchOS-sample-extension-lib"], diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index cdd1c6c8f7e..2c8156de1e3 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -327,7 +327,7 @@ INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -340,7 +340,7 @@ INFOPLIST_FILE = Sample/Info.plist; LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/src/objective-c/examples/Sample/Sample/Info.plist b/src/objective-c/examples/Sample/Sample/Info.plist index 2cdf09dc2fc..943e942ae83 100644 --- a/src/objective-c/examples/Sample/Sample/Info.plist +++ b/src/objective-c/examples/Sample/Sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj index 84eafed2608..be6863f9f3f 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj @@ -214,7 +214,7 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh", - "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle", + $PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle, ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -365,7 +365,7 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; @@ -384,7 +384,7 @@ DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "tvOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = 3; diff --git a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist index 63dcd6c1d26..33fbde9c63c 100644 --- a/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist +++ b/src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist index 6dbcfe04d53..72c83c2794f 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-App/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleDisplayName WatchKit-App CFBundleExecutable @@ -26,7 +26,7 @@ UIInterfaceOrientationPortraitUpsideDown WKCompanionAppBundleIdentifier - com.google.watchOS-sample + io.grpc.watchOS-sample WKWatchKitApp diff --git a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist index 4a0a252b854..8d8373ba3e5 100644 --- a/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist +++ b/src/objective-c/examples/watchOS-sample/WatchKit-Extension/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleDisplayName watchOS-sample WatchKit Extension CFBundleExecutable @@ -25,7 +25,7 @@ NSExtensionAttributes WKAppBundleIdentifier - com.google.watchOS-sample.watchkitapp + io.grpc.watchOS-sample.watchkitapp NSExtensionPointIdentifier com.apple.watchkit diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj index ddd91170243..8042b5c4a0d 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample.xcodeproj/project.pbxproj @@ -342,15 +342,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-resources.sh", "$PODS_CONFIGURATION_BUILD_DIR/gRPC-iOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); @@ -364,8 +360,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample/Pods-watchOS-sample-frameworks.sh", "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-iOS/openssl_grpc.framework", @@ -378,8 +372,6 @@ "${BUILT_PRODUCTS_DIR}/nanopb-iOS/nanopb.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", @@ -400,15 +392,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample-checkManifestLockResult.txt", ); @@ -422,15 +410,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-watchOS-sample WatchKit Extension-checkManifestLockResult.txt", ); @@ -444,15 +428,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-resources.sh", "$PODS_CONFIGURATION_BUILD_DIR/gRPC-watchOS/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}", ); @@ -466,8 +446,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-watchOS-sample WatchKit Extension/Pods-watchOS-sample WatchKit Extension-frameworks.sh", "${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC-watchOS/openssl_grpc.framework", @@ -480,8 +458,6 @@ "${BUILT_PRODUCTS_DIR}/nanopb-watchOS/nanopb.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", @@ -675,7 +651,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -693,7 +669,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp.watchkitextension"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp.watchkitextension"; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -710,7 +686,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -727,7 +703,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; IBSC_MODULE = watchOS_sample_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchKit-App/Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample.watchkitapp"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample.watchkitapp"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; @@ -745,7 +721,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -760,7 +736,7 @@ DEVELOPMENT_TEAM = 6T98ZJNPG5; INFOPLIST_FILE = "watchOS-sample/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.watchOS-sample"; + PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.watchOS-sample"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist index d0524738680..e5d82108923 100644 --- a/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist +++ b/src/objective-c/examples/watchOS-sample/watchOS-sample/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + en_US CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From 2a070b853d4cb178c9aa3e8b86ee86003dbf6ea9 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:06:59 -0700 Subject: [PATCH 16/24] Reverting changes --- .../tests/InteropTests/InteropTestsMultipleChannels.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index c363e523250..98893a466bd 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -86,9 +86,7 @@ dispatch_once_t initCronet; self.continueAfterFailure = NO; _remoteService = [RMTTestService serviceWithHost:kRemoteSSLHost callOptions:nil]; -#ifdef GRPC_COMPILE_WITH_CRONET configureCronet(); -#endif // Default stack with remote host GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; From 0ad64536edefdb80eff20180717806f4a2694373 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 11:15:38 -0700 Subject: [PATCH 17/24] Added some comments and TODOs --- .../tests/build_one_example_bazel.sh | 4 +- src/objective-c/tests/run_one_test_bazel.sh | 3 + src/objective-c/tests/run_tests.sh | 111 ------------------ tools/run_tests/run_tests.py | 2 + 4 files changed, 7 insertions(+), 113 deletions(-) delete mode 100755 src/objective-c/tests/run_tests.sh diff --git a/src/objective-c/tests/build_one_example_bazel.sh b/src/objective-c/tests/build_one_example_bazel.sh index c3fb3f232b5..b547ac157f0 100755 --- a/src/objective-c/tests/build_one_example_bazel.sh +++ b/src/objective-c/tests/build_one_example_bazel.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2016 gRPC authors. +# Copyright 2019 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,4 +32,4 @@ cd $EXAMPLE_PATH/.. if [ "$SCHEME" == "watchOS-sample-WatchKit-App" ]; then SCHEME="watchOS-sample watchOS-sample-watchApp" fi -../../../tools/bazel build $SCHEME \ No newline at end of file +../../../tools/bazel build $SCHEME diff --git a/src/objective-c/tests/run_one_test_bazel.sh b/src/objective-c/tests/run_one_test_bazel.sh index 97065e8545a..8f920d955fd 100755 --- a/src/objective-c/tests/run_one_test_bazel.sh +++ b/src/objective-c/tests/run_one_test_bazel.sh @@ -16,6 +16,9 @@ # Don't run this script standalone. Instead, run from the repository root: # ./tools/run_tests/run_tests.py -l objc +# TODO(tonyzhehaolu): +# For future use when Xcode is upgraded and tvos_unit_test is fully functional + set -ev cd $(dirname $0) diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh deleted file mode 100755 index 4ffb0e072d9..00000000000 --- a/src/objective-c/tests/run_tests.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Don't run this script standalone. Instead, run from the repository root: -# ./tools/run_tests/run_tests.py -l objc - -set -ev - -cd $(dirname $0) - -# Run the tests server. - -BAZEL=../../../tools/bazel - -INTEROP=../../../bazel-out/darwin-fastbuild/bin/test/cpp/interop/interop_server - -[ -d Tests.xcworkspace ] || { - ./build_tests.sh -} - -[ -f $INTEROP ] || { - BAZEL build //test/cpp/interop:interop_server -} - -[ -z "$(ps aux |egrep 'port_server\.py.*-p\s32766')" ] && { - echo >&2 "Can't find the port server. Start port server with tools/run_tests/start_port_server.py." - exit 1 -} - -PLAIN_PORT=$(curl localhost:32766/get) -TLS_PORT=$(curl localhost:32766/get) - -$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 & -$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls & - -# Kill them when this script exits. -trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT - -set -o pipefail - -# xcodebuild is very verbose. We filter its output and tell Bash to fail if any -# element of the pipe fails. -# TODO(jcanizales): Use xctool instead? Issue #2540. -XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' - -echo "TIME: $(date)" - -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme InteropTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme UnitTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme CronetTests \ - -destination name="iPhone 8" \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme MacTests \ - -destination platform=macOS \ - HOST_PORT_LOCALSSL=localhost:5051 \ - HOST_PORT_LOCAL=localhost:5050 \ - HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ - test \ - | egrep -v "$XCODEBUILD_FILTER" \ - | egrep -v '^$' \ - | egrep -v "(GPBDictionary|GPBArray)" - - -exit 0 diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index c0b87d38087..95c3d8ed1dd 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1069,6 +1069,7 @@ class ObjCLanguage(object): 'EXAMPLE_PATH': 'src/objective-c/examples/Sample', 'FRAMEWORKS': 'NO' })) + # Currently not supporting compiling as frameworks in Bazel out.append( self.config.job_spec( ['src/objective-c/tests/build_one_example.sh'], @@ -1126,6 +1127,7 @@ class ObjCLanguage(object): shortname='ios-test-cfstream-tests', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) + # TODO: replace with run_one_test_bazel.sh when Bazel is stable out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'], From de6d4978e0aeffcc89127d587ed9f38da052ad11 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Tue, 13 Aug 2019 15:47:19 -0700 Subject: [PATCH 18/24] Merge test_objc_grpc_library into local_... with a testing BOOL flag --- .../grpc_objc_internal_library.bzl | 66 +++---------------- src/objective-c/tests/BUILD | 7 +- 2 files changed, 12 insertions(+), 61 deletions(-) diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index b043a0f6880..51206c1e903 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -73,7 +73,7 @@ def grpc_objc_testing_library( deps = deps + additional_deps, ) -def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): +def local_objc_grpc_library(name, deps, testing = True, srcs = [], use_well_known_protos = False, **kwargs): """!!For local targets within the gRPC repository only!! Will not work outside of the repo """ objc_grpc_library_name = "_" + name + "_objc_grpc_library" @@ -104,55 +104,11 @@ def local_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False ) arc_srcs = [":" + objc_grpc_library_name + "_srcs"] - native.objc_library( - name = name, - hdrs = [":" + objc_grpc_library_name + "_hdrs"], - non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"], - srcs = arc_srcs, - defines = [ - "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", - "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", - ], - includes = [ - "_generated_protos", - "src/objective-c", - ], - deps = [ - "//src/objective-c:proto_objc_rpc", - "@com_google_protobuf//:protobuf_objc", - ], - ) - -def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs): - """!!For testing within the gRPC repository only!! Will not work outside of the repo - """ - objc_grpc_library_name = "_" + name + "_objc_grpc_library" - - generate_objc( - name = objc_grpc_library_name, - srcs = srcs, - deps = deps, - use_well_known_protos = use_well_known_protos, - **kwargs - ) - - generate_objc_hdrs( - name = objc_grpc_library_name + "_hdrs", - src = ":" + objc_grpc_library_name, - ) - - generate_objc_non_arc_srcs( - name = objc_grpc_library_name + "_non_arc_srcs", - src = ":" + objc_grpc_library_name, - ) - - arc_srcs = None - if len(srcs) > 0: - generate_objc_srcs( - name = objc_grpc_library_name + "_srcs", - src = ":" + objc_grpc_library_name, - ) - arc_srcs = [":" + objc_grpc_library_name + "_srcs"] + library_deps = ["@com_google_protobuf//:protobuf_objc"] + if testing: + library_deps += ["//src/objective-c:grpc_objc_client_internal_testing"] + else: + library_deps += ["//src/objective-c:proto_objc_rpc"] native.objc_library( name = name, @@ -163,12 +119,6 @@ def testing_objc_grpc_library(name, deps, srcs = [], use_well_known_protos = Fal "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0", "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0", ], - includes = [ - "_generated_protos", - "src/objective-c", - ], - deps = [ - "//src/objective-c:grpc_objc_client_internal_testing", - "@com_google_protobuf//:protobuf_objc", - ], + includes = ["_generated_protos"], + deps = library_deps, ) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 5d8042ca20a..80c12fba548 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -21,7 +21,7 @@ package(default_visibility = ["//visibility:private"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", "grpc_objc_testing_library", - "testing_objc_grpc_library" + "local_objc_grpc_library" ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") @@ -41,10 +41,11 @@ proto_library( deps = [":messages_proto"], ) -testing_objc_grpc_library( +local_objc_grpc_library( name = "RemoteTest", srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, + testing = True, deps = [":test_proto"], ) @@ -232,4 +233,4 @@ tvos_unit_test( ":InteropTestsLocalCleartext-lib", ], test_host = ":tvos-host", -) \ No newline at end of file +) From cb6a8ae0d2d03bd2fe3e288b54d6ca4731237b13 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 13:31:36 -0700 Subject: [PATCH 19/24] Added experimental wrappers for importing to Google3 --- src/objective-c/examples/BUILD | 11 ++++++++--- .../grpc_objc_internal_library.bzl | 19 ++++++++++++++++--- src/objective-c/tests/BUILD | 8 +++++--- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 4f333cd7502..6689a5a28b8 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -15,20 +15,25 @@ # limitations under the License. -load("//src/objective-c:grpc_objc_internal_library.bzl", "local_objc_grpc_library") +load( + "//src/objective-c:grpc_objc_internal_library.bzl", + "local_objc_grpc_library", + "proto_library_objc_wrapper", +) load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application") load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension") -proto_library( +proto_library_objc_wrapper( name = "messages_proto", srcs = ["RemoteTestClient/messages.proto"], ) -proto_library( +proto_library_objc_wrapper( name = "test_proto", srcs = ["RemoteTestClient/test.proto"], deps = [":messages_proto"], + use_well_known_protos = True, ) # use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index 51206c1e903..7035e963b94 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -30,7 +30,20 @@ load( "generate_objc_srcs", "generate_objc_non_arc_srcs" ) -load("//bazel:protobuf.bzl", "well_known_proto_libs") + +def proto_library_objc_wrapper( + name, + srcs, + deps = [], + use_well_known_protos = False): + """proto_library for adding dependencies to google/protobuf protos + use_well_known_protos - ignored in open source version + """ + native.proto_library( + name = name, + srcs = srcs, + deps = deps, + ) def grpc_objc_testing_library( name, @@ -53,7 +66,7 @@ def grpc_objc_testing_library( includes: added to search path, always [the path to objc directory] deps: dependencies """ - + additional_deps = [ ":RemoteTest", "//src/objective-c:grpc_objc_client_internal_testing", @@ -61,7 +74,7 @@ def grpc_objc_testing_library( if not name == "TestConfigs": additional_deps += [":TestConfigs"] - + native.objc_library( name = name, hdrs = hdrs, diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 80c12fba548..2d0a57ac21d 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -21,7 +21,8 @@ package(default_visibility = ["//visibility:private"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", "grpc_objc_testing_library", - "local_objc_grpc_library" + "local_objc_grpc_library", + "proto_library_objc_wrapper", ) load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") @@ -30,15 +31,16 @@ load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_ exports_files(["LICENSE"]) -proto_library( +proto_library_objc_wrapper( name = "messages_proto", srcs = ["RemoteTestClient/messages.proto"], ) -proto_library( +proto_library_objc_wrapper( name = "test_proto", srcs = ["RemoteTestClient/test.proto"], deps = [":messages_proto"], + use_well_known_protos = True, ) local_objc_grpc_library( From 5de502528f08a7e3d16b9fb3af04eb579d3e86eb Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 15:39:40 -0700 Subject: [PATCH 20/24] Add license --- src/objective-c/examples/BUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 6689a5a28b8..3e25c5c7dfa 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +licenses(["notice"]) # 3-clause BSD + +package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", From 7422a14a5d95ee637283febdd85fd4ef271b9417 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 16:44:56 -0700 Subject: [PATCH 21/24] Added wrapper for objc_library in examples --- src/objective-c/examples/BUILD | 18 ++++------ .../grpc_objc_internal_library.bzl | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 3e25c5c7dfa..4d838b17ba0 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -20,6 +20,7 @@ package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", + "grpc_objc_examples_library", "local_objc_grpc_library", "proto_library_objc_wrapper", ) @@ -41,7 +42,7 @@ proto_library_objc_wrapper( # use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo local_objc_grpc_library( - name = "test_grpc_objc", + name = "RemoteTest", srcs = ["RemoteTestClient/test.proto"], use_well_known_protos = True, deps = [ @@ -58,7 +59,7 @@ local_objc_grpc_library( ], ) -objc_library( +grpc_objc_examples_library( name = "Sample-lib", srcs = glob(["Sample/Sample/**/*.m"]), hdrs = glob(["Sample/Sample/**/*.h"]), @@ -66,7 +67,6 @@ objc_library( "Sample/Sample/Base.lproj/**", "Sample/Sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) ios_application( @@ -82,7 +82,7 @@ ios_application( visibility = ["//visibility:public"], ) -objc_library( +grpc_objc_examples_library( name = "InterceptorSample-lib", srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]), hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]), @@ -90,7 +90,6 @@ objc_library( "InterceptorSample/InterceptorSample/Base.lproj/**", "InterceptorSample/InterceptorSample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) ios_application( @@ -105,7 +104,7 @@ ios_application( deps = ["InterceptorSample-lib"], ) -objc_library( +grpc_objc_examples_library( name = "tvOS-sample-lib", srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]), hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]), @@ -113,7 +112,6 @@ objc_library( "tvOS-sample/tvOS-sample/Base.lproj/**", "tvOS-sample/tvOS-sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) # c-ares does not support tvOS CPU architecture with Bazel yet @@ -125,7 +123,7 @@ tvos_application( deps = [":tvOS-sample-lib"], ) -objc_library( +grpc_objc_examples_library( name = "watchOS-sample-iOS-lib", srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]), hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]), @@ -133,14 +131,12 @@ objc_library( "watchOS-sample/watchOS-sample/Base.lproj/**", "watchOS-sample/watchOS-sample/Images.xcassets/**", ]), - deps = [":test_grpc_objc"], ) -objc_library( +grpc_objc_examples_library( name = "watchOS-sample-extension-lib", srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]), hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]), - deps = [":test_grpc_objc"], sdk_frameworks = [ "WatchConnectivity", "WatchKit", diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index 7035e963b94..c90293d827d 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -45,6 +45,41 @@ def proto_library_objc_wrapper( deps = deps, ) +def grpc_objc_examples_library( + name, + srcs = [], + hdrs = [], + textual_hdrs = [], + data = [], + deps = [], + defines = [], + sdk_frameworks = [], + includes = []): + """objc_library for testing, only works in //src/objective-c/exmaples + + Args: + name: name of target + hdrs: public headers + srcs: all source files (.m) + textual_hdrs: private headers + data: any other bundle resources + defines: preprocessors + sdk_frameworks: sdks + includes: added to search path, always [the path to objc directory] + deps: dependencies + """ + native.objc_library( + name = name, + srcs = srcs, + hdrs = hdrs, + textual_hdrs = textual_hdrs, + data = data, + defines = defines, + includes = includes, + sdk_frameworks = sdk_frameworks, + deps = deps + [":RemoteTest"], + ) + def grpc_objc_testing_library( name, srcs = [], From b4eefcfc0e4b18c79674c073efa326649f6ec8b3 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 16:47:29 -0700 Subject: [PATCH 22/24] Added source of new CPUs --- third_party/cares/cares.BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 596dd06f88e..203712b182f 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -44,6 +44,8 @@ config_setting( values = {"cpu": "ios_arm64"}, ) +# The following architectures are found in +# https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java config_setting( name = "tvos_x86_64", values = {"cpu": "tvos_x86_64"}, From eb2ed99a841fd5ec98ed6ad4f9f665cb964e93db Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Wed, 14 Aug 2019 17:07:59 -0700 Subject: [PATCH 23/24] Changed visibility to public --- src/objective-c/tests/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 2d0a57ac21d..d34807f017f 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -16,7 +16,7 @@ licenses(["notice"]) # Apache v2 -package(default_visibility = ["//visibility:private"]) +package(default_visibility = ["//visibility:public"]) load( "//src/objective-c:grpc_objc_internal_library.bzl", From f037eac0a96096e41818024303863eaa7719f693 Mon Sep 17 00:00:00 2001 From: Tony Lu Date: Thu, 15 Aug 2019 13:37:14 -0700 Subject: [PATCH 24/24] Small fixes --- .../RemoteTestClientCpp/RemoteTestCpp.podspec | 16 +--------------- tools/run_tests/run_tests.py | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec index a0f0e2e436a..debe2943208 100644 --- a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -33,21 +33,7 @@ Pod::Spec.new do |s| --grpc_out=. \ -I #{repo_root} \ -I #{well_known_types_dir} \ - #{proto_dir}/echo.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{proto_dir}/echo_messages.proto - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --cpp_out=. \ - --grpc_out=. \ - -I #{repo_root} \ - -I #{well_known_types_dir} \ - #{proto_dir}/simple_messages.proto + #{proto_dir}/echo.proto #{proto_dir}/echo_messages.proto #{proto_dir}/simple_messages.proto CMD s.pod_target_xcconfig = { diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 95c3d8ed1dd..1ff37ca85af 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1127,7 +1127,7 @@ class ObjCLanguage(object): shortname='ios-test-cfstream-tests', cpu_cost=1e6, environ=_FORCE_ENVIRON_FOR_WRAPPERS)) - # TODO: replace with run_one_test_bazel.sh when Bazel is stable + # TODO: replace with run_one_test_bazel.sh when Bazel-Xcode is stable out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'],