forked from rules-proto-grpc/rules_proto_grpc
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add doc_template_compile, closes rules-proto-grpc#121
- Loading branch information
Showing
65 changed files
with
741 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Generated definition of doc_template_compile.""" | ||
|
||
load( | ||
"//:defs.bzl", | ||
"ProtoPluginInfo", | ||
"proto_compile_attrs", | ||
"proto_compile_impl", | ||
) | ||
load("//internal:compile.bzl", "proto_compile",) | ||
|
||
# Create compile rule | ||
def doc_template_compile_impl(ctx): | ||
# Load attrs that we pass as args | ||
options = ctx.attr.options | ||
extra_protoc_args = getattr(ctx.attr, "extra_protoc_args", []) | ||
extra_protoc_files = ctx.files.extra_protoc_files | ||
|
||
# Make mutable | ||
options = {k: v for (k, v) in options.items()} | ||
extra_protoc_files = [] + extra_protoc_files | ||
|
||
# Mutate args with template | ||
options["*"] = [ | ||
ctx.file.template.path, ctx.attr.name | ||
] | ||
extra_protoc_files += [ctx.file.template] | ||
|
||
# Execute with extracted attrs | ||
return proto_compile(ctx, options, extra_protoc_args, extra_protoc_files) | ||
|
||
doc_template_compile = rule( | ||
implementation = doc_template_compile_impl, | ||
attrs = dict( | ||
proto_compile_attrs, | ||
template = attr.label( | ||
allow_single_file = True, | ||
doc = "The documentation template file.", | ||
), | ||
_plugins = attr.label_list( | ||
providers = [ProtoPluginInfo], | ||
default = [ | ||
Label("//doc:template_plugin"), | ||
], | ||
doc = "List of protoc plugins to apply", | ||
), | ||
), | ||
toolchains = [str(Label("//protobuf:toolchain_type"))], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.