Documentation

Edit

ProtoInfo

check_deps_sources

depset ProtoInfo.check_deps_sources

Proto sources from the 'srcs' attribute. If the library is a proxy library that has no sources, it contains the check_deps_sources from this library's direct deps.

direct_descriptor_set

File ProtoInfo.direct_descriptor_set

The FileDescriptorSet of the direct sources. If no srcs, contains an empty file.

direct_sources

list ProtoInfo.direct_sources

Proto sources from the 'srcs' attribute.

proto_source_root

string ProtoInfo.proto_source_root

The directory relative to which the .proto files defined in the proto_library are defined. For example, if this is 'a/b' and the rule has the file 'a/b/c/d.proto' as a source, that source file would be imported as 'import c/d.proto'

to_json

string ProtoInfo.to_json()

Creates a JSON string from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs, a list of these types or a dictionary with string keys and values of these types. Quotes and new lines in strings are escaped. Examples:
struct(key=123).to_json()
# {"key":123}

struct(key=True).to_json()
# {"key":true}

struct(key=[1, 2, 3]).to_json()
# {"key":[1,2,3]}

struct(key='text').to_json()
# {"key":"text"}

struct(key=struct(inner_key='text')).to_json()
# {"key":{"inner_key":"text"}}

struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_json()
# {"key":[{"inner_key":1},{"inner_key":2}]}

struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_json()
# {"key":{"inner_key":{"inner_inner_key":"text"}}}

to_proto

string ProtoInfo.to_proto()

Creates a text message from the struct parameter. This method only works if all struct elements (recursively) are strings, ints, booleans, other structs or a list of these types. Quotes and new lines in strings are escaped. Keys are iterated in the sorted order. Examples:
struct(key=123).to_proto()
# key: 123

struct(key=True).to_proto()
# key: true

struct(key=[1, 2, 3]).to_proto()
# key: 1
# key: 2
# key: 3

struct(key='text').to_proto()
# key: "text"

struct(key=struct(inner_key='text')).to_proto()
# key {
#   inner_key: "text"
# }

struct(key=[struct(inner_key=1), struct(inner_key=2)]).to_proto()
# key {
#   inner_key: 1
# }
# key {
#   inner_key: 2
# }

struct(key=struct(inner_key=struct(inner_inner_key='text'))).to_proto()
# key {
#    inner_key {
#     inner_inner_key: "text"
#   }
# }

transitive_descriptor_sets

depset ProtoInfo.transitive_descriptor_sets

A set of FileDescriptorSet files of all dependent proto_library rules, and this one's. This is not the same as passing --include_imports to proto-compiler. Will be empty if no dependencies.

transitive_imports

depset ProtoInfo.transitive_imports

Transitive imports including weak dependencies.

transitive_proto_path

depset ProtoInfo.transitive_proto_path

A set of proto source roots collected from the transitive closure of this rule.

transitive_sources

depset ProtoInfo.transitive_sources

Proto sources for this rule and all its dependent protocol buffer rules.