Add non-transitive compilation mode

This commit is contained in:
Adam Liddell 2021-02-13 20:12:00 +00:00
parent 894e83dedc
commit d69fbe1e08
182 changed files with 1981 additions and 684 deletions

View File

@ -30,7 +30,17 @@ load("@rules_proto_grpc//android:defs.bzl", "android_proto_compile")
android_proto_compile(
name = "person_android_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
android_proto_compile(
name = "place_android_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
android_proto_compile(
name = "thing_android_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -38,7 +48,7 @@ android_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -81,9 +91,14 @@ grpc_java_repositories()
```starlark
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_compile")
android_grpc_compile(
name = "thing_android_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
android_grpc_compile(
name = "greeter_android_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
```
@ -91,7 +106,7 @@ android_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -141,8 +156,20 @@ android_sdk_repository(name = "androidsdk")
load("@rules_proto_grpc//android:defs.bzl", "android_proto_library")
android_proto_library(
name = "person_android_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_android_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_android_proto"],
)
android_proto_library(
name = "place_android_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_android_proto"],
)
android_proto_library(
name = "thing_android_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -150,8 +177,10 @@ android_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
---
@ -198,8 +227,14 @@ android_sdk_repository(name = "androidsdk")
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_library")
android_grpc_library(
name = "greeter_android_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_android_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
android_grpc_library(
name = "greeter_android_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_android_grpc"],
)
```
@ -207,5 +242,7 @@ android_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |

View File

@ -36,10 +36,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [android_grpc_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [android_grpc_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,15 +6,15 @@ def android_grpc_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
android_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create android library
android_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = GRPC_DEPS,
exports = GRPC_DEPS,
deps = GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
exports = GRPC_DEPS + kwargs.get("exports", []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [android_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [android_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,15 +6,15 @@ def android_proto_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
android_proto_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create android library
android_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = PROTO_DEPS,
exports = PROTO_DEPS,
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
exports = PROTO_DEPS + kwargs.get("exports", []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)

View File

@ -2,7 +2,7 @@ load("//android:defs.bzl", "android_grpc_library")
android_grpc_library(
name = "routeguide",
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
# android_library(

View File

@ -8,16 +8,21 @@ load(
"get_int_attr",
"get_output_filename",
"strip_path_prefix",
"get_package_root",
)
ProtoLibraryAspectNodeInfo = provider(
fields = {
"output_files": "The files generated by this aspect and its transitive dependencies, as a dict indexed by the root directory",
"output_root": "The root directory that direct (non-transitive) outputs were written to, as a string",
"direct_output_files": "The files generated by this aspect only, as a depset",
"direct_output_dirs": "The directories generated by this aspect only, as a depset",
"output_files": "The files generated by this aspect and its transitive dependencies, as a dict of depsets indexed by the root directory",
"output_dirs": "The directories generated by this aspect and its transitive dependencies, as a depset",
},
)
proto_compile_attrs = {
# Deps and protos attrs are added per-rule, as it depends on aspect name
"verbose": attr.int(
doc = "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*",
),
@ -43,11 +48,32 @@ proto_compile_aspect_attrs = {
}
def proto_compile_impl(ctx):
# Aggregate output files and dirs created by the aspect as it has walked the deps
output_files_dicts = [dep[ProtoLibraryAspectNodeInfo].output_files for dep in ctx.attr.deps]
output_dirs = depset(transitive=[
dep[ProtoLibraryAspectNodeInfo].output_dirs for dep in ctx.attr.deps
])
if ctx.attr.protos and ctx.attr.deps:
fail("Inputs provided to both 'protos' and 'deps' attrs of target {}. Use exclusively 'protos' or 'deps'".format(ctx.label))
elif ctx.attr.protos:
# Aggregate output files and dirs created by the aspect from the direct dependencies
output_files_dicts = []
for dep in ctx.attr.protos:
aspect_node_info = dep[ProtoLibraryAspectNodeInfo]
output_files_dicts.append({aspect_node_info.output_root: aspect_node_info.direct_output_files})
output_dirs = depset(transitive=[
dep[ProtoLibraryAspectNodeInfo].direct_output_dirs for dep in ctx.attr.protos
])
elif ctx.attr.deps:
# TODO: add link to below
print("Inputs provided to 'deps' attr of target {}. Consider replacing with 'protos' attr to avoid transitive compilation".format(ctx.label))
# Aggregate all output files and dirs created by the aspect as it has walked the deps. Legacy behaviour
output_files_dicts = [dep[ProtoLibraryAspectNodeInfo].output_files for dep in ctx.attr.deps]
output_dirs = depset(transitive=[
dep[ProtoLibraryAspectNodeInfo].output_dirs for dep in ctx.attr.deps
])
else:
fail("No inputs provided to 'protos' attr of target {}".format(ctx.label))
# Check merge_directories and prefix_path
if not ctx.attr.merge_directories and ctx.attr.prefix_path:
@ -63,7 +89,7 @@ def proto_compile_impl(ctx):
# Pass on outputs directly when not merging
for output_files_dict in output_files_dicts:
final_output_files.update(**output_files_dict)
final_output_files_list = [f for files in final_output_files.values() for f in files]
final_output_files_list = [f for files in final_output_files.values() for f in files.to_list()]
final_output_dirs = output_dirs
elif output_dirs:
@ -90,7 +116,7 @@ def proto_compile_impl(ctx):
command_input_files = []
for output_files_dict in output_files_dicts:
for root, files in output_files_dict.items():
for file in files:
for file in files.to_list():
# Strip root from file path
path = strip_path_prefix(file.path, root)
@ -125,17 +151,11 @@ def proto_compile_impl(ctx):
# Otherwise, if we only have output files, build the output tree by
# aggregating files created by aspect into one directory
output_root = ctx.bin_dir.path + "/"
if ctx.label.workspace_root:
output_root += ctx.label.workspace_root + "/"
if ctx.label.package:
output_root += ctx.label.package + "/"
output_root += ctx.label.name
final_output_files[output_root] = []
output_root = get_package_root(ctx) + "/" + ctx.label.name
for output_files_dict in output_files_dicts:
for root, files in output_files_dict.items():
for file in files:
for file in files.to_list():
# Strip root from file path
path = strip_path_prefix(file.path, root)
@ -144,13 +164,13 @@ def proto_compile_impl(ctx):
path = prefix_path + "/" + path
# Copy file to output
final_output_files[output_root].append(copy_file(
final_output_files_list.append(copy_file(
ctx,
file,
"{}/{}".format(ctx.label.name, path),
))
final_output_files_list = final_output_files[output_root]
final_output_files[output_root] = depset(direct=final_output_files_list)
# Create depset containing all outputs
if ctx.attr.merge_directories:
@ -191,22 +211,17 @@ def proto_compile_aspect_impl(target, ctx):
fixer = protoc_toolchain_info.fixer_executable
# Load ProtoInfo of the current node
if ProtoInfo not in target: # Skip non-proto targets, which we may get intermingled prior to deps deprecation
return []
proto_info = target[ProtoInfo]
# The directory where the outputs will be generated, relative to the package. This contains the aspect _prefix attr
# to disambiguate different aspects that may share the same plugins and would otherwise try to touch the same file.
# The same is true for the verbose_string attr.
rel_outdir = "{}/{}_verb{}".format(ctx.label.name, ctx.attr._prefix, verbose)
rel_output_root = "{}/{}_verb{}".format(ctx.label.name, ctx.attr._prefix, verbose)
# The full path to the package output directory, relative to workspace root
package_root = ctx.bin_dir.path
if ctx.label.workspace_root:
package_root += "/" + ctx.label.workspace_root
if ctx.label.package:
package_root += "/" + ctx.label.package
# The path to the
full_outdir = package_root + "/" + rel_outdir
# The full path to the output root, relative to the workspace
output_root = get_package_root(ctx) + "/" + rel_output_root
# The lists of generated files and directories that we expect to be produced.
output_files = []
@ -286,7 +301,7 @@ def proto_compile_aspect_impl(target, ctx):
for proto in protos:
for pattern in plugin.outputs:
plugin_outputs.append(ctx.actions.declare_file("{}/{}".format(
rel_outdir, get_output_filename(proto, pattern, proto_info),
rel_output_root, get_output_filename(proto, pattern, proto_info),
)))
# Append current plugin outputs to global outputs before looking at per-plugin outputs; these are manually added
@ -306,7 +321,7 @@ def proto_compile_aspect_impl(target, ctx):
if plugin.out:
# Define out file
out_file = ctx.actions.declare_file("{}/{}".format(
rel_outdir, plugin.out.replace("{name}", ctx.label.name),
rel_output_root, plugin.out.replace("{name}", ctx.label.name),
))
plugin_outputs.append(out_file)
@ -327,7 +342,7 @@ def proto_compile_aspect_impl(target, ctx):
# we simply declare the directory.
if plugin.output_directory:
out_file = ctx.actions.declare_directory(rel_outdir + "/" + "_plugin_" + plugin.name)
out_file = ctx.actions.declare_directory(rel_output_root + "/" + "_plugin_" + plugin.name)
plugin_outputs.append(out_file)
output_dirs.append(out_file)
@ -340,13 +355,13 @@ def proto_compile_aspect_impl(target, ctx):
# direct the plugin outputs to a temporary folder, then use the fixer executable to write to the final targets.
if plugin.empty_template:
# Create path list for fixer
fixer_paths_file = ctx.actions.declare_file(rel_outdir + "/" + "_plugin_ef_" + plugin.name + ".txt")
fixer_paths_file = ctx.actions.declare_file(rel_output_root + "/" + "_plugin_ef_" + plugin.name + ".txt")
ctx.actions.write(fixer_paths_file, '\n'.join([
file.path.partition(full_outdir + "/")[2] for file in plugin_outputs
file.path.partition(output_root + "/")[2] for file in plugin_outputs
]))
# Create output directory for protoc to write into
fixer_dir = ctx.actions.declare_directory(rel_outdir + "/" + "_plugin_ef_" + plugin.name)
fixer_dir = ctx.actions.declare_directory(rel_output_root + "/" + "_plugin_ef_" + plugin.name)
out_arg = fixer_dir.path
plugin_protoc_outputs = [fixer_dir]
@ -355,7 +370,7 @@ def proto_compile_aspect_impl(target, ctx):
inputs = [fixer_paths_file, fixer_dir, plugin.empty_template],
outputs = plugin_outputs,
arguments = [
fixer_paths_file.path, plugin.empty_template.path, fixer_dir.path, full_outdir
fixer_paths_file.path, plugin.empty_template.path, fixer_dir.path, output_root
],
progress_message = "Applying fixer for {} plugin on target {}".format(plugin.name, target.label),
executable = fixer,
@ -363,7 +378,7 @@ def proto_compile_aspect_impl(target, ctx):
else:
# No fixer, protoc writes files directly
out_arg = out_file.path if out_file else full_outdir
out_arg = out_file.path if out_file else output_root
plugin_protoc_outputs = plugin_outputs
# Argument list for protoc execution
@ -408,7 +423,7 @@ def proto_compile_aspect_impl(target, ctx):
###
mnemonic = "ProtoCompile"
command = ("mkdir -p '{}' && ".format(full_outdir)) + protoc.path + " $@" # $@ is replaced with args list
command = ("mkdir -p '{}' && ".format(output_root)) + protoc.path + " $@" # $@ is replaced with args list
inputs = proto_info.transitive_descriptor_sets.to_list() + plugin_runfiles # Proto files are not inputs, as they come via the descriptor sets
tools = [protoc] + ([plugin_tool] if plugin_tool else [])
@ -454,7 +469,7 @@ def proto_compile_aspect_impl(target, ctx):
transitive_infos = [dep[ProtoLibraryAspectNodeInfo] for dep in ctx.rule.attr.deps]
output_files_dict = {}
if output_files:
output_files_dict[full_outdir] = output_files
output_files_dict[output_root] = depset(direct=output_files)
transitive_output_dirs = []
for transitive_info in transitive_infos:
@ -463,6 +478,9 @@ def proto_compile_aspect_impl(target, ctx):
return [
ProtoLibraryAspectNodeInfo(
output_root = output_root,
direct_output_files = depset(direct=output_files),
direct_output_dirs = depset(direct=output_dirs),
output_files = output_files_dict,
output_dirs = depset(direct=output_dirs, transitive=transitive_output_dirs),
),

View File

@ -28,7 +28,17 @@ load("@rules_proto_grpc//closure:defs.bzl", "closure_proto_compile")
closure_proto_compile(
name = "person_closure_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
closure_proto_compile(
name = "place_closure_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
closure_proto_compile(
name = "thing_closure_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -36,7 +46,7 @@ closure_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -68,8 +78,20 @@ rules_closure_toolchains()
load("@rules_proto_grpc//closure:defs.bzl", "closure_proto_library")
closure_proto_library(
name = "person_closure_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_closure_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_closure_proto"],
)
closure_proto_library(
name = "place_closure_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_closure_proto"],
)
closure_proto_library(
name = "thing_closure_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -77,5 +99,6 @@ closure_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [closure_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [closure_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,14 +6,14 @@ def closure_proto_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
closure_proto_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create closure library
closure_js_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = PROTO_DEPS,
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
suppress = [

View File

@ -10,7 +10,7 @@ load("//closure:defs.bzl", "closure_proto_library")
closure_proto_library(
name = "routeguide",
visibility = ["//closure/example/routeguide:__subpackages__"],
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
closure_js_library(

View File

@ -30,7 +30,17 @@ load("@rules_proto_grpc//cpp:defs.bzl", "cpp_proto_compile")
cpp_proto_compile(
name = "person_cpp_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
cpp_proto_compile(
name = "place_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
cpp_proto_compile(
name = "thing_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -38,7 +48,7 @@ cpp_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -64,9 +74,14 @@ grpc_deps()
```starlark
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_compile")
cpp_grpc_compile(
name = "thing_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
cpp_grpc_compile(
name = "greeter_cpp_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
```
@ -74,7 +89,7 @@ cpp_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -97,8 +112,20 @@ rules_proto_grpc_cpp_repos()
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_proto_library")
cpp_proto_library(
name = "person_cpp_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_cpp_proto"],
)
cpp_proto_library(
name = "place_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_cpp_proto"],
)
cpp_proto_library(
name = "thing_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -106,8 +133,9 @@ cpp_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -133,8 +161,14 @@ grpc_deps()
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_library")
cpp_grpc_library(
name = "greeter_cpp_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
cpp_grpc_library(
name = "greeter_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_cpp_grpc"],
)
```
@ -142,5 +176,6 @@ cpp_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -36,10 +36,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [cpp_grpc_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [cpp_grpc_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -5,21 +5,21 @@ def cpp_grpc_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
cpp_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create cpp library
native.cc_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = GRPC_DEPS,
deps = GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
includes = [name_pb],
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)
GRPC_DEPS = [
"@com_google_protobuf//:protoc_lib",
"@com_google_protobuf//:protobuf",
"@com_github_grpc_grpc//:grpc++",
"@com_github_grpc_grpc//:grpc++_reflection",
]

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [cpp_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [cpp_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -5,19 +5,19 @@ def cpp_proto_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
cpp_proto_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create cpp library
native.cc_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = PROTO_DEPS,
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
includes = [name_pb],
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)
PROTO_DEPS = [
"@com_google_protobuf//:protoc_lib",
"@com_google_protobuf//:protobuf",
]

View File

@ -2,7 +2,7 @@ load("//cpp:defs.bzl", "cpp_grpc_library")
cpp_grpc_library(
name = "routeguide",
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
package(default_visibility = ["//visibility:public"])

View File

@ -50,7 +50,17 @@ load("@rules_proto_grpc//csharp:defs.bzl", "csharp_proto_compile")
csharp_proto_compile(
name = "person_csharp_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
csharp_proto_compile(
name = "place_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
csharp_proto_compile(
name = "thing_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -58,7 +68,7 @@ csharp_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -104,9 +114,14 @@ nuget_rules_proto_grpc_packages()
```starlark
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_grpc_compile")
csharp_grpc_compile(
name = "thing_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
csharp_grpc_compile(
name = "greeter_csharp_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
```
@ -114,7 +129,7 @@ csharp_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -157,8 +172,20 @@ nuget_rules_proto_grpc_packages()
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_proto_library")
csharp_proto_library(
name = "person_csharp_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_csharp_proto"],
)
csharp_proto_library(
name = "place_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_csharp_proto"],
)
csharp_proto_library(
name = "thing_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -166,8 +193,9 @@ csharp_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -213,8 +241,14 @@ nuget_rules_proto_grpc_packages()
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_grpc_library")
csharp_grpc_library(
name = "greeter_csharp_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
csharp_grpc_library(
name = "greeter_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_csharp_grpc"],
)
```
@ -222,5 +256,6 @@ csharp_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -36,10 +36,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [csharp_grpc_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [csharp_grpc_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,14 +6,14 @@ def csharp_grpc_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
csharp_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create csharp library
core_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = GRPC_DEPS,
deps = GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [csharp_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [csharp_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,14 +6,14 @@ def csharp_proto_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
csharp_proto_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create csharp library
core_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = PROTO_DEPS,
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)

View File

@ -3,7 +3,7 @@ load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_binary", "core_library")
csharp_grpc_library(
name = "routeguide.dll",
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
core_library(

View File

@ -34,7 +34,17 @@ load("@rules_proto_grpc//d:defs.bzl", "d_proto_compile")
d_proto_compile(
name = "person_d_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
d_proto_compile(
name = "place_d_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
d_proto_compile(
name = "thing_d_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -42,7 +52,7 @@ d_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -69,8 +79,20 @@ d_repositories()
load("@rules_proto_grpc//d:defs.bzl", "d_proto_library")
d_proto_library(
name = "person_d_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_d_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_d_proto"],
)
d_proto_library(
name = "place_d_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_d_proto"],
)
d_proto_library(
name = "thing_d_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -78,5 +100,5 @@ d_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [d_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [d_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -6,14 +6,14 @@ def d_proto_library(**kwargs):
name_pb = kwargs.get("name") + "_pb"
d_proto_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create d library
d_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = PROTO_DEPS,
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)

View File

@ -3,5 +3,5 @@ load("@io_bazel_rules_d//d:d.bzl", "d_library")
d_proto_compile(
name = "routeguide",
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_compile")
android_grpc_compile(
name = "greeter_android_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_android_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
android_grpc_compile(
name = "greeter_android_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_library")
android_grpc_library(
name = "greeter_android_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_android_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
android_grpc_library(
name = "greeter_android_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_android_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//android:defs.bzl", "android_proto_compile")
android_proto_compile(
name = "person_android_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
android_proto_compile(
name = "place_android_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
android_proto_compile(
name = "thing_android_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//android:defs.bzl", "android_proto_library")
android_proto_library(
name = "person_android_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_android_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_android_proto"],
)
android_proto_library(
name = "place_android_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_android_proto"],
)
android_proto_library(
name = "thing_android_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//closure:defs.bzl", "closure_proto_compile")
closure_proto_compile(
name = "person_closure_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
closure_proto_compile(
name = "place_closure_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
closure_proto_compile(
name = "thing_closure_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//closure:defs.bzl", "closure_proto_library")
closure_proto_library(
name = "person_closure_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_closure_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_closure_proto"],
)
closure_proto_library(
name = "place_closure_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_closure_proto"],
)
closure_proto_library(
name = "thing_closure_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_compile")
cpp_grpc_compile(
name = "greeter_cpp_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
cpp_grpc_compile(
name = "greeter_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_library")
cpp_grpc_library(
name = "greeter_cpp_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
cpp_grpc_library(
name = "greeter_cpp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_cpp_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//cpp:defs.bzl", "cpp_proto_compile")
cpp_proto_compile(
name = "person_cpp_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
cpp_proto_compile(
name = "place_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
cpp_proto_compile(
name = "thing_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//cpp:defs.bzl", "cpp_proto_library")
cpp_proto_library(
name = "person_cpp_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_cpp_proto"],
)
cpp_proto_library(
name = "place_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_cpp_proto"],
)
cpp_proto_library(
name = "thing_cpp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_grpc_compile")
csharp_grpc_compile(
name = "greeter_csharp_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
csharp_grpc_compile(
name = "greeter_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_grpc_library")
csharp_grpc_library(
name = "greeter_csharp_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
csharp_grpc_library(
name = "greeter_csharp_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_csharp_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//csharp:defs.bzl", "csharp_proto_compile")
csharp_proto_compile(
name = "person_csharp_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
csharp_proto_compile(
name = "place_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
csharp_proto_compile(
name = "thing_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//csharp:defs.bzl", "csharp_proto_library")
csharp_proto_library(
name = "person_csharp_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_csharp_proto"],
)
csharp_proto_library(
name = "place_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_csharp_proto"],
)
csharp_proto_library(
name = "thing_csharp_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//d:defs.bzl", "d_proto_compile")
d_proto_compile(
name = "person_d_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
d_proto_compile(
name = "place_d_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
d_proto_compile(
name = "thing_d_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//d:defs.bzl", "d_proto_library")
d_proto_library(
name = "person_d_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_d_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_d_proto"],
)
d_proto_library(
name = "place_d_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_d_proto"],
)
d_proto_library(
name = "thing_d_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//go:defs.bzl", "go_grpc_compile")
go_grpc_compile(
name = "greeter_go_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_go_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
go_grpc_compile(
name = "greeter_go_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,7 +1,10 @@
load("@rules_proto_grpc//go:defs.bzl", "go_grpc_library")
go_grpc_library(
name = "greeter_go_library",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/go/example/go_grpc_library/greeter",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "greeter_go_grpc",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/example/proto",
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
"@rules_proto_grpc//example/proto:greeter_grpc",
],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//go:defs.bzl", "go_proto_compile")
go_proto_compile(
name = "person_go_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
go_proto_compile(
name = "place_go_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
go_proto_compile(
name = "thing_go_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,7 +1,11 @@
load("@rules_proto_grpc//go:defs.bzl", "go_proto_library")
go_proto_library(
name = "person_go_library",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/go/example/go_proto_library/person",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "proto_go_proto",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/example/proto",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//grpc-web:defs.bzl", "closure_grpc_compile")
closure_grpc_compile(
name = "greeter_grpc-web_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
closure_grpc_compile(
name = "greeter_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//grpc-web:defs.bzl", "closure_grpc_library")
closure_grpc_library(
name = "greeter_grpc-web_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
closure_grpc_library(
name = "greeter_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_grpc-web_grpc"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//grpc-web:defs.bzl", "commonjs_dts_grpc_compile")
commonjs_dts_grpc_compile(
name = "greeter_grpc-web_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
commonjs_dts_grpc_compile(
name = "greeter_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//grpc-web:defs.bzl", "commonjs_grpc_compile")
commonjs_grpc_compile(
name = "greeter_grpc-web_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
commonjs_grpc_compile(
name = "greeter_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//grpc-web:defs.bzl", "ts_grpc_compile")
ts_grpc_compile(
name = "greeter_grpc-web_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
ts_grpc_compile(
name = "greeter_grpc-web_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//java:defs.bzl", "java_grpc_compile")
java_grpc_compile(
name = "greeter_java_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_java_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
java_grpc_compile(
name = "greeter_java_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//java:defs.bzl", "java_grpc_library")
java_grpc_library(
name = "greeter_java_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_java_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
java_grpc_library(
name = "greeter_java_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_java_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//java:defs.bzl", "java_proto_compile")
java_proto_compile(
name = "person_java_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
java_proto_compile(
name = "place_java_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
java_proto_compile(
name = "thing_java_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//java:defs.bzl", "java_proto_library")
java_proto_library(
name = "person_java_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_java_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_java_proto"],
)
java_proto_library(
name = "place_java_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_java_proto"],
)
java_proto_library(
name = "thing_java_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//nodejs:defs.bzl", "nodejs_grpc_compile")
nodejs_grpc_compile(
name = "greeter_nodejs_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_nodejs_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
nodejs_grpc_compile(
name = "greeter_nodejs_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//nodejs:defs.bzl", "nodejs_grpc_library")
nodejs_grpc_library(
name = "greeter_nodejs_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_nodejs_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
nodejs_grpc_library(
name = "greeter_nodejs_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_nodejs_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//nodejs:defs.bzl", "nodejs_proto_compile")
nodejs_proto_compile(
name = "person_nodejs_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
nodejs_proto_compile(
name = "place_nodejs_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
nodejs_proto_compile(
name = "thing_nodejs_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//nodejs:defs.bzl", "nodejs_proto_library")
nodejs_proto_library(
name = "person_nodejs_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_nodejs_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_nodejs_proto"],
)
nodejs_proto_library(
name = "place_nodejs_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_nodejs_proto"],
)
nodejs_proto_library(
name = "thing_nodejs_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//objc:defs.bzl", "objc_grpc_compile")
objc_grpc_compile(
name = "greeter_objc_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_objc_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
objc_grpc_compile(
name = "greeter_objc_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//objc:defs.bzl", "objc_proto_compile")
objc_proto_compile(
name = "person_objc_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
objc_proto_compile(
name = "place_objc_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
objc_proto_compile(
name = "thing_objc_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//objc:defs.bzl", "objc_proto_library")
objc_proto_library(
name = "person_objc_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_objc_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_objc_proto"],
)
objc_proto_library(
name = "place_objc_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_objc_proto"],
)
objc_proto_library(
name = "thing_objc_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//php:defs.bzl", "php_grpc_compile")
php_grpc_compile(
name = "greeter_php_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_php_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
php_grpc_compile(
name = "greeter_php_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//php:defs.bzl", "php_proto_compile")
php_proto_compile(
name = "person_php_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
php_proto_compile(
name = "place_php_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
php_proto_compile(
name = "thing_php_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,37 +1,21 @@
proto_library(
name = "person_proto",
srcs = [
"person.proto",
],
visibility = [
"//visibility:public",
],
deps = [
":place_proto",
],
srcs = ["person.proto"],
visibility = ["//visibility:public"],
deps = [":place_proto"],
)
proto_library(
name = "place_proto",
srcs = [
"place.proto",
],
visibility = [
"//visibility:public",
],
deps = [
":thing_proto",
],
srcs = ["place.proto"],
visibility = ["//visibility:public"],
deps = [":thing_proto"],
)
proto_library(
name = "thing_proto",
srcs = [
"thing.proto",
],
visibility = [
"//visibility:public",
],
srcs = ["thing.proto"],
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//:any_proto",
],
@ -39,17 +23,13 @@ proto_library(
proto_library(
name = "routeguide_proto",
srcs = [
"routeguide.proto",
],
srcs = ["routeguide.proto"],
visibility = ["//visibility:public"],
)
filegroup(
name = "routeguide_features",
srcs = [
"routeguide_features.json",
],
srcs = ["routeguide_features.json"],
visibility = ["//visibility:public"],
)
@ -58,11 +38,9 @@ proto_library(
srcs = [
"greeter.proto",
],
visibility = [
"//visibility:public",
],
visibility = ["//visibility:public"],
deps = [
":person_proto", # Non well-known
":thing_proto", # Non well-known
"@com_google_protobuf//:any_proto", # Well-known
],
)

View File

@ -23,7 +23,7 @@ option go_package = "github.com/rules-proto-grpc/rules_proto_grpc/example/proto"
package greeter;
import "google/protobuf/any.proto";
import "example/proto/person.proto";
import "example/proto/thing.proto";
// The greeting service definition.
@ -41,5 +41,5 @@ message HelloRequest {
message HelloReply {
string message = 1;
google.protobuf.Any payload = 2;
example.proto.Person person = 3;
example.proto.Thing thing = 3;
}

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//python:defs.bzl", "python_grpc_compile")
python_grpc_compile(
name = "greeter_python_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_python_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
python_grpc_compile(
name = "greeter_python_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//python:defs.bzl", "python_grpc_library")
python_grpc_library(
name = "greeter_python_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_python_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
python_grpc_library(
name = "greeter_python_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_python_grpc"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//python:defs.bzl", "python_grpclib_compile")
python_grpclib_compile(
name = "greeter_python_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_python_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
python_grpclib_compile(
name = "greeter_python_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//python:defs.bzl", "python_grpclib_library")
python_grpclib_library(
name = "greeter_python_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_python_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
python_grpclib_library(
name = "greeter_python_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_python_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//python:defs.bzl", "python_proto_compile")
python_proto_compile(
name = "person_python_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
python_proto_compile(
name = "place_python_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
python_proto_compile(
name = "thing_python_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//python:defs.bzl", "python_proto_library")
python_proto_library(
name = "person_python_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_python_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_python_proto"],
)
python_proto_library(
name = "place_python_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_python_proto"],
)
python_proto_library(
name = "thing_python_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//ruby:defs.bzl", "ruby_grpc_compile")
ruby_grpc_compile(
name = "greeter_ruby_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_ruby_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
ruby_grpc_compile(
name = "greeter_ruby_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//ruby:defs.bzl", "ruby_grpc_library")
ruby_grpc_library(
name = "greeter_ruby_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_ruby_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
ruby_grpc_library(
name = "greeter_ruby_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_ruby_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//ruby:defs.bzl", "ruby_proto_compile")
ruby_proto_compile(
name = "person_ruby_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
ruby_proto_compile(
name = "place_ruby_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
ruby_proto_compile(
name = "thing_ruby_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//ruby:defs.bzl", "ruby_proto_library")
ruby_proto_library(
name = "person_ruby_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_ruby_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_ruby_proto"],
)
ruby_proto_library(
name = "place_ruby_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_ruby_proto"],
)
ruby_proto_library(
name = "thing_ruby_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_grpc_compile")
rust_grpc_compile(
name = "greeter_rust_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_rust_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
rust_grpc_compile(
name = "greeter_rust_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,9 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_grpc_library")
rust_grpc_library(
name = "greeter_rust_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "greeter_rust_grpc",
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
"@rules_proto_grpc//example/proto:greeter_grpc",
],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//rust:defs.bzl", "rust_proto_compile")
rust_proto_compile(
name = "person_rust_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
rust_proto_compile(
name = "place_rust_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
rust_proto_compile(
name = "thing_rust_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,10 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_proto_library")
rust_proto_library(
name = "person_rust_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "proto_rust_proto",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//scala:defs.bzl", "scala_grpc_compile")
scala_grpc_compile(
name = "greeter_scala_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_scala_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
scala_grpc_compile(
name = "greeter_scala_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,12 @@
load("@rules_proto_grpc//scala:defs.bzl", "scala_grpc_library")
scala_grpc_library(
name = "greeter_scala_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_scala_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
scala_grpc_library(
name = "greeter_scala_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
deps = ["thing_scala_grpc"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//scala:defs.bzl", "scala_proto_compile")
scala_proto_compile(
name = "person_scala_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
scala_proto_compile(
name = "place_scala_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
scala_proto_compile(
name = "thing_scala_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//scala:defs.bzl", "scala_proto_library")
scala_proto_library(
name = "person_scala_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_scala_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_scala_proto"],
)
scala_proto_library(
name = "place_scala_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_scala_proto"],
)
scala_proto_library(
name = "thing_scala_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,11 @@
load("@rules_proto_grpc//swift:defs.bzl", "swift_grpc_compile")
swift_grpc_compile(
name = "greeter_swift_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "thing_swift_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
swift_grpc_compile(
name = "greeter_swift_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//swift:defs.bzl", "swift_grpc_library")
swift_grpc_library(
name = "person_swift_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_swift_grpc",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_swift_grpc"],
)
swift_grpc_library(
name = "place_swift_grpc",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_swift_grpc"],
)
swift_grpc_library(
name = "thing_swift_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -2,5 +2,15 @@ load("@rules_proto_grpc//swift:defs.bzl", "swift_proto_compile")
swift_proto_compile(
name = "person_swift_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
swift_proto_compile(
name = "place_swift_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
swift_proto_compile(
name = "thing_swift_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -1,6 +1,18 @@
load("@rules_proto_grpc//swift:defs.bzl", "swift_proto_library")
swift_proto_library(
name = "person_swift_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "person_swift_proto",
protos = ["@rules_proto_grpc//example/proto:person_proto"],
deps = ["place_swift_proto"],
)
swift_proto_library(
name = "place_swift_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
deps = ["thing_swift_proto"],
)
swift_proto_library(
name = "thing_swift_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

View File

@ -48,7 +48,17 @@ load("@rules_proto_grpc//go:defs.bzl", "go_proto_compile")
go_proto_compile(
name = "person_go_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)
go_proto_compile(
name = "place_go_proto",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
go_proto_compile(
name = "thing_go_proto",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
```
@ -56,7 +66,7 @@ go_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -96,9 +106,14 @@ rules_proto_grpc_go_repos()
```starlark
load("@rules_proto_grpc//go:defs.bzl", "go_grpc_compile")
go_grpc_compile(
name = "thing_go_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
go_grpc_compile(
name = "greeter_go_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
```
@ -106,7 +121,7 @@ go_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -147,9 +162,13 @@ rules_proto_grpc_go_repos()
load("@rules_proto_grpc//go:defs.bzl", "go_proto_library")
go_proto_library(
name = "person_go_library",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/go/example/go_proto_library/person",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
name = "proto_go_proto",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/example/proto",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)
```
@ -157,8 +176,9 @@ go_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated artifacts |
---
@ -199,9 +219,12 @@ rules_proto_grpc_go_repos()
load("@rules_proto_grpc//go:defs.bzl", "go_grpc_library")
go_grpc_library(
name = "greeter_go_library",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/go/example/go_grpc_library/greeter",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
name = "greeter_go_grpc",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/example/proto",
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
"@rules_proto_grpc//example/proto:greeter_grpc",
],
)
```
@ -209,6 +232,7 @@ go_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated artifacts |

View File

@ -5,7 +5,7 @@ go_grpc_library(
name = "routeguide",
importpath = "google.golang.org/grpc/examples/route_guide/routeguide",
visibility = ["//visibility:public"],
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
go_library(

View File

@ -4,7 +4,7 @@ load("//go:defs.bzl", "go_grpc_library")
go_grpc_library(
name = "routeguide",
importpath = "google.golang.org/grpc/examples/route_guide/routeguide",
deps = ["//example/proto:routeguide_proto"],
protos = ["//example/proto:routeguide_proto"],
)
go_library(

View File

@ -36,10 +36,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [go_grpc_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [go_grpc_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -8,14 +8,14 @@ def go_grpc_library(**kwargs):
go_grpc_compile(
name = name_pb,
prefix_path = kwargs.get("importpath", ""),
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create go library
go_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = kwargs.get("go_deps", []) + GRPC_DEPS,
deps = kwargs.get("go_deps", []) + GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
importpath = kwargs.get("importpath"),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),

View File

@ -35,10 +35,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [go_proto_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [go_proto_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -7,14 +7,14 @@ def go_proto_library(**kwargs):
go_proto_compile(
name = name_pb,
prefix_path = kwargs.get("importpath", ""),
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create go library
go_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = kwargs.get("go_deps", []) + PROTO_DEPS,
deps = kwargs.get("go_deps", []) + PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
importpath = kwargs.get("importpath"),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),

View File

@ -57,7 +57,7 @@ gateway_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -111,7 +111,7 @@ gateway_openapiv2_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
---
@ -166,6 +166,7 @@ gateway_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `deps` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `native.proto_library`) |
| `protos` | `list<ProtoInfo>` | true | `[]` | List of labels that provide a `ProtoInfo` (such as `rules_proto` `proto_library`) |
| `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* |
| `deps` | `list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated artifacts |

View File

@ -14,10 +14,10 @@ gateway_grpc_library(
name = "go_default_library",
importpath = "github.com/rules-proto-grpc/rules_proto_grpc/grpc-gateway/examples/api",
visibility = ["//visibility:public"],
deps = ["api_proto"],
protos = ["api_proto"],
)
gateway_openapiv2_compile(
name = "api_openapiv2",
deps = ["api_proto"],
protos = ["api_proto"],
)

View File

@ -37,10 +37,17 @@ _rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [gateway_grpc_compile_aspect],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
),
deps = attr.label_list(
mandatory = False,
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
aspects = [gateway_grpc_compile_aspect],
doc = "DEPRECATED: Use protos attr"
),
),
)

View File

@ -9,14 +9,14 @@ def gateway_grpc_library(**kwargs):
gateway_grpc_compile(
name = name_pb,
prefix_path = kwargs.get("importpath", ""),
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
**{k: v for (k, v) in kwargs.items() if k in ("protos" if "protos" in kwargs else "deps", "verbose")} # Forward args
)
# Create go library
go_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = kwargs.get("go_deps", []) + GATEWAY_DEPS + GRPC_DEPS,
deps = kwargs.get("go_deps", []) + GATEWAY_DEPS + GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
importpath = kwargs.get("importpath"),
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),

Some files were not shown because too many files have changed in this diff Show More