Skip to content

Commit

Permalink
Add output_mode attr to select where files are written to
Browse files Browse the repository at this point in the history
  • Loading branch information
aaliddell committed Sep 20, 2021
1 parent d143d46 commit eb9cd33
Show file tree
Hide file tree
Showing 24 changed files with 395 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ proto_plugin(
proto_plugin(
name = "template_plugin",
out = "{name}",
separate_options_flag = True,
quirks = [
"QUIRK_OUT_PASS_ROOT",
"QUIRK_DIRECT_MODE",
],
separate_options_flag = True,
tool = select({
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_doc_darwin_x86_64//:protoc-gen-doc",
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_doc_linux_x86_64//:protoc-gen-doc",
Expand Down
5 changes: 3 additions & 2 deletions doc/doc_template_compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load(
"proto_compile_attrs",
"proto_compile_impl",
)
load("//internal:compile.bzl", "proto_compile",)
load("//internal:compile.bzl", "proto_compile")

# Create compile rule
def doc_template_compile_impl(ctx):
Expand All @@ -21,7 +21,8 @@ def doc_template_compile_impl(ctx):

# Mutate args with template
options["*"] = [
ctx.file.template.path, ctx.attr.name
ctx.file.template.path,
ctx.attr.name,
]
extra_protoc_files += [ctx.file.template]

Expand Down
20 changes: 20 additions & 0 deletions docs/lang/android.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -212,6 +217,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -330,6 +340,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down Expand Up @@ -444,6 +459,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down
10 changes: 10 additions & 0 deletions docs/lang/c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -203,6 +208,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down
20 changes: 20 additions & 0 deletions docs/lang/cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -198,6 +203,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -292,6 +302,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down Expand Up @@ -428,6 +443,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down
20 changes: 20 additions & 0 deletions docs/lang/csharp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -233,6 +238,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -345,6 +355,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down Expand Up @@ -453,6 +468,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down
10 changes: 10 additions & 0 deletions docs/lang/d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -207,3 +212,8 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
28 changes: 27 additions & 1 deletion docs/lang/doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -201,6 +206,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -292,6 +302,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -383,6 +398,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -420,7 +440,8 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
load("@rules_proto_grpc//doc:defs.bzl", "doc_template_compile")
doc_template_compile(
name = "greeter_doc_proto",
name = "greeter_doc_proto.txt",
output_mode = "NO_PREFIX",
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:thing_proto",
Expand Down Expand Up @@ -470,6 +491,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``template``
- ``label``
- true
Expand Down
20 changes: 20 additions & 0 deletions docs/lang/fsharp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -233,6 +238,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.

Plugins
*******
Expand Down Expand Up @@ -344,6 +354,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down Expand Up @@ -452,6 +467,11 @@ Attributes
- false
- ``[]``
- List of labels that provide extra files to be available during protoc execution
* - ``output_mode``
- ``string``
- false
- ``PREFIXED``
- The output mode for the target. PREFIXED will output to a directory named by the target, NO_PREFIX will output to the current package.
* - ``deps``
- ``label_list``
- false
Expand Down
Loading

0 comments on commit eb9cd33

Please sign in to comment.