noop

package
v0.0.0-...-5428336 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoOpLanguage

type NoOpLanguage struct {
	// contains filtered or unexported fields
}

NoOpLanguage implements language.Language.

func NewNoOpLanguage

func NewNoOpLanguage(name string) *NoOpLanguage

NewNoOpLanguage create a new NoOpLanguage Gazelle extension implementation.

func (*NoOpLanguage) CheckFlags

func (*NoOpLanguage) CheckFlags(fs *flag.FlagSet, c *config.Config) error

func (*NoOpLanguage) Configure

func (pl *NoOpLanguage) Configure(c *config.Config, rel string, f *rule.File)

Configure implements config.Configurer

func (*NoOpLanguage) Embeds

func (*NoOpLanguage) Embeds(r *rule.Rule, from label.Label) []label.Label

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 (*NoOpLanguage) Fix

func (*NoOpLanguage) 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 (*NoOpLanguage) GenerateRules

func (pl *NoOpLanguage) 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 (*NoOpLanguage) Imports

func (pl *NoOpLanguage) 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 (*NoOpLanguage) Kinds

func (*NoOpLanguage) 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 (*NoOpLanguage) KnownDirectives

func (*NoOpLanguage) KnownDirectives() []string

func (*NoOpLanguage) Loads

func (pl *NoOpLanguage) 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 (*NoOpLanguage) Name

func (pl *NoOpLanguage) 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 (*NoOpLanguage) RegisterFlags

func (*NoOpLanguage) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config)

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 (*NoOpLanguage) Resolve

func (pl *NoOpLanguage) Resolve(
	c *config.Config,
	ix *resolve.RuleIndex,
	rc *repo.RemoteCache,
	r *rule.Rule,
	importsRaw interface{},
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL