Documentation ¶
Overview ¶
Package bazel contains types representing Bazel concepts, such as packages and rules.
Index ¶
- type Label
- type Package
- type PackageGroup
- type Rule
- func (r *Rule) BoolAttr(attrName string, defaultValue bool) bool
- func (r *Rule) IntAttr(attrName string, defaultValue int) int
- func (r *Rule) Label() Label
- func (r *Rule) LabelAttr(attrName string) (Label, error)
- func (r *Rule) LabelListAttr(attrName string) []Label
- func (r *Rule) Name() string
- func (r *Rule) StringListAttr(attrName string) []string
- type UnknownAttributeValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Label ¶
type Label string
Label is a rule's label, e.g. //foo:bar.
func ParseAbsoluteLabel ¶
ParseAbsoluteLabel parses a label string in absolute form, such as "//aaa/bbb:ccc/ddd" or "//aaa/bbb".
See https://bazel.build/versions/master/docs/build-ref.html#labels.
func ParseRelativeLabel ¶
ParseRelativeLabel parses a label, not necessarily absolute, relative to some package.
If the label is absolute, for instance "//a/b" or "//a/b:c", the result is the same as ParseAbsoluteLabel. If the label is relative, for instance ":foo" or "bar.go", the result is the same as ParseAbsoluteLabel on "//pkg:foo" or "//pkg:bar.go", respectively.
type Package ¶
type Package struct { Path string DefaultVisibility []Label Files map[string]string Rules map[string]*Rule // maps rule name to Rule PackageGroups map[string]*PackageGroup }
Package represents a Bazel Package.
type PackageGroup ¶
type PackageGroup struct { // Package specs, e.g. foo/bar, foo/... or //... in case the user wrote "//foo/bar", "//foo/..." and "//..." respectively. // (//foo:bar is illegal) Specs []string // Includes of package_group. Includes []Label }
PackageGroup represents a package_group() function call in a BUILD file.
type Rule ¶
type Rule struct { Schema string // string representing the type of rule for example java_library PkgName string // name of the containing package, e.g. "src/main/java/" Attrs map[string]interface{} // map from type of attr i.e. srcs or export to the actual content name of srcs and exports }
Rule represents a Bazel Rule.
func (*Rule) BoolAttr ¶
BoolAttr converts the attributes of a rule from an interface type to a boolean. If the attribute value is not a boolean, BoolAttr returns defaultValue.
func (*Rule) IntAttr ¶
IntAttr converts the attributes of a rule from an interface type to a boolean. If the attribute value is not a boolean, IntAttr returns defaultValue.
func (*Rule) LabelAttr ¶
LabelAttr converts the attributes of a rule from an interface type to a string. If the attribute value is not a label, LabelAttr returns an error.
func (*Rule) LabelListAttr ¶
LabelListAttr converts the attributes of a rule from an interface type to a list of labels. If the attribute value is not a strict list (e.g., a selector), LabelListAttr returns the empty list.
func (*Rule) StringListAttr ¶
StringListAttr converts the attributes of a rule from an interface type to a list of strings. If the attribute value is not a strict list (e.g., a selector), StringListAttr returns the empty list.
type UnknownAttributeValue ¶
type UnknownAttributeValue struct{}
UnknownAttributeValue is used as a value in Rule.Attrs to represent an attribute that is present, but whose value we can't represent. For example, 'deps = select(...)' will be represented this way. The value itself is meaningless.
func (UnknownAttributeValue) String ¶
func (v UnknownAttributeValue) String() string