Merge pull request #19890 from Tony1023/build_test

Added BUILD for //examples/objective-c
pull/19978/head
rmstar 5 years ago committed by GitHub
commit 04fc76abbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      bazel/grpc_deps.bzl
  2. 1
      bazel/objc_grpc_library.bzl
  3. 5
      examples/BUILD
  4. 119
      examples/objective-c/BUILD
  5. 4
      examples/objective-c/helloworld/main.m
  6. 2
      examples/objective-c/helloworld_macos/HelloWorld/Info.plist
  7. 4
      examples/objective-c/helloworld_macos/main.m
  8. 4
      examples/objective-c/route_guide/ViewControllers.m
  9. 28
      test/build_test/BUILD

@ -191,11 +191,10 @@ def grpc_deps():
)
if "bazel_skylib" not in native.existing_rules():
http_archive(
git_repository(
name = "bazel_skylib",
sha256 = "ba5d15ca230efca96320085d8e4d58da826d1f81b444ef8afccd8b23e0799b52",
strip_prefix = "bazel-skylib-f83cb8dd6f5658bc574ccd873e25197055265d1c",
url = "https://github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
remote = "https://github.com/bazelbuild/bazel-skylib",
tag = "0.9.0",
)
if "io_opencensus_cpp" not in native.existing_rules():

@ -64,5 +64,6 @@ def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kw
"@com_github_grpc_grpc//src/objective-c:proto_objc_rpc",
"@com_google_protobuf//:protobuf_objc",
],
**kwargs
)

@ -238,3 +238,8 @@ cc_binary(
"//:grpc++",
],
)
proto_library(
name = "route_guide_proto",
srcs = ["protos/route_guide.proto"],
)

@ -0,0 +1,119 @@
# 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"]) # 3-clause BSD
package(default_visibility = ["//visibility:public"])
load("@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", "objc_grpc_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
objc_grpc_library(
name = "HelloWorld_grpc_proto",
srcs = ["//examples:protos/helloworld.proto"],
deps = ["//examples:helloworld_proto"],
tags = ["manual"],
)
# This one works with import "external/com_github_grpc_grpc/examples/protos/Helloworld.pbrpc.h"
objc_grpc_library(
name = "HelloWorld_grpc_proto_external",
srcs = ["//external/com_github_grpc_grpc/examples:protos/helloworld.proto"],
deps = ["@com_github_grpc_grpc//examples:helloworld_proto"],
tags = ["manual"],
)
objc_library(
name = "HelloWorld-lib",
srcs = glob(["helloworld/**/*.m",]),
hdrs = glob(["helloworld/**/*.h"]),
data = glob([
"helloworld/HelloWorld/Base.lproj/**",
"helloworld/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
)
ios_application(
name = "HelloWorld",
bundle_id = "Google.HelloWorld",
families = [
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["helloworld/HelloWorld/Info.plist"],
deps = [":HelloWorld-lib"],
tags = ["manual"],
)
objc_library(
name = "HelloWorldMacos-lib",
srcs = glob(["helloworld_macos/**/*.m",]),
hdrs = glob(["helloworld_macos/**/*.h"]),
data = glob([
"helloworld_macos/HelloWorld/Base.lproj/**",
"helloworld_macos/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld_macos/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
)
macos_application(
name = "HelloWorldMacos",
bundle_id = "io.grpc.HelloWorld",
minimum_os_version = "10.13",
entitlements = "helloworld_macos/HelloWorld/Helloworld.entitlements",
infoplists = ["helloworld_macos/HelloWorld/Info.plist"],
deps = [":HelloWorldMacos-lib"],
tags = ["manual"],
)
objc_grpc_library(
name = "RouteGuide",
srcs = ["//examples:protos/route_guide.proto"],
deps = ["//examples:route_guide_proto"],
tags = ["manual"],
)
objc_library(
name = "RouteGuideClient-lib",
srcs = glob(["route_guide/**/*.m"]),
hdrs = glob(["route_guide/**/*.h"]),
data = glob([
"route_guide/Misc/Base.lproj/**",
"route_guide/Misc/Images.xcassets/**",
"route_guide/route_guide_db.json",
]),
includes = ["route_guide/Misc"],
deps = [":RouteGuide"],
tags = ["manual"],
)
ios_application(
name = "RouteGuideClient",
bundle_id = "gRPC.RouteGuideClient",
families = [
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["route_guide/Misc/Info.plist"],
deps = [":RouteGuideClient-lib"],
tags = ["manual"],
)

@ -21,7 +21,11 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
#import "examples/protos/Helloworld.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>

@ -20,7 +20,11 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
#import "examples/protos/Helloworld.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -17,7 +17,11 @@
*/
#import <UIKit/UIKit.h>
#if COCOAPODS
#import <RouteGuide/RouteGuide.pbrpc.h>
#else
#import "examples/protos/RouteGuide.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -0,0 +1,28 @@
# 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"])
package(default_visibility = ["//visibility:public"])
load("@bazel_skylib//rules:build_test.bzl", "build_test")
# build test //test/build_test:objective_c_examples_test
build_test(
name = "objective_c_examples_test",
targets = [
"//examples/objective-c:HelloWorld",
],
tags = ["manual"],
)
Loading…
Cancel
Save