proto_lang_toolchain(name,blacklisted_protos,command_line,compatible_with,deprecation,distribs,exec_compatible_with,exec_properties,features,licenses,plugin,plugin_format_flag,restricted_to,runtime,tags,target_compatible_with,testonly,visibility)
Deprecated. Please https://github.com/bazelbuild/rules_proto instead.
Specifies how a LANG_proto_library rule (e.g.,java_proto_library) should invoke theproto-compiler.Some LANG_proto_library rules allow specifying which toolchain to use using command-line flags;consult their documentation.
Normally you should not write those kind of rules unless you want totune your Java compiler.
There's no compiler. The proto-compiler is taken from the proto_library rule we attach to. It ispassed as a command-line flag to Bazel.Several features require a proto-compiler to be invoked on the proto_library rule itself.It's beneficial to enforce the compiler that LANG_proto_library uses is the same as the oneproto_library does.
A simple example would be:
proto_lang_toolchain( name = "javalite_toolchain", command_line = "--javalite_out=shared,immutable:$(OUT)", plugin = ":javalite_plugin", runtime = ":protobuf_lite",)
| Attributes | |
|---|---|
name |
A unique name for this target. |
blacklisted_protos |
srcs attribute ofblacklisted_protos. This is used for .proto files that are already linked into proto runtimes, such asany.proto. |
command_line |
|
plugin |
--plugin=protoc-gen-PLUGIN= |
plugin_format_flag |
--plugin=protoc-gen-PLUGIN= |
runtime |
|
proto_library(name,deps,srcs,data,compatible_with,deprecation,distribs,exec_compatible_with,exec_properties,exports,features,import_prefix,licenses,restricted_to,strip_import_prefix,tags,target_compatible_with,testonly,visibility)
Deprecated. Please use https://github.com/bazelbuild/rules_proto instead.
Useproto_library to define libraries of protocol buffers which may be used from multiple languages. Aproto_library may be listed in thedeps clause of supported rules, such asjava_proto_library.
When compiled on the command-line, aproto_library creates a file namedfoo-descriptor-set.proto.bin, which is the descriptor set for the messages the rule srcs. The file is a serializedFileDescriptorSet, which is described in https://developers.google.com/protocol-buffers/docs/techniques#self-description.
It only contains information about the.proto files directly mentioned by aproto_library rule; the collection of transitive descriptor sets is available throughthe[ProtoInfo].transitive_descriptor_sets Starlark provider.See documentation inProtoInfo.java.
Recommended code organization:
proto_library rule per.proto file.foo.proto will be in a rule namedfoo_proto, which is located in the same package.[language]_proto_library that wraps aproto_library namedfoo_proto should be calledfoo_[language]_proto, and be located in the same package.| Attributes | |
|---|---|
name |
A unique name for this target. |
deps |
proto_library rules that the target depends upon. Aproto_library may only depend on otherproto_library targets. It may not depend on language-specific libraries. |
srcs |
.proto and.protodevel files that are processed to create the target. This is usually a non empty list. One usecase wheresrcs can be empty is analias-library. This is a proto_library rule having one or more other proto_library indeps. This pattern can be used to e.g. export a public api under a persistent name. |
exports |
|
import_prefix |
When set, the .proto source files in the The prefix in the |
strip_import_prefix |
When set, .proto source files in the If it's a relative path (not starting with a slash), it's taken as a package-relative one. If it's an absolute one, it's understood as a repository-relative path. The prefix in the |