Documentation
¶
Overview ¶
package rules is used find and modify Bazel rules in WORKSPACE and bzl files.
Index ¶
- Variables
- func AddURLs(rule *build.Rule, urls []string)
- func Check(rule *build.Rule) (validationErrs []error)
- func GetHash(rule *build.Rule) (string, error)
- func GetURLs(rule *build.Rule) []string
- func HasMirrorURL(rule *build.Rule) bool
- func Normalize(rule *build.Rule) (changed bool)
- func PrepareUpgrade(rule *build.Rule) (changed bool, err error)
- func Rules(file *build.File, filter []string) (rules []*build.Rule)
- func SetHash(rule *build.Rule, hash string)
- func UpstreamURLs(rule *build.Rule) (urls []string, err error)
- func ValidatePinned(rule *build.Rule) (validationErrs []error)
Constants ¶
This section is empty.
Variables ¶
var ( // SupportedRules is a list of all rules that can be mirrored. SupportedRules = []string{ "http_archive", "http_file", "rpm", } // ErrNoUpstreamURL is returned when a rule has no upstream URL. ErrNoUpstreamURL = errors.New("rule has no upstream URL") )
Functions ¶
func Check ¶
Check checks if a dependency rule is normalized and contains a mirror url. All errors reported by this function can be fixed by calling AddURLs and Normalize.
func HasMirrorURL ¶
HasMirrorURL returns true if the rule has a url from the Edgeless mirror with the correct hash.
func PrepareUpgrade ¶
PrepareUpgrade prepares a rule for an upgrade by removing all urls that are not upstream urls. and removing the hash attribute. it returns true if the rule was changed.
func Rules ¶
Rules is used to find and modify Bazel rules of a set of rule kinds in WORKSPACE and .bzl files. Filter is a list of rule kinds to consider. If filter is empty, all rules are considered.
func UpstreamURLs ¶
UpstreamURLs returns the upstream urls (non-mirror urls) of a rule.
func ValidatePinned ¶
ValidatePinned checks if the given rule is a pinned dependency rule. That is, if it has a name, either a url or urls attribute, and a sha256 attribute.
Types ¶
This section is empty.