Add Buf lint and breaking rules

This commit is contained in:
Adam Liddell 2021-03-02 23:11:13 +00:00
parent a94d4c3b85
commit 4cbbbe3d32
84 changed files with 1314 additions and 388 deletions

View File

@ -9,6 +9,7 @@ tasks:
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_3.1.100"
build_targets:
- "//buf/..."
- "//c/..."
- "//cpp/..."
- "//csharp/..."
@ -94,6 +95,7 @@ tasks:
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_3.1.100"
build_targets:
- "//buf/..."
- "//c/..."
- "//cpp/..."
- "//csharp/..."
@ -244,6 +246,62 @@ tasks:
build_targets:
- "//..."
working_directory: example/android/android_grpc_library
buf_buf_proto_breaking_test_ubuntu1804:
name: 'buf: buf_proto_breaking_test'
platform: ubuntu1804
build_flags:
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_breaking_test
buf_buf_proto_breaking_test_windows:
name: 'buf: buf_proto_breaking_test'
platform: windows
build_flags:
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_breaking_test
buf_buf_proto_breaking_test_macos:
name: 'buf: buf_proto_breaking_test'
platform: macos
build_flags:
- "--copt=-DGRPC_BAZEL_BUILD"
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_breaking_test
buf_buf_proto_lint_test_ubuntu1804:
name: 'buf: buf_proto_lint_test'
platform: ubuntu1804
build_flags:
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_lint_test
buf_buf_proto_lint_test_windows:
name: 'buf: buf_proto_lint_test'
platform: windows
build_flags:
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_lint_test
buf_buf_proto_lint_test_macos:
name: 'buf: buf_proto_lint_test'
platform: macos
build_flags:
- "--copt=-DGRPC_BAZEL_BUILD"
build_targets:
- "//..."
test_targets:
- "//..."
working_directory: example/buf/buf_proto_lint_test
c_c_proto_compile_ubuntu1804:
name: 'c: c_proto_compile'
platform: ubuntu1804

1
.github/labeler.yml vendored
View File

@ -1,6 +1,7 @@
dependencies: ['repositories.bzl', '*/repositories.bzl', 'third_party/**/*']
documentation: ['docs/**/*']
lang-android: ['android/**/*', 'example/android/**/*', 'tools/rulegen/android.go']
lang-buf: ['buf/**/*', 'example/buf/**/*', 'tools/rulegen/buf.go']
lang-c: ['c/**/*', 'example/c/**/*', 'tools/rulegen/c.go']
lang-cpp: ['cpp/**/*', 'example/cpp/**/*', 'tools/rulegen/cpp.go']
lang-csharp: ['csharp/**/*', 'example/csharp/**/*', 'tools/rulegen/csharp.go']

View File

@ -35,6 +35,7 @@ Bazel 4.0 compatibility and updated dependencies are in progress.
- [Installation](#installation)
- [Rules](#rules)
- [Android](/android/README.md)
- [Buf](/buf/README.md)
- [C](/c/README.md)
- [C++](/cpp/README.md)
- [C#](/csharp/README.md)
@ -126,6 +127,8 @@ repository.
| [Android](/android) | [android_grpc_compile](/android#android_grpc_compile) | Generates Android protobuf and gRPC `.jar` files ([example](/example/android/android_grpc_compile)) |
| [Android](/android) | [android_proto_library](/android#android_proto_library) | Generates an Android protobuf library using `android_library` from `rules_android` ([example](/example/android/android_proto_library)) |
| [Android](/android) | [android_grpc_library](/android#android_grpc_library) | Generates Android protobuf and gRPC library using `android_library` from `rules_android` ([example](/example/android/android_grpc_library)) |
| [Buf](/buf) | [buf_proto_breaking_test](/buf#buf_proto_breaking_test) | Checks .proto files for breaking changes ([example](/example/buf/buf_proto_breaking_test)) |
| [Buf](/buf) | [buf_proto_lint_test](/buf#buf_proto_lint_test) | Lints .proto files ([example](/example/buf/buf_proto_lint_test)) |
| [C](/c) | [c_proto_compile](/c#c_proto_compile) | Generates C protobuf `.h` & `.c` files ([example](/example/c/c_proto_compile)) |
| [C](/c) | [c_proto_library](/c#c_proto_library) | Generates a C protobuf library using `cc_library`, with dependencies linked ([example](/example/c/c_proto_library)) |
| [C++](/cpp) | [cpp_proto_compile](/cpp#cpp_proto_compile) | Generates C++ protobuf `.h` & `.cc` files ([example](/example/cpp/cpp_proto_compile)) |
@ -375,7 +378,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -384,11 +387,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//<LABEL OF YOUR PLUGIN>"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -48,11 +48,11 @@ android_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -110,11 +110,11 @@ android_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -186,13 +186,13 @@ android_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
---
@ -251,10 +251,10 @@ android_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ android_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//android:javalite_plugin"),
Label("//android:grpc_javalite_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ android_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//android:javalite_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

23
buf/BUILD.bazel Normal file
View File

@ -0,0 +1,23 @@
load("//:defs.bzl", "proto_plugin")
proto_plugin(
name = "breaking_plugin",
quirks = ["QUIRK_DIRECT_MODE"],
separate_options_flag = True,
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_breaking_darwin//file",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_breaking_linux//file",
}),
visibility = ["//visibility:public"],
)
proto_plugin(
name = "lint_plugin",
quirks = ["QUIRK_DIRECT_MODE"],
separate_options_flag = True,
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_lint_darwin//file",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_lint_linux//file",
}),
visibility = ["//visibility:public"],
)

145
buf/README.md Normal file
View File

@ -0,0 +1,145 @@
# Buf rules
Rules for linting and detecting breaking changes in .proto files with [Buf](https://buf.build).
Note that these rules behave differently from the other rules in this repo, since these produce no output and are instead used as tests.
Only Linux and Darwin (MacOS) is currently supported by Buf.
| Rule | Description |
| ---: | :--- |
| [buf_proto_breaking_test](#buf_proto_breaking_test) | Checks .proto files for breaking changes |
| [buf_proto_lint_test](#buf_proto_lint_test) | Lints .proto files |
---
## `buf_proto_breaking_test`
> NOTE: This rule is experimental. It may not work correctly!
Checks .proto files for breaking changes
### `WORKSPACE`
```starlark
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")
rules_proto_grpc_buf_repos()
```
### `BUILD.bazel`
```starlark
load("@rules_proto_grpc//buf:defs.bzl", "buf_proto_breaking_test")
buf_proto_breaking_test(
name = "buf_proto_lint",
against_input = "@rules_proto_grpc//buf/example:image.json",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:routeguide_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)
```
### Attributes
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `label_list` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `against_input` | `label` | true | `` | Label of an existing input image file to check against (.json or .bin) |
| `use_rules` | `string_list` | false | `["FILE"]` | List of Buf breaking rule IDs or categories to use |
| `except_rules` | `string_list` | false | `[]` | List of Buf breaking rule IDs or categories to drop |
| `ignore_unstable_packages` | `bool` | false | `False` | Whether to ignore breaking changes in unstable package versions |
### Plugins
- `@rules_proto_grpc//buf:breaking_plugin`
---
## `buf_proto_lint_test`
> NOTE: This rule is experimental. It may not work correctly!
Lints .proto files
### `WORKSPACE`
```starlark
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")
rules_proto_grpc_buf_repos()
```
### `BUILD.bazel`
```starlark
load("@rules_proto_grpc//buf:defs.bzl", "buf_proto_lint_test")
buf_proto_lint_test(
name = "person_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "place_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:place_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "thing_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "routeguide_buf_proto_lint",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"RPC_REQUEST_STANDARD_NAME",
"RPC_RESPONSE_STANDARD_NAME",
"SERVICE_SUFFIX",
"PACKAGE_DIRECTORY_MATCH",
"RPC_REQUEST_RESPONSE_UNIQUE",
],
protos = ["@rules_proto_grpc//example/proto:routeguide_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
```
### Attributes
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `use_rules` | `string_list` | false | `["DEFAULT"]` | List of Buf lint rule IDs or categories to use |
| `except_rules` | `string_list` | false | `[]` | List of Buf lint rule IDs or categories to drop |
| `enum_zero_value_suffix` | `string` | false | `"_UNSPECIFIED"` | Specify the allowed suffix for the zero enum value |
| `rpc_allow_same_request_response` | `bool` | false | `False` | Allow request and response message to be reused in a single RPC |
| `rpc_allow_google_protobuf_empty_requests` | `bool` | false | `False` | Allow request message to be `google.protobuf.Empty` |
| `rpc_allow_google_protobuf_empty_responses` | `bool` | false | `False` | Allow response message to be `google.protobuf.Empty` |
| `service_suffix` | `string` | false | `"Service"` | The suffix to allow for services |
### Plugins
- `@rules_proto_grpc//buf:lint_plugin`

107
buf/buf.bzl Normal file
View File

@ -0,0 +1,107 @@
"""Common rule implemenation for applying Buf plugins."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load("@bazel_skylib//lib:shell.bzl", "shell")
load("//internal:common.bzl", "descriptor_proto_path")
load("//internal:protoc.bzl", "build_protoc_args")
load("//internal:providers.bzl", "ProtoPluginInfo")
def buf_apply_impl(ctx, options):
"""
Common implementation function for buf rules.
Args:
ctx: The Bazel rule execution context object.
options: The generated options to pass to the plugins.
Returns:
Providers:
- DefaultInfo
"""
# Load toolchain
protoc_toolchain_info = ctx.toolchains[str(Label("//protobuf:toolchain_type"))]
protoc = protoc_toolchain_info.protoc_executable
# Create test script header
script_file = ctx.actions.declare_file(ctx.label.name + ".sh")
content = """#!/usr/bin/env bash
set -uo pipefail
"""
# Load providers
proto_infos = [dep[ProtoInfo] for dep in ctx.attr.protos]
plugins = [plugin[ProtoPluginInfo] for plugin in ctx.attr._plugins]
# Add a command for each plugin
plugin_executables = []
all_inputs = [ctx.file.against_input] if hasattr(ctx.file, "against_input") else []
for plugin in plugins:
# Get plugin
plugin_executables.append(plugin.tool_executable)
# Get proto paths
proto_paths = [] # The paths passed to protoc
for proto_info in proto_infos:
for proto in proto_info.direct_sources:
proto_paths.append(descriptor_proto_path(proto, proto_info))
# Build command
args_list, cmd_inputs = build_protoc_args(
ctx,
plugin,
proto_infos,
".",
short_paths = True,
extra_options = options,
)
all_inputs += cmd_inputs
# Add source proto files as descriptor paths
for proto_path in proto_paths:
args_list.append(proto_path)
content += "{} {}\n".format(shell.quote(protoc.short_path), " ".join([shell.quote(arg) for arg in args_list]))
# Write test script
ctx.actions.write(script_file, content, is_executable = True)
return [
DefaultInfo(
runfiles = ctx.runfiles(
files = [protoc] + plugin_executables + all_inputs,
),
executable = script_file,
),
]
def buf_proto_breaking_test_impl(ctx):
return buf_apply_impl(ctx, [json.encode({
"against_input": ctx.file.against_input.path,
"limit_to_input_files": True,
"input_config": {
"version": "v1beta1",
"breaking": {
"use": ctx.attr.use_rules,
"except": ctx.attr.except_rules,
},
},
})])
def buf_proto_lint_test_impl(ctx):
return buf_apply_impl(ctx, [json.encode({
"input_config": {
"version": "v1beta1",
"lint": {
"use": ctx.attr.use_rules,
"except": ctx.attr.except_rules,
"enum_zero_value_suffix": ctx.attr.enum_zero_value_suffix,
"rpc_allow_same_request_response": ctx.attr.rpc_allow_same_request_response,
"rpc_allow_google_protobuf_empty_requests": ctx.attr.rpc_allow_google_protobuf_empty_requests,
"rpc_allow_google_protobuf_empty_responses": ctx.attr.rpc_allow_google_protobuf_empty_responses,
"service_suffix": ctx.attr.service_suffix,
},
},
})])

View File

@ -0,0 +1,55 @@
"""Generated definition of buf_proto_breaking_test."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//:defs.bzl",
"ProtoPluginInfo",
)
load(
":buf.bzl",
"buf_proto_breaking_test_impl",
)
buf_proto_breaking_test = rule(
implementation = buf_proto_breaking_test_impl,
attrs = dict(
protos = attr.label_list(
providers = [ProtoInfo],
default = [],
mandatory = True,
doc = "List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`)",
),
against_input = attr.label(
allow_single_file = [".bin", ".json"],
mandatory = True,
doc = "Label of an existing input image file to check against (.json or .bin)",
),
use_rules = attr.string_list(
default = ["FILE"],
mandatory = False,
doc = "List of Buf breaking rule IDs or categories to use",
),
except_rules = attr.string_list(
default = [],
mandatory = False,
doc = "List of Buf breaking rule IDs or categories to drop",
),
ignore_unstable_packages = attr.bool(
default = False,
mandatory = False,
doc = "Whether to ignore breaking changes in unstable package versions",
),
options = attr.string_list(
doc = "Extra options to pass to plugins",
),
_plugins = attr.label_list(
providers = [ProtoPluginInfo],
default = [
Label("//buf:breaking_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
test = True,
toolchains = [str(Label("//protobuf:toolchain_type"))],
)

View File

@ -0,0 +1,69 @@
"""Generated definition of buf_proto_lint_test."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//:defs.bzl",
"ProtoPluginInfo",
)
load(
":buf.bzl",
"buf_proto_lint_test_impl",
)
buf_proto_lint_test = rule(
implementation = buf_proto_lint_test_impl,
attrs = dict(
protos = attr.label_list(
providers = [ProtoInfo],
mandatory = True,
doc = "List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`)",
),
use_rules = attr.string_list(
default = ["DEFAULT"],
mandatory = False,
doc = "List of Buf lint rule IDs or categories to use",
),
except_rules = attr.string_list(
default = [],
mandatory = False,
doc = "List of Buf lint rule IDs or categories to drop",
),
enum_zero_value_suffix = attr.string(
default = "_UNSPECIFIED",
mandatory = False,
doc = "Specify the allowed suffix for the zero enum value",
),
rpc_allow_same_request_response = attr.bool(
default = False,
mandatory = False,
doc = "Allow request and response message to be reused in a single RPC",
),
rpc_allow_google_protobuf_empty_requests = attr.bool(
default = False,
mandatory = False,
doc = "Allow request message to be `google.protobuf.Empty`",
),
rpc_allow_google_protobuf_empty_responses = attr.bool(
default = False,
mandatory = False,
doc = "Allow response message to be `google.protobuf.Empty`",
),
service_suffix = attr.string(
default = "Service",
mandatory = False,
doc = "The suffix to allow for services",
),
options = attr.string_list(
doc = "Extra options to pass to plugins",
),
_plugins = attr.label_list(
providers = [ProtoPluginInfo],
default = [
Label("//buf:lint_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
test = True,
toolchains = [str(Label("//protobuf:toolchain_type"))],
)

8
buf/defs.bzl Normal file
View File

@ -0,0 +1,8 @@
"""buf protobuf and grpc rules."""
load(":buf_proto_breaking_test.bzl", _buf_proto_breaking_test = "buf_proto_breaking_test")
load(":buf_proto_lint_test.bzl", _buf_proto_lint_test = "buf_proto_lint_test")
# Export buf rules
buf_proto_breaking_test = _buf_proto_breaking_test
buf_proto_lint_test = _buf_proto_lint_test

1
buf/example/BUILD.bazel Normal file
View File

@ -0,0 +1 @@
exports_files(["image.json"])

1
buf/example/image.json Normal file

File diff suppressed because one or more lines are too long

17
buf/repositories.bzl Normal file
View File

@ -0,0 +1,17 @@
"""Common dependencies for rules_proto_grpc Buf rules."""
load(
"//:repositories.bzl",
"protoc_gen_buf_breaking_darwin",
"protoc_gen_buf_breaking_linux",
"protoc_gen_buf_lint_darwin",
"protoc_gen_buf_lint_linux",
"rules_proto_grpc_repos",
)
def buf_repos(**kwargs): # buildifier: disable=function-docstring
rules_proto_grpc_repos(**kwargs)
protoc_gen_buf_breaking_darwin(**kwargs)
protoc_gen_buf_breaking_linux(**kwargs)
protoc_gen_buf_lint_darwin(**kwargs)
protoc_gen_buf_lint_linux(**kwargs)

View File

@ -11,7 +11,7 @@ Rules for generating C protobuf `.c` & `.h` files and libraries using [upb](http
## `c_proto_compile`
> NOTE: this rule is EXPERIMENTAL. It may not work correctly or even compile!
> NOTE: This rule is experimental. It may not work correctly!
Generates C protobuf `.h` & `.c` files
@ -52,11 +52,11 @@ c_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -66,7 +66,7 @@ c_proto_compile(
## `c_proto_library`
> NOTE: this rule is EXPERIMENTAL. It may not work correctly or even compile!
> NOTE: This rule is experimental. It may not work correctly!
Generates a C protobuf library using `cc_library`, with dependencies linked
@ -103,18 +103,18 @@ c_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | 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`. |
| `copts` | `string_list` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `string_list` | 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`. |
| `linkopts` | `string_list` | 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`. |
| `local_defines` | `string_list` | 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

@ -33,7 +33,7 @@ c_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//c:upb_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -48,11 +48,11 @@ cpp_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -96,11 +96,11 @@ cpp_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -148,19 +148,19 @@ cpp_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | 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`. |
| `copts` | `string_list` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `string_list` | 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`. |
| `linkopts` | `string_list` | 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`. |
| `local_defines` | `string_list` | 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`. |
@ -203,18 +203,18 @@ cpp_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | 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`. |
| `copts` | `string_list` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `string_list` | 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`. |
| `linkopts` | `string_list` | 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`. |
| `local_defines` | `string_list` | 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

@ -34,7 +34,7 @@ cpp_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//cpp:cpp_plugin"),
Label("//cpp:grpc_cpp_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ cpp_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//cpp:cpp_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -66,11 +66,11 @@ csharp_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -131,11 +131,11 @@ csharp_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -201,12 +201,12 @@ csharp_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -264,9 +264,9 @@ csharp_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ csharp_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//csharp:csharp_plugin"),
Label("//csharp:grpc_csharp_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ csharp_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//csharp:csharp_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -52,11 +52,11 @@ d_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -107,8 +107,8 @@ d_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |

View File

@ -33,7 +33,7 @@ d_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//d:d_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -7,7 +7,10 @@ proto_plugin(
"docbook",
"{name}.xml",
],
quirks = ["QUIRK_OUT_PASS_ROOT"],
quirks = [
"QUIRK_OUT_PASS_ROOT",
"QUIRK_DIRECT_MODE",
],
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_doc_darwin//:protoc-gen-doc",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_doc_linux//:protoc-gen-doc",
@ -23,7 +26,10 @@ proto_plugin(
"html",
"{name}.html",
],
quirks = ["QUIRK_OUT_PASS_ROOT"],
quirks = [
"QUIRK_OUT_PASS_ROOT",
"QUIRK_DIRECT_MODE",
],
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_doc_darwin//:protoc-gen-doc",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_doc_linux//:protoc-gen-doc",
@ -39,7 +45,10 @@ proto_plugin(
"json",
"{name}.json",
],
quirks = ["QUIRK_OUT_PASS_ROOT"],
quirks = [
"QUIRK_OUT_PASS_ROOT",
"QUIRK_DIRECT_MODE",
],
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_doc_darwin//:protoc-gen-doc",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_doc_linux//:protoc-gen-doc",
@ -55,7 +64,10 @@ proto_plugin(
"markdown",
"{name}.md",
],
quirks = ["QUIRK_OUT_PASS_ROOT"],
quirks = [
"QUIRK_OUT_PASS_ROOT",
"QUIRK_DIRECT_MODE",
],
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_doc_darwin//:protoc-gen-doc",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_doc_linux//:protoc-gen-doc",

View File

@ -13,6 +13,8 @@ Rules for generating protobuf Markdown, JSON, HTML or DocBook documentation with
## `doc_docbook_compile`
> NOTE: This rule is experimental. It may not work correctly!
Generates DocBook `.xml` documentation file
### `WORKSPACE`
@ -48,11 +50,11 @@ doc_docbook_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -62,6 +64,8 @@ doc_docbook_compile(
## `doc_html_compile`
> NOTE: This rule is experimental. It may not work correctly!
Generates `.html` documentation file
### `WORKSPACE`
@ -97,11 +101,11 @@ doc_html_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -111,6 +115,8 @@ doc_html_compile(
## `doc_json_compile`
> NOTE: This rule is experimental. It may not work correctly!
Generates `.json` documentation file
### `WORKSPACE`
@ -146,11 +152,11 @@ doc_json_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -160,6 +166,8 @@ doc_json_compile(
## `doc_markdown_compile`
> NOTE: This rule is experimental. It may not work correctly!
Generates Markdown `.md` documentation file
### `WORKSPACE`
@ -195,11 +203,11 @@ doc_markdown_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins

View File

@ -33,7 +33,7 @@ doc_docbook_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//doc:docbook_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ doc_html_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//doc:html_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ doc_json_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//doc:json_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ doc_markdown_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//doc:markdown_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -21,6 +21,19 @@ android_android_grpc_library_example:
.PHONY: android_examples
android_examples: android_android_proto_compile_example android_android_grpc_compile_example android_android_proto_library_example android_android_grpc_library_example
.PHONY: buf_buf_proto_breaking_test_example
buf_buf_proto_breaking_test_example:
cd example/buf/buf_proto_breaking_test; \
bazel --batch test --verbose_failures --test_output=errors --disk_cache=../../bazel-disk-cache //...
.PHONY: buf_buf_proto_lint_test_example
buf_buf_proto_lint_test_example:
cd example/buf/buf_proto_lint_test; \
bazel --batch test --verbose_failures --test_output=errors --disk_cache=../../bazel-disk-cache //...
.PHONY: buf_examples
buf_examples: buf_buf_proto_breaking_test_example buf_buf_proto_lint_test_example
.PHONY: c_c_proto_compile_example
c_c_proto_compile_example:
cd example/c/c_proto_compile; \
@ -375,4 +388,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 doc_doc_docbook_compile_example doc_doc_html_compile_example doc_doc_json_compile_example doc_doc_markdown_compile_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
all_examples: android_android_proto_compile_example android_android_grpc_compile_example android_android_proto_library_example android_android_grpc_library_example buf_buf_proto_breaking_test_example buf_buf_proto_lint_test_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 doc_doc_docbook_compile_example doc_doc_html_compile_example doc_doc_json_compile_example doc_doc_markdown_compile_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

@ -0,0 +1,12 @@
load("@rules_proto_grpc//buf:defs.bzl", "buf_proto_breaking_test")
buf_proto_breaking_test(
name = "buf_proto_lint",
against_input = "@rules_proto_grpc//buf/example:image.json",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:routeguide_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)

View File

@ -0,0 +1,20 @@
local_repository(
name = "rules_proto_grpc",
path = "../../../",
)
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")
rules_proto_grpc_buf_repos()

View File

@ -0,0 +1,48 @@
load("@rules_proto_grpc//buf:defs.bzl", "buf_proto_lint_test")
buf_proto_lint_test(
name = "person_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "place_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:place_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "thing_buf_proto_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
buf_proto_lint_test(
name = "routeguide_buf_proto_lint",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"RPC_REQUEST_STANDARD_NAME",
"RPC_RESPONSE_STANDARD_NAME",
"SERVICE_SUFFIX",
"PACKAGE_DIRECTORY_MATCH",
"RPC_REQUEST_RESPONSE_UNIQUE",
],
protos = ["@rules_proto_grpc//example/proto:routeguide_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)

View File

@ -0,0 +1,20 @@
local_repository(
name = "rules_proto_grpc",
path = "../../../",
)
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")
rules_proto_grpc_buf_repos()

View File

@ -7,6 +7,9 @@ package example.proto;
import "example/proto/place.proto";
message Person {
// The person's name
string name = 1;
// The person's place
example.proto.Place place = 3;
}

View File

@ -66,11 +66,11 @@ go_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -128,11 +128,11 @@ go_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -191,12 +191,12 @@ go_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated files |
---
@ -250,10 +250,10 @@ go_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated files |

View File

@ -34,7 +34,7 @@ go_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//go:go_plugin"),
Label("//go:grpc_go_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ go_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//go:go_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -57,11 +57,11 @@ gateway_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -120,11 +120,11 @@ gateway_openapiv2_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -182,10 +182,10 @@ gateway_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `importpath` | `string` | false | `None` | Importpath for the generated files |

View File

@ -35,7 +35,7 @@ gateway_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -43,7 +43,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -52,13 +52,13 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//grpc-gateway:grpc_gateway_plugin"),
Label("//go:grpc_go_plugin"),
Label("//go:go_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ gateway_openapiv2_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//grpc-gateway:openapiv2_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -276,6 +276,13 @@ def common_compile(ctx, proto_infos):
args = ctx.actions.args()
args.add_all(args_list)
# Add import roots and files if required by plugin
# By default we pass just the descriptors and the proto paths, but these may not contain all of the comments
# etc from the source files
if "QUIRK_DIRECT_MODE" in plugin.quirks:
args.add_all(["--proto_path=" + proto_info.proto_source_root for proto_info in proto_infos])
cmd_inputs += protos
# Add source proto files as descriptor paths
for proto_path in proto_paths:
args.add(proto_path)
@ -286,7 +293,7 @@ def common_compile(ctx, proto_infos):
mnemonic = "ProtoCompile"
command = ("mkdir -p '{}' && ".format(output_root)) + protoc.path + " $@" # $@ is replaced with args list
inputs = cmd_inputs # Proto files are not inputs, as they come via the descriptor sets
inputs = cmd_inputs
tools = [protoc] + ([plugin.tool_executable] if plugin.tool_executable else [])
# Amend command with debug options

View File

@ -7,8 +7,13 @@ def _short_path(file):
return file.short_path
def build_protoc_args(
ctx, plugin, proto_infos, out_arg, extra_options = [], extra_protoc_args = [], short_paths = False
):
ctx,
plugin,
proto_infos,
out_arg,
extra_options = [],
extra_protoc_args = [],
short_paths = False):
"""
Build the args for a protoc invocation.

View File

@ -48,11 +48,11 @@ java_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -92,11 +92,11 @@ java_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -144,13 +144,13 @@ java_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
---
@ -205,10 +205,10 @@ java_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ java_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//java:java_plugin"),
Label("//java:grpc_java_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ java_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//java:java_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -69,11 +69,11 @@ js_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -122,11 +122,11 @@ js_grpc_node_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -177,11 +177,11 @@ js_grpc_web_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -238,12 +238,12 @@ js_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `deps_repo` | `string` | false | `@npm` | The repository to load the dependencies from, if you don't use `@npm` |
---
@ -289,12 +289,12 @@ js_grpc_node_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `deps_repo` | `string` | false | `@npm` | The repository to load the dependencies from, if you don't use `@npm` |
---
@ -340,10 +340,10 @@ js_grpc_web_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `deps_repo` | `string` | false | `@npm` | The repository to load the dependencies from, if you don't use `@npm` |

View File

@ -36,7 +36,7 @@ js_grpc_node_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -44,7 +44,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -53,7 +53,6 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//js:js_plugin"),
@ -61,6 +60,7 @@ _rule = rule(
Label("//js:grpc_node_plugin"),
Label("//js:grpc_node_ts_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -35,7 +35,7 @@ js_grpc_web_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -43,7 +43,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -52,13 +52,13 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//js:js_plugin"),
Label("//js:ts_plugin"),
Label("//js:grpc_web_js_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -34,7 +34,7 @@ js_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//js:js_plugin"),
Label("//js:ts_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -48,11 +48,11 @@ objc_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -96,11 +96,11 @@ objc_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -148,19 +148,19 @@ objc_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | 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`. |
| `copts` | `string_list` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `string_list` | 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`. |
| `linkopts` | `string_list` | 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`. |
| `local_defines` | `string_list` | 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`. |
@ -168,7 +168,7 @@ objc_proto_library(
## `objc_grpc_library`
> NOTE: this rule is EXPERIMENTAL. It may not work correctly or even compile!
> NOTE: This rule is experimental. It may not work correctly!
Generates an Objective-C protobuf and gRPC library using `objc_library`
@ -205,18 +205,18 @@ objc_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | 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`. |
| `copts` | `string_list` | false | `None` | Passed to the `opts` attribute of `cc_library`. |
| `defines` | `string_list` | 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`. |
| `linkopts` | `string_list` | 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`. |
| `local_defines` | `string_list` | 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

@ -34,7 +34,7 @@ objc_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//objc:objc_plugin"),
Label("//objc:grpc_objc_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ objc_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//objc:objc_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -46,11 +46,11 @@ php_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -94,11 +94,11 @@ php_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins

View File

@ -34,7 +34,7 @@ php_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//php:php_plugin"),
Label("//php:grpc_php_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ php_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//php:php_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -52,11 +52,11 @@ python_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -100,11 +100,11 @@ python_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -157,11 +157,11 @@ python_grpclib_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -209,12 +209,12 @@ python_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -255,12 +255,12 @@ python_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -309,9 +309,9 @@ python_grpclib_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ python_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//python:python_plugin"),
Label("//python:grpc_python_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -34,7 +34,7 @@ python_grpclib_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//python:python_plugin"),
Label("//python:grpclib_python_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ python_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//python:python_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -72,6 +72,32 @@ VERSIONS = {
"sha256": "f329928c62ade05ceda72c4e145fd300722e6e592627d43580dd0a8211c14612",
},
# Buf
"protoc_gen_buf_breaking_darwin": {
"type": "http_file",
"urls": ["https://github.com/bufbuild/buf/releases/download/v0.38.0/protoc-gen-buf-breaking-Darwin-x86_64"],
"sha256": "639f57ade58f16996c861df9de7d819e6443f58b8087b44af81863eb9e781ba8",
"executable": True,
},
"protoc_gen_buf_breaking_linux": {
"type": "http_file",
"urls": ["https://github.com/bufbuild/buf/releases/download/v0.38.0/protoc-gen-buf-breaking-Linux-x86_64"],
"sha256": "298f56d527c8acea7cb51929bf1ebc75a96fd2f0c294248db68d3ba479086c53",
"executable": True,
},
"protoc_gen_buf_lint_darwin": {
"type": "http_file",
"urls": ["https://github.com/bufbuild/buf/releases/download/v0.38.0/protoc-gen-buf-lint-Darwin-x86_64"],
"sha256": "83884b667e33d2ba52f3d2976ad6d1a02333f93f73f719600d5e612f7d58c2a8",
"executable": True,
},
"protoc_gen_buf_lint_linux": {
"type": "http_file",
"urls": ["https://github.com/bufbuild/buf/releases/download/v0.38.0/protoc-gen-buf-lint-Linux-x86_64"],
"sha256": "ded760a019da3b5da89feecde1eb831649a70cc2305f1b82675a4080d12acddc",
"executable": True,
},
# C
"upb": {
"type": "github",
@ -476,6 +502,21 @@ def bazel_skylib(**kwargs):
def build_bazel_rules_android(**kwargs):
_generic_dependency("build_bazel_rules_android", **kwargs)
#
# Buf
#
def protoc_gen_buf_breaking_darwin(**kwargs):
_generic_dependency("protoc_gen_buf_breaking_darwin", **kwargs)
def protoc_gen_buf_breaking_linux(**kwargs):
_generic_dependency("protoc_gen_buf_breaking_linux", **kwargs)
def protoc_gen_buf_lint_darwin(**kwargs):
_generic_dependency("protoc_gen_buf_lint_darwin", **kwargs)
def protoc_gen_buf_lint_linux(**kwargs):
_generic_dependency("protoc_gen_buf_lint_linux", **kwargs)
#
# C
#

View File

@ -62,11 +62,11 @@ ruby_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -124,11 +124,11 @@ ruby_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -190,12 +190,12 @@ ruby_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -250,9 +250,9 @@ ruby_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ ruby_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//ruby:ruby_plugin"),
Label("//ruby:grpc_ruby_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ ruby_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//ruby:ruby_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -56,11 +56,11 @@ rust_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -108,11 +108,11 @@ rust_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -160,12 +160,12 @@ rust_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
---
@ -207,9 +207,9 @@ rust_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |

View File

@ -34,7 +34,7 @@ rust_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//rust:rust_plugin"),
Label("//rust:grpc_rust_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ rust_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//rust:rust_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -64,11 +64,11 @@ scala_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -128,11 +128,11 @@ scala_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -195,13 +195,13 @@ scala_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
---
@ -258,10 +258,10 @@ scala_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `exports` | `list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `exports` | `label_list` | false | `[]` | List of labels to pass as exports attr to underlying lang_library rule |

View File

@ -33,7 +33,7 @@ scala_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//scala:grpc_scala_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ scala_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//scala:scala_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -55,11 +55,11 @@ swift_proto_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -106,11 +106,11 @@ swift_grpc_compile(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
### Plugins
@ -157,12 +157,12 @@ swift_proto_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `module_name` | `string` | false | `` | The name of the Swift module being built. |
---
@ -204,10 +204,10 @@ swift_grpc_library(
| Name | Type | Mandatory | Default | Description |
| ---: | :--- | --------- | ------- | ----------- |
| `protos` | `list<Label[ProtoInfo]>` | true | `[]` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `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 |
| `protos` | `label_list` | true | `` | List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`) |
| `options` | `string_list_dict` | 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 |
| `extra_protoc_args` | `string_list` | false | `[]` | A list of extra args to pass directly to protoc, not as plugin options |
| `deps` | `label_list` | false | `[]` | List of labels to pass as deps attr to underlying lang_library rule |
| `module_name` | `string` | false | `` | The name of the Swift module being built. |

View File

@ -34,7 +34,7 @@ swift_grpc_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -42,7 +42,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -51,12 +51,12 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//swift:swift_plugin"),
Label("//swift:grpc_swift_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -33,7 +33,7 @@ swift_proto_compile_aspect = aspect(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -41,7 +41,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -50,11 +50,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//swift:swift_plugin"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -185,7 +185,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -194,11 +194,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
Label("//<LABEL OF YOUR PLUGIN>"),
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -35,6 +35,7 @@ Bazel 4.0 compatibility and updated dependencies are in progress.
- [Installation](#installation)
- [Rules](#rules)
- [Android](/android/README.md)
- [Buf](/buf/README.md)
- [C](/c/README.md)
- [C++](/cpp/README.md)
- [C#](/csharp/README.md)

231
tools/rulegen/buf.go Normal file
View File

@ -0,0 +1,231 @@
package main
var bufRuleTemplate = mustTemplate(`load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//:defs.bzl",
"ProtoPluginInfo",
)
load(
":buf.bzl",
"{{ .Rule.Name }}_impl",
)
{{ .Rule.Name }} = rule(
implementation = {{ .Rule.Name }}_impl,
attrs = dict({{ range .Rule.Attrs }}
{{ .Name }} = attr.{{ .Type }}(
{{ if .Providers }}providers = [{{ range .Providers }}{{ . }}{{ end }}],
{{ end }}{{ if .Default }}default = {{ .Default }},
{{ end }}{{ if eq .Name "against_input" }}allow_single_file = [".bin", ".json"],
{{ end }}mandatory = {{ if .Mandatory }}True{{ else }}False{{ end }},
doc = "{{ .Doc }}",
),{{ end }}
options = attr.string_list(
doc = "Extra options to pass to plugins",
),
_plugins = attr.label_list(
providers = [ProtoPluginInfo],
default = [{{ range .Rule.Plugins }}
Label("{{ . }}"),{{ end }}
],
doc = "List of protoc plugins to apply",
),
),
test = True,
toolchains = [str(Label("//protobuf:toolchain_type"))],
)`)
var bufBreakingExampleTemplate = mustTemplate(`load("@rules_proto_grpc//{{ .Lang.Dir }}:defs.bzl", "{{ .Rule.Name }}")
{{ .Rule.Name }}(
name = "{{ .Lang.Name }}_{{ .Rule.Kind }}_lint",
against_input = "@rules_proto_grpc//buf/example:image.json",
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:routeguide_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
)`)
var bufLintExampleTemplate = mustTemplate(`load("@rules_proto_grpc//{{ .Lang.Dir }}:defs.bzl", "{{ .Rule.Name }}")
{{ .Rule.Name }}(
name = "person_{{ .Lang.Name }}_{{ .Rule.Kind }}_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:person_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
{{ .Rule.Name }}(
name = "place_{{ .Lang.Name }}_{{ .Rule.Kind }}_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:place_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
{{ .Rule.Name }}(
name = "thing_{{ .Lang.Name }}_{{ .Rule.Kind }}_lint",
except_rules = ["PACKAGE_VERSION_SUFFIX"],
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)
{{ .Rule.Name }}(
name = "routeguide_{{ .Lang.Name }}_{{ .Rule.Kind }}_lint",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"RPC_REQUEST_STANDARD_NAME",
"RPC_RESPONSE_STANDARD_NAME",
"SERVICE_SUFFIX",
"PACKAGE_DIRECTORY_MATCH",
"RPC_REQUEST_RESPONSE_UNIQUE",
],
protos = ["@rules_proto_grpc//example/proto:routeguide_proto"],
use_rules = [
"DEFAULT",
"COMMENTS",
],
)`)
func makeBuf() *Language {
return &Language{
Dir: "buf",
Name: "buf",
DisplayName: "Buf",
Notes: mustTemplate(`Rules for linting and detecting breaking changes in .proto files with [Buf](https://buf.build).
Note that these rules behave differently from the other rules in this repo, since these produce no output and are instead used as tests.
Only Linux and Darwin (MacOS) is currently supported by Buf.`),
Flags: commonLangFlags,
Rules: []*Rule{
&Rule{
Name: "buf_proto_breaking_test",
Kind: "proto",
Implementation: bufRuleTemplate,
Plugins: []string{"//buf:breaking_plugin"},
WorkspaceExample: protoWorkspaceTemplate,
BuildExample: bufBreakingExampleTemplate,
Doc: "Checks .proto files for breaking changes",
Attrs: []*Attr{
&Attr{
Name: "protos",
Type: "label_list",
Default: "[]",
Doc: "List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`)",
Mandatory: true,
Providers: []string{"ProtoInfo"},
},
&Attr{
Name: "against_input",
Type: "label",
Doc: "Label of an existing input image file to check against (.json or .bin)",
Mandatory: true,
},
&Attr{
Name: "use_rules",
Type: "string_list",
Default: `["FILE"]`,
Doc: "List of Buf breaking rule IDs or categories to use",
Mandatory: false,
},
&Attr{
Name: "except_rules",
Type: "string_list",
Default: "[]",
Doc: "List of Buf breaking rule IDs or categories to drop",
Mandatory: false,
},
&Attr{
Name: "ignore_unstable_packages",
Type: "bool",
Default: "False",
Doc: "Whether to ignore breaking changes in unstable package versions",
Mandatory: false,
},
},
Experimental: true,
IsTest: true,
},
&Rule{
Name: "buf_proto_lint_test",
Kind: "proto",
Implementation: bufRuleTemplate,
Plugins: []string{"//buf:lint_plugin"},
WorkspaceExample: protoWorkspaceTemplate,
BuildExample: bufLintExampleTemplate,
Doc: "Lints .proto files",
Attrs: []*Attr{
&Attr{
Name: "protos",
Type: "label_list",
Doc: "List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`)",
Mandatory: true,
Providers: []string{"ProtoInfo"},
},
&Attr{
Name: "use_rules",
Type: "string_list",
Default: `["DEFAULT"]`,
Doc: "List of Buf lint rule IDs or categories to use",
Mandatory: false,
},
&Attr{
Name: "except_rules",
Type: "string_list",
Default: "[]",
Doc: "List of Buf lint rule IDs or categories to drop",
Mandatory: false,
},
&Attr{
Name: "enum_zero_value_suffix",
Type: "string",
Default: `"_UNSPECIFIED"`,
Doc: "Specify the allowed suffix for the zero enum value",
Mandatory: false,
},
&Attr{
Name: "rpc_allow_same_request_response",
Type: "bool",
Default: "False",
Doc: "Allow request and response message to be reused in a single RPC",
Mandatory: false,
},
&Attr{
Name: "rpc_allow_google_protobuf_empty_requests",
Type: "bool",
Default: "False",
Doc: "Allow request message to be `google.protobuf.Empty`",
Mandatory: false,
},
&Attr{
Name: "rpc_allow_google_protobuf_empty_responses",
Type: "bool",
Default: "False",
Doc: "Allow response message to be `google.protobuf.Empty`",
Mandatory: false,
},
&Attr{
Name: "service_suffix",
Type: "string",
Default: `"Service"`,
Doc: "The suffix to allow for services",
Mandatory: false,
},
},
Experimental: true,
IsTest: true,
},
},
}
}

View File

@ -7,14 +7,14 @@ var commonLangFlags = []*Flag{}
var compileRuleAttrs = []*Attr{
&Attr{
Name: "protos",
Type: "list<Label[ProtoInfo]>",
Default: "[]",
Type: "label_list",
Doc: "List of labels that provide the `ProtoInfo` provider (such as `proto_library` from `rules_proto`)",
Mandatory: true,
Providers: []string{"ProtoInfo"},
},
&Attr{
Name: "options",
Type: "dict<string, list(string)>",
Type: "string_list_dict",
Default: "[]",
Doc: "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",
Mandatory: false,
@ -35,7 +35,7 @@ var compileRuleAttrs = []*Attr{
},
&Attr{
Name: "extra_protoc_args",
Type: "list<string>",
Type: "string_list",
Default: "[]",
Doc: "A list of extra args to pass directly to protoc, not as plugin options",
Mandatory: false,
@ -46,7 +46,7 @@ var compileRuleAttrs = []*Attr{
var libraryRuleAttrs = append(append([]*Attr(nil), compileRuleAttrs...), []*Attr{
&Attr{
Name: "deps",
Type: "list<Label/string>",
Type: "label_list",
Default: "[]",
Doc: "List of labels to pass as deps attr to underlying lang_library rule",
Mandatory: false,
@ -87,7 +87,7 @@ load(
toolchains = [str(Label("//protobuf:toolchain_type"))],
)
# Create compile rule to apply aspect
# Create compile rule
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
@ -95,7 +95,7 @@ _rule = rule(
protos = attr.label_list(
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
providers = [ProtoInfo],
doc = "List of labels that provide a ProtoInfo (such as rules_proto proto_library)",
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
),
deps = attr.label_list(
mandatory = False,
@ -104,11 +104,11 @@ _rule = rule(
doc = "DEPRECATED: Use protos attr",
),
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [{{ range .Rule.Plugins }}
Label("{{ . }}"),{{ end }}
],
doc = "List of protoc plugins to apply",
),
),
toolchains = [str(Label("//protobuf:toolchain_type"))],

View File

@ -88,14 +88,14 @@ var cppLibraryRuleAttrs = append(append([]*Attr(nil), libraryRuleAttrs...), []*A
},
&Attr{
Name: "copts",
Type: "list<string>",
Type: "string_list",
Default: "None",
Doc: "Passed to the `opts` attribute of `cc_library`.",
Mandatory: false,
},
&Attr{
Name: "defines",
Type: "list<string>",
Type: "string_list",
Default: "None",
Doc: "Passed to the `defines` attribute of `cc_library`.",
Mandatory: false,
@ -109,7 +109,7 @@ var cppLibraryRuleAttrs = append(append([]*Attr(nil), libraryRuleAttrs...), []*A
},
&Attr{
Name: "linkopts",
Type: "list<string>",
Type: "string_list",
Default: "None",
Doc: "Passed to the `linkopts` attribute of `cc_library`.",
Mandatory: false,
@ -123,7 +123,7 @@ var cppLibraryRuleAttrs = append(append([]*Attr(nil), libraryRuleAttrs...), []*A
},
&Attr{
Name: "local_defines",
Type: "list<string>",
Type: "string_list",
Default: "None",
Doc: "Passed to the `local_defines` attribute of `cc_library`.",
Mandatory: false,

View File

@ -8,7 +8,7 @@ func makeDoc() *Language {
Notes: mustTemplate("Rules for generating protobuf Markdown, JSON, HTML or DocBook documentation with [protoc-gen-doc](https://github.com/pseudomuto/protoc-gen-doc)"),
Flags: commonLangFlags,
Rules: []*Rule{
&Rule{
&Rule{
Name: "doc_docbook_compile",
Kind: "proto",
Implementation: compileRuleTemplate,
@ -17,6 +17,7 @@ func makeDoc() *Language {
BuildExample: protoCompileExampleTemplate,
Doc: "Generates DocBook `.xml` documentation file",
Attrs: compileRuleAttrs,
Experimental: true,
},
&Rule{
Name: "doc_html_compile",
@ -27,6 +28,7 @@ func makeDoc() *Language {
BuildExample: protoCompileExampleTemplate,
Doc: "Generates `.html` documentation file",
Attrs: compileRuleAttrs,
Experimental: true,
},
&Rule{
Name: "doc_json_compile",
@ -37,6 +39,7 @@ func makeDoc() *Language {
BuildExample: protoCompileExampleTemplate,
Doc: "Generates `.json` documentation file",
Attrs: compileRuleAttrs,
Experimental: true,
},
&Rule{
Name: "doc_markdown_compile",
@ -47,6 +50,7 @@ func makeDoc() *Language {
BuildExample: protoCompileExampleTemplate,
Doc: "Generates Markdown `.md` documentation file",
Attrs: compileRuleAttrs,
Experimental: true,
},
},
}

View File

@ -81,7 +81,7 @@ GRPC_DEPS = [
var javaLibraryRuleAttrs = append(append([]*Attr(nil), libraryRuleAttrs...), []*Attr{
&Attr{
Name: "exports",
Type: "list",
Type: "label_list",
Default: "[]",
Doc: "List of labels to pass as exports attr to underlying lang_library rule",
Mandatory: false,

View File

@ -98,6 +98,7 @@ func action(c *cli.Context) error {
languages := []*Language{
makeAndroid(),
makeBuf(),
makeC(),
makeCpp(),
makeCsharp(),
@ -296,7 +297,7 @@ func mustWriteLanguageReadme(dir string, lang *Language) {
out.ln()
if rule.Experimental {
out.w(`> NOTE: this rule is EXPERIMENTAL. It may not work correctly or even compile!`)
out.w(`> NOTE: This rule is experimental. It may not work correctly!`)
out.ln()
}
out.w(rule.Doc)
@ -462,6 +463,10 @@ func mustWriteBazelciPresubmitYml(dir string, languages []*Language, envVars []s
}
out.w(" build_targets:")
out.w(` - "//..."`)
if rule.IsTest {
out.w(" test_targets:")
out.w(` - "//..."`)
}
out.w(" working_directory: %s", exampleDir)
if len(lang.PresubmitEnvVars) > 0 || len(rule.PresubmitEnvVars) > 0 {
@ -526,7 +531,11 @@ func mustWriteExamplesMakefile(dir string, languages []*Language) {
out.w(".PHONY: %s", name)
out.w("%s:", name)
out.w(" cd %s; \\", exampleDir)
out.w(" bazel --batch build --verbose_failures --disk_cache=%s../../bazel-disk-cache //...", strings.Repeat("../", langDepth))
if rule.IsTest {
out.w(" bazel --batch test --verbose_failures --test_output=errors --disk_cache=%s../../bazel-disk-cache //...", strings.Repeat("../", langDepth))
} else {
out.w(" bazel --batch build --verbose_failures --disk_cache=%s../../bazel-disk-cache //...", strings.Repeat("../", langDepth))
}
out.ln()
}

View File

@ -79,6 +79,9 @@ type Rule struct {
// Platforms for which to skip testing this rule, overrides language level
// The special value 'all' will skip app platforms
SkipTestPlatforms []string
// If the rule is a test rule
IsTest bool
}
// Flag captures information about a bazel build flag.
@ -95,6 +98,7 @@ type Attr struct {
Default string
Doc string
Mandatory bool
Providers []string
}
// Templating types