Test enabling objc_grpc_library

This commit is contained in:
Adam Liddell 2021-02-23 21:00:26 +00:00
parent 8e2100f6a9
commit f4c0d8ad9b
6 changed files with 87 additions and 13 deletions

View File

@ -884,6 +884,14 @@ tasks:
build_targets:
- "//..."
working_directory: example/objc/objc_proto_library
objc_objc_grpc_library_macos:
name: 'objc: objc_grpc_library'
platform: macos
build_flags:
- "--copt=-DGRPC_BAZEL_BUILD"
build_targets:
- "//..."
working_directory: example/objc/objc_grpc_library
php_php_proto_compile_ubuntu1804:
name: 'php: php_proto_compile'
platform: ubuntu1804

View File

@ -157,6 +157,7 @@ repository.
| [Objective-C](/objc) | [objc_proto_compile](/objc#objc_proto_compile) | Generates Objective-C protobuf `.m` & `.h` artifacts ([example](/example/objc/objc_proto_compile)) |
| [Objective-C](/objc) | [objc_grpc_compile](/objc#objc_grpc_compile) | Generates Objective-C protobuf+gRPC `.m` & `.h` artifacts ([example](/example/objc/objc_grpc_compile)) |
| [Objective-C](/objc) | [objc_proto_library](/objc#objc_proto_library) | Generates an Objective-C protobuf library using `objc_library` ([example](/example/objc/objc_proto_library)) |
| [Objective-C](/objc) | [objc_grpc_library](/objc#objc_grpc_library) | Generates an Objective-C protobuf+gRPC library using `objc_library` ([example](/example/objc/objc_grpc_library)) |
| [PHP](/php) | [php_proto_compile](/php#php_proto_compile) | Generates PHP protobuf `.php` artifacts ([example](/example/php/php_proto_compile)) |
| [PHP](/php) | [php_grpc_compile](/php#php_grpc_compile) | Generates PHP protobuf+gRPC `.php` artifacts ([example](/example/php/php_grpc_compile)) |
| [Python](/python) | [python_proto_compile](/python#python_proto_compile) | Generates Python protobuf `.py` artifacts ([example](/example/python/python_proto_compile)) |

View File

@ -205,8 +205,13 @@ objc_objc_proto_library_example:
cd example/objc/objc_proto_library; \
bazel --batch build --verbose_failures --disk_cache=../../bazel-disk-cache //...
.PHONY: objc_objc_grpc_library_example
objc_objc_grpc_library_example:
cd example/objc/objc_grpc_library; \
bazel --batch build --verbose_failures --disk_cache=../../bazel-disk-cache //...
.PHONY: objc_examples
objc_examples: objc_objc_proto_compile_example objc_objc_grpc_compile_example objc_objc_proto_library_example
objc_examples: objc_objc_proto_compile_example objc_objc_grpc_compile_example objc_objc_proto_library_example objc_objc_grpc_library_example
.PHONY: php_php_proto_compile_example
php_php_proto_compile_example:
@ -347,4 +352,4 @@ swift_swift_grpc_library_example:
swift_examples: swift_swift_proto_compile_example swift_swift_grpc_compile_example swift_swift_proto_library_example swift_swift_grpc_library_example
.PHONY: all_examples
all_examples: android_android_proto_compile_example android_android_grpc_compile_example android_android_proto_library_example android_android_grpc_library_example c_c_proto_compile_example c_c_proto_library_example cpp_cpp_proto_compile_example cpp_cpp_grpc_compile_example cpp_cpp_proto_library_example cpp_cpp_grpc_library_example csharp_csharp_proto_compile_example csharp_csharp_grpc_compile_example csharp_csharp_proto_library_example csharp_csharp_grpc_library_example d_d_proto_compile_example d_d_proto_library_example go_go_proto_compile_example go_go_grpc_compile_example go_go_proto_library_example go_go_grpc_library_example grpc-gateway_gateway_grpc_compile_example grpc-gateway_gateway_openapiv2_compile_example grpc-gateway_gateway_grpc_library_example java_java_proto_compile_example java_java_grpc_compile_example java_java_proto_library_example java_java_grpc_library_example js_js_proto_compile_example js_js_grpc_node_compile_example js_js_grpc_web_compile_example js_js_proto_library_example js_js_grpc_node_library_example js_js_grpc_web_library_example objc_objc_proto_compile_example objc_objc_grpc_compile_example objc_objc_proto_library_example php_php_proto_compile_example php_php_grpc_compile_example python_python_proto_compile_example python_python_grpc_compile_example python_python_grpclib_compile_example python_python_proto_library_example python_python_grpc_library_example python_python_grpclib_library_example ruby_ruby_proto_compile_example ruby_ruby_grpc_compile_example ruby_ruby_proto_library_example ruby_ruby_grpc_library_example rust_rust_proto_compile_example rust_rust_grpc_compile_example rust_rust_proto_library_example rust_rust_grpc_library_example scala_scala_proto_compile_example scala_scala_grpc_compile_example scala_scala_proto_library_example scala_scala_grpc_library_example swift_swift_proto_compile_example swift_swift_grpc_compile_example swift_swift_proto_library_example swift_swift_grpc_library_example
all_examples: android_android_proto_compile_example android_android_grpc_compile_example android_android_proto_library_example android_android_grpc_library_example c_c_proto_compile_example c_c_proto_library_example cpp_cpp_proto_compile_example cpp_cpp_grpc_compile_example cpp_cpp_proto_library_example cpp_cpp_grpc_library_example csharp_csharp_proto_compile_example csharp_csharp_grpc_compile_example csharp_csharp_proto_library_example csharp_csharp_grpc_library_example d_d_proto_compile_example d_d_proto_library_example go_go_proto_compile_example go_go_grpc_compile_example go_go_proto_library_example go_go_grpc_library_example grpc-gateway_gateway_grpc_compile_example grpc-gateway_gateway_openapiv2_compile_example grpc-gateway_gateway_grpc_library_example java_java_proto_compile_example java_java_grpc_compile_example java_java_proto_library_example java_java_grpc_library_example js_js_proto_compile_example js_js_grpc_node_compile_example js_js_grpc_web_compile_example js_js_proto_library_example js_js_grpc_node_library_example js_js_grpc_web_library_example objc_objc_proto_compile_example objc_objc_grpc_compile_example objc_objc_proto_library_example objc_objc_grpc_library_example php_php_proto_compile_example php_php_grpc_compile_example python_python_proto_compile_example python_python_grpc_compile_example python_python_grpclib_compile_example python_python_proto_library_example python_python_grpc_library_example python_python_grpclib_library_example ruby_ruby_proto_compile_example ruby_ruby_grpc_compile_example ruby_ruby_proto_library_example ruby_ruby_grpc_library_example rust_rust_proto_compile_example rust_rust_grpc_compile_example rust_rust_proto_library_example rust_rust_grpc_library_example scala_scala_proto_compile_example scala_scala_grpc_compile_example scala_scala_proto_library_example scala_scala_grpc_library_example swift_swift_proto_compile_example swift_swift_grpc_compile_example swift_swift_proto_library_example swift_swift_grpc_library_example

View File

@ -7,6 +7,7 @@ Rules for generating Objective-C protobuf and gRPC `.m` & `.h` files and librari
| [objc_proto_compile](#objc_proto_compile) | Generates Objective-C protobuf `.m` & `.h` artifacts |
| [objc_grpc_compile](#objc_grpc_compile) | Generates Objective-C protobuf+gRPC `.m` & `.h` artifacts |
| [objc_proto_library](#objc_proto_library) | Generates an Objective-C protobuf library using `objc_library` |
| [objc_grpc_library](#objc_grpc_library) | Generates an Objective-C protobuf+gRPC library using `objc_library` |
---
@ -162,3 +163,60 @@ objc_proto_library(
| `local_defines` | `list<string>` | false | `None` | Passed to the `local_defines` attribute of `cc_library`. |
| `nocopts` | `string` | false | `None` | Passed to the `nocopts` attribute of `cc_library`. |
| `strip_include_prefix` | `string` | false | `None` | Passed to the `strip_include_prefix` attribute of `cc_library`. |
---
## `objc_grpc_library`
> NOTE: this rule is EXPERIMENTAL. It may not work correctly or even compile!
Generates an Objective-C protobuf+gRPC library using `objc_library`
### `WORKSPACE`
```starlark
load("@rules_proto_grpc//objc:repositories.bzl", rules_proto_grpc_objc_repos = "objc_repos")
rules_proto_grpc_objc_repos()
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
```
### `BUILD.bazel`
```starlark
load("@rules_proto_grpc//objc:defs.bzl", "objc_grpc_library")
objc_grpc_library(
name = "thing_objc_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
objc_grpc_library(
name = "greeter_objc_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_objc_grpc"],
)
```
### Attributes
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `options` | `dict<string, list(string)>` | false | `[]` | Extra options to pass to plugins, as a dict of plugin label -> list of strings. The key * can be used exclusively to apply to all plugins |
| `verbose` | `int` | false | `0` | The verbosity level. Supported values and results are 1: *show command*, 2: *show command and sandbox after running protoc*, 3: *show command and sandbox before and after running protoc*, 4. *show env, command, expected outputs and sandbox before and after running protoc* |
| `prefix_path` | `string` | false | `""` | Path to prefix to the generated files in the output directory |
| `extra_protoc_args` | `list<string>` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `list<Label/string>` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `alwayslink` | `bool` | false | `None` | Passed to the `alwayslink` attribute of `cc_library`. |
| `copts` | `list<string>` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `list<string>` | false | `None` | Passed to the `defines` attribute of `cc_library`. |
| `include_prefix` | `string` | false | `None` | Passed to the `include_prefix` attribute of `cc_library`. |
| `linkopts` | `list<string>` | false | `None` | Passed to the `linkopts` attribute of `cc_library`. |
| `linkstatic` | `bool` | false | `None` | Passed to the `linkstatic` attribute of `cc_library`. |
| `local_defines` | `list<string>` | false | `None` | Passed to the `local_defines` attribute of `cc_library`. |
| `nocopts` | `string` | false | `None` | Passed to the `nocopts` attribute of `cc_library`. |
| `strip_include_prefix` | `string` | false | `None` | Passed to the `strip_include_prefix` attribute of `cc_library`. |

View File

@ -3,8 +3,10 @@
load(":objc_proto_compile.bzl", _objc_proto_compile = "objc_proto_compile")
load(":objc_grpc_compile.bzl", _objc_grpc_compile = "objc_grpc_compile")
load(":objc_proto_library.bzl", _objc_proto_library = "objc_proto_library")
load(":objc_grpc_library.bzl", _objc_grpc_library = "objc_grpc_library")
# Export objc rules
objc_proto_compile = _objc_proto_compile
objc_grpc_compile = _objc_grpc_compile
objc_proto_library = _objc_proto_library
objc_grpc_library = _objc_grpc_library

View File

@ -74,8 +74,7 @@ var objcGrpcLibraryRuleTemplate = mustTemplate(objcLibraryRuleTemplateString + `
GRPC_DEPS = [
"@com_google_protobuf//:protobuf_objc",
"@com_github_grpc_grpc//:grpc++",
"@rules_proto_grpc//objc:grpc_lib",
"@com_github_grpc_grpc//src/objective-c:proto_objc_rpc",
]`)
func makeObjc() *Language {
@ -116,15 +115,16 @@ func makeObjc() *Language {
Doc: "Generates an Objective-C protobuf library using `objc_library`",
Attrs: cppLibraryRuleAttrs,
},
// &Rule{ // Disabled due to issues fetching gRPC dependencies
// Name: "objc_grpc_library",
// Kind: "grpc",
// Implementation: objcGrpcLibraryRuleTemplate,
// WorkspaceExample: grpcWorkspaceTemplate,
// BuildExample: grpcLibraryExampleTemplate,
// Doc: "Generates an Objective-C protobuf+gRPC library using `objc_library`",
// Attrs: cppLibraryRuleAttrs,
// },
&Rule{
Name: "objc_grpc_library",
Kind: "grpc",
Implementation: objcGrpcLibraryRuleTemplate,
WorkspaceExample: grpcWorkspaceTemplate,
BuildExample: grpcLibraryExampleTemplate,
Doc: "Generates an Objective-C protobuf+gRPC library using `objc_library`",
Attrs: cppLibraryRuleAttrs,
Experimental: true,
},
},
}
}