Documentation
¶
Index ¶
- func NewLanguage() language.Language
- type Config
- type ProtoGoModulesLanguage
- func (l *ProtoGoModulesLanguage) ApparentLoads(moduleToApparentName func(string) string) []rule.LoadInfo
- func (l *ProtoGoModulesLanguage) CheckFlags(fs *flag.FlagSet, c *config.Config) error
- func (l *ProtoGoModulesLanguage) Configure(c *config.Config, rel string, f *rule.File)
- func (*ProtoGoModulesLanguage) Embeds(r *rule.Rule, from label.Label) []label.Label
- func (*ProtoGoModulesLanguage) Fix(c *config.Config, f *rule.File)
- func (l *ProtoGoModulesLanguage) GenerateRules(args language.GenerateArgs) language.GenerateResult
- func (l *ProtoGoModulesLanguage) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec
- func (l ProtoGoModulesLanguage) IndexKinds() map[string]bool
- func (l *ProtoGoModulesLanguage) Kinds() map[string]rule.KindInfo
- func (*ProtoGoModulesLanguage) KnownDirectives() []string
- func (l ProtoGoModulesLanguage) LoadName() string
- func (l *ProtoGoModulesLanguage) Loads() []rule.LoadInfo
- func (l *ProtoGoModulesLanguage) Name() string
- func (l *ProtoGoModulesLanguage) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config)
- func (l *ProtoGoModulesLanguage) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, r *rule.Rule, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLanguage ¶
Types ¶
type ProtoGoModulesLanguage ¶
type ProtoGoModulesLanguage struct {
// contains filtered or unexported fields
}
ProtoGoModulesLanguage implements language.Language.
func (*ProtoGoModulesLanguage) ApparentLoads ¶
func (l *ProtoGoModulesLanguage) ApparentLoads(moduleToApparentName func(string) string) []rule.LoadInfo
ApparentLoads implements the optional interface language.ModuleAwareLanguage
func (*ProtoGoModulesLanguage) CheckFlags ¶
func (*ProtoGoModulesLanguage) Embeds ¶
Embeds returns a list of labels of rules that the given rule embeds. If a rule is embedded by another importable rule of the same language, only the embedding rule will be indexed. The embedding rule will inherit the imports of the embedded rule. Since SkyLark doesn't support embedding this should always return nil.
func (*ProtoGoModulesLanguage) Fix ¶
func (*ProtoGoModulesLanguage) Fix(c *config.Config, f *rule.File)
Fix repairs deprecated usage of language-specific rules in f. This is called before the file is indexed. Unless c.ShouldFix is true, fixes that delete or rename rules should not be performed.
func (*ProtoGoModulesLanguage) GenerateRules ¶
func (l *ProtoGoModulesLanguage) GenerateRules(args language.GenerateArgs) language.GenerateResult
GenerateRules extracts build metadata from source files in a directory. GenerateRules is called in each directory where an update is requested in depth-first post-order.
args contains the arguments for GenerateRules. This is passed as a struct to avoid breaking implementations in the future when new fields are added.
A GenerateResult struct is returned. Optional fields may be added to this type in the future.
Any non-fatal errors this function encounters should be logged using log.Print.
func (*ProtoGoModulesLanguage) Imports ¶
func (l *ProtoGoModulesLanguage) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec
Imports returns a list of ImportSpecs that can be used to import the rule r. This is used to populate RuleIndex.
If nil is returned, the rule will not be indexed. If any non-nil slice is returned, including an empty slice, the rule will be indexed.
func (ProtoGoModulesLanguage) IndexKinds ¶
func (l ProtoGoModulesLanguage) IndexKinds() map[string]bool
func (*ProtoGoModulesLanguage) Kinds ¶
func (l *ProtoGoModulesLanguage) Kinds() map[string]rule.KindInfo
Kinds returns a map of maps rule names (kinds) and information on how to match and merge attributes that may be found in rules of those kinds. All kinds of rules generated for this language may be found here.
func (*ProtoGoModulesLanguage) KnownDirectives ¶
func (*ProtoGoModulesLanguage) KnownDirectives() []string
func (ProtoGoModulesLanguage) LoadName ¶
func (l ProtoGoModulesLanguage) LoadName() string
func (*ProtoGoModulesLanguage) Loads ¶
func (l *ProtoGoModulesLanguage) Loads() []rule.LoadInfo
Loads returns .bzl files and symbols they define. Every rule generated by GenerateRules, now or in the past, should be loadable from one of these files.
func (*ProtoGoModulesLanguage) Name ¶
func (l *ProtoGoModulesLanguage) Name() string
Name returns the name of the language. This should be a prefix of the kinds of rules generated by the language, e.g., "go" for the Go extension since it generates "go_library" rules.
func (*ProtoGoModulesLanguage) RegisterFlags ¶
The following methods are implemented to satisfy the https://pkg.go.dev/github.com/bazelbuild/bazel-gazelle/resolve?tab=doc#Resolver interface, but are otherwise unused.
func (*ProtoGoModulesLanguage) Resolve ¶
func (l *ProtoGoModulesLanguage) Resolve( c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, r *rule.Rule, importsRaw any, from label.Label, )
Resolve translates imported libraries for a given rule into Bazel dependencies. Information about imported libraries is returned for each rule generated by language.GenerateRules in language.GenerateResult.Imports. Resolve generates a "deps" attribute (or the appropriate language-specific equivalent) for each import according to language-specific rules and heuristics.