Documentation
¶
Overview ¶
Package merger provides methods for merging parsed BUILD files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckGazelleLoaded ¶ added in v0.11.0
CheckGazelleLoaded searches the given WORKSPACE file for a repository named "bazel_gazelle". If no such repository is found *and* the repo is not declared with a directive *and* at least one load statement mentions the repository, a descriptive error will be returned.
This should be called after modifications have been made to WORKSPACE (i.e., after FixLoads) before writing it to disk.
func FixLoads ¶
FixLoads removes loads of unused go rules and adds loads of newly used rules. This should be called after FixFile and MergeFile, since symbols may be introduced that aren't loaded.
This function calls File.Sync before processing loads.
func FixWorkspace ¶ added in v0.11.0
FixWorkspace updates rules in the WORKSPACE file f that were used with an older version of rules_go or gazelle.
func MergeFile ¶
func MergeFile(oldFile *rule.File, emptyRules, genRules []*rule.Rule, phase Phase, kinds map[string]rule.KindInfo)
MergeFile merges the rules in genRules with matching rules in f and adds unmatched rules to the end of the merged file. MergeFile also merges rules in empty with matching rules in f and deletes rules that are empty after merging. attrs is the set of attributes to merge. Attributes not in this set will be left alone if they already exist.
Types ¶
type Phase ¶ added in v0.13.0
type Phase int
Phase indicates which attributes should be merged in matching rules.
The pre-resolve merge is performed before rules are indexed for dependency resolution. All attributes not related to dependencies are merged. This merge must be performed indexing because attributes related to indexing (e.g., srcs, importpath) will be affected.
The post-resolve merge is performed after rules are indexed. All attributes related to dependencies are merged.