1# gRPC Bazel BUILD file. 2# 3# Copyright 2019 gRPC authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17licenses(["notice"]) # Apache v2 18 19package(default_visibility = ["//visibility:public"]) 20 21load( 22 "//src/objective-c:grpc_objc_internal_library.bzl", 23 "grpc_objc_testing_library", 24 "local_objc_grpc_library", 25 "proto_library_objc_wrapper", 26) 27load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") 28load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test") 29load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") 30load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_test") 31 32exports_files(["LICENSE"]) 33 34proto_library_objc_wrapper( 35 name = "messages_proto", 36 srcs = ["RemoteTestClient/messages.proto"], 37) 38 39proto_library_objc_wrapper( 40 name = "test_proto", 41 srcs = ["RemoteTestClient/test.proto"], 42 use_well_known_protos = True, 43 deps = [":messages_proto"], 44) 45 46local_objc_grpc_library( 47 name = "RemoteTest", 48 srcs = ["RemoteTestClient/test.proto"], 49 testing = True, 50 use_well_known_protos = True, 51 deps = [":test_proto"], 52) 53 54apple_resource_bundle( 55 name = "TestCertificates", 56 resources = ["TestCertificates.bundle/test-certificates.pem"], 57) 58 59# TestConfigs is added to each grpc_objc_testing_library's deps 60grpc_objc_testing_library( 61 name = "TestConfigs", 62 hdrs = ["version.h"], 63 data = [":TestCertificates"], 64 defines = [ 65 "DEBUG=1", 66 "HOST_PORT_LOCALSSL=localhost:5051", 67 "HOST_PORT_LOCAL=localhost:5050", 68 "HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com", 69 ], 70) 71 72objc_library( 73 name = "host-lib", 74 srcs = glob(["Hosts/ios-host/*.m"]), 75 hdrs = glob(["Hosts/ios-host/*.h"]), 76) 77 78ios_application( 79 name = "ios-host", 80 bundle_id = "grpc.objc.tests.ios-host", 81 families = [ 82 "iphone", 83 "ipad", 84 ], 85 infoplists = ["Hosts/ios-host/Info.plist"], 86 minimum_os_version = "9.0", 87 deps = ["host-lib"], 88) 89 90tvos_application( 91 name = "tvos-host", 92 bundle_id = "grpc.objc.tests.tvos-host", 93 infoplists = ["Hosts/ios-host/Info.plist"], 94 minimum_os_version = "10.0", 95 deps = ["host-lib"], 96) 97 98grpc_objc_testing_library( 99 name = "InteropTests-lib", 100 srcs = ["InteropTests/InteropTests.m"], 101 hdrs = ["InteropTests/InteropTests.h"], 102 deps = [ 103 ":InteropTestsBlockCallbacks-lib", 104 ], 105) 106 107grpc_objc_testing_library( 108 name = "InteropTestsRemote-lib", 109 srcs = ["InteropTests/InteropTestsRemote.m"], 110 deps = [":InteropTests-lib"], 111) 112 113grpc_objc_testing_library( 114 name = "InteropTestsBlockCallbacks-lib", 115 srcs = ["InteropTests/InteropTestsBlockCallbacks.m"], 116 hdrs = ["InteropTests/InteropTestsBlockCallbacks.h"], 117) 118 119grpc_objc_testing_library( 120 name = "InteropTestsLocalSSL-lib", 121 srcs = ["InteropTests/InteropTestsLocalSSL.m"], 122 deps = [":InteropTests-lib"], 123) 124 125grpc_objc_testing_library( 126 name = "InteropTestsLocalCleartext-lib", 127 srcs = ["InteropTests/InteropTestsLocalCleartext.m"], 128 deps = [":InteropTests-lib"], 129) 130 131grpc_objc_testing_library( 132 name = "InteropTestsMultipleChannels-lib", 133 srcs = ["InteropTests/InteropTestsMultipleChannels.m"], 134 deps = [":InteropTests-lib"], 135) 136 137grpc_objc_testing_library( 138 name = "RxLibraryUnitTests-lib", 139 srcs = ["UnitTests/RxLibraryUnitTests.m"], 140) 141 142grpc_objc_testing_library( 143 name = "GRPCClientTests-lib", 144 srcs = ["UnitTests/GRPCClientTests.m"], 145) 146 147grpc_objc_testing_library( 148 name = "APIv2Tests-lib", 149 srcs = ["UnitTests/APIv2Tests.m"], 150) 151 152grpc_objc_testing_library( 153 name = "ChannelPoolTest-lib", 154 srcs = ["UnitTests/ChannelPoolTest.m"], 155) 156 157grpc_objc_testing_library( 158 name = "ChannelTests-lib", 159 srcs = ["UnitTests/ChannelTests.m"], 160) 161 162grpc_objc_testing_library( 163 name = "NSErrorUnitTests-lib", 164 srcs = ["UnitTests/NSErrorUnitTests.m"], 165) 166 167grpc_objc_testing_library( 168 name = "MacStressTests-lib", 169 srcs = glob([ 170 "MacTests/*.m", 171 ]), 172 hdrs = ["MacTests/StressTests.h"], 173) 174 175ios_unit_test( 176 name = "UnitTests", 177 minimum_os_version = "9.0", 178 test_host = ":ios-host", 179 deps = [ 180 ":APIv2Tests-lib", 181 ":ChannelPoolTest-lib", 182 ":ChannelTests-lib", 183 ":GRPCClientTests-lib", 184 ":NSErrorUnitTests-lib", 185 ":RxLibraryUnitTests-lib", 186 ], 187) 188 189ios_unit_test( 190 name = "InteropTests", 191 minimum_os_version = "9.0", 192 test_host = ":ios-host", 193 deps = [ 194 ":InteropTestsLocalCleartext-lib", 195 ":InteropTestsLocalSSL-lib", 196 ":InteropTestsRemote-lib", 197 ], 198) 199 200macos_unit_test( 201 name = "MacTests", 202 minimum_os_version = "10.10", 203 deps = [ 204 ":APIv2Tests-lib", 205 ":InteropTestsLocalCleartext-lib", 206 ":InteropTestsLocalSSL-lib", 207 ":InteropTestsRemote-lib", 208 ":MacStressTests-lib", 209 ":NSErrorUnitTests-lib", 210 ":RxLibraryUnitTests-lib", 211 ], 212) 213 214# bazel run tvos_unit_test is not yet supported by xctestrunner 215tvos_unit_test( 216 name = "TvTests", 217 minimum_os_version = "10.0", 218 test_host = ":tvos-host", 219 deps = [ 220 ":APIv2Tests-lib", 221 ":InteropTestsLocalCleartext-lib", 222 ":InteropTestsLocalSSL-lib", 223 ":InteropTestsRemote-lib", 224 ":NSErrorUnitTests-lib", 225 ":RxLibraryUnitTests-lib", 226 ], 227) 228