scalaconfig

package
v0.0.0-...-2de8142 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugUnknown debugAnnotation = 0
	DebugImports debugAnnotation = 1
	DebugExports debugAnnotation = 2
	DebugDeps    debugAnnotation = 3
	DebugRule    debugAnnotation = 4
)

Variables

This section is empty.

Functions

func AnnotateImports

func AnnotateImports(imports resolver.ImportMap, comments *build.Comments, prefix string)

func DirectiveNames

func DirectiveNames() []string

Types

type Config

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

Config represents the config extension for the a scala package.

func Get

func Get(config *config.Config) *Config

Get returns the scala config. Can be nil.

func GetOrCreate

func GetOrCreate(universe resolver.Universe, config *config.Config, rel string) *Config

getOrCreateScalaConfig either inserts a new config into the map under the language name or replaces it with a clone.

func New

func New(universe resolver.Universe, config *config.Config, rel string) *Config

newScalaConfig initializes a new Config.

func NewTestScalaConfig

func NewTestScalaConfig(t *testing.T, universe resolver.Universe, rel string, dd ...rule.Directive) (*Config, error)

func (*Config) Comment

func (c *Config) Comment() build.Comment

func (*Config) Config

func (c *Config) Config() *config.Config

Config returns the parent gazelle configuration

func (*Config) ConfiguredRules

func (c *Config) ConfiguredRules() []*scalarule.Config

ConfiguredRules returns an ordered list of configured rules

func (*Config) Exports

func (c *Config) Exports(exports resolver.ImportMap, r *rule.Rule, attrName string, from label.Label)

func (*Config) GetImplicitImports

func (c *Config) GetImplicitImports(lang, imp string) (deps []string)

func (*Config) GetKnownRule

func (c *Config) GetKnownRule(from label.Label) (*rule.Rule, bool)

GetKnownRule translates relative labels into their absolute form.

func (*Config) Imports

func (c *Config) Imports(imports resolver.ImportMap, r *rule.Rule, attrName string, from label.Label)

func (*Config) MaybeRewrite

func (c *Config) MaybeRewrite(kind string, from label.Label) label.Label

MaybeRewrite takes a rule kind and a from label and possibly transforms the label name based on the configuration of label name rewrites. For example, consider a rule macro `my_scala_app` having a label name ':app', and a file Helper.scala, and the definition of the macro passes `srcs` to an an internal scala_library named ':lib' (that includes Helper.scala). For other scala rules that import 'Helper', we want to depend on `//somepkg:lib` rather than `somepkg:app`.

func (*Config) ParseDirectives

func (c *Config) ParseDirectives(directives []rule.Directive) (err error)

parseDirectives is called in each directory visited by gazelle. The relative directory name is given by 'rel' and the list of directives in the BUILD file are specified by 'directives'.

func (*Config) Rel

func (c *Config) Rel() string

Rel returns the parent gazelle relative path

func (*Config) ResolveConflict

func (c *Config) ResolveConflict(r *rule.Rule, imports resolver.ImportMap, imp *resolver.Import, symbol *resolver.Symbol) (*resolver.Symbol, bool)

func (*Config) ShouldAnnotateImports

func (c *Config) ShouldAnnotateImports() bool

func (*Config) ShouldAnnotateRule

func (c *Config) ShouldAnnotateRule() bool

func (*Config) ShouldFixWildcardImport

func (c *Config) ShouldFixWildcardImport(filename, wimp string) bool

ShouldFixWildcardImport tests whether the given symbol name pattern should be resolved within the scope of the given filename pattern. resolveFileSymbolNameSpecs represent a whitelist; if no patterns match, false is returned.

func (*Config) ShouldResolveFileSymbolName

func (c *Config) ShouldResolveFileSymbolName(filename, name string) bool

ShouldResolveFileSymbolName tests whether the given symbol name pattern should be resolved within the scope of the given filename pattern. resolveFileSymbolNameSpecs represent a whitelist; if no patterns match, false is returned.

func (*Config) String

func (c *Config) String() string

Jump to

Keyboard shortcuts

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