Documentation
¶
Index ¶
- Constants
- func TargetExportComparator(a, b interface{}) int
- func TargetImportComparator(a, b interface{}) int
- type AddTargetAction
- type AnalyzeContext
- func (a AnalyzeContext) AddSymbol(label Label, symbol Symbol)
- func (a AnalyzeContext) Attr(name string) (starlark.Value, error)
- func (a AnalyzeContext) AttrNames() []string
- func (a AnalyzeContext) Freeze()
- func (a AnalyzeContext) Hash() (uint32, error)
- func (a AnalyzeContext) String() string
- func (a AnalyzeContext) Truth() starlark.Bool
- func (a AnalyzeContext) Type() string
- type AstQueryParams
- type Database
- type DeclareTargetActions
- type DeclareTargetsContext
- type DeclareTargetsResult
- type JsonQueryParams
- type KindInfo
- type Label
- type NamedQueries
- type Plugin
- type PluginHost
- type PluginId
- type PrepareContext
- func (ctx PrepareContext) Attr(name string) (starlark.Value, error)
- func (ctx PrepareContext) AttrNames() []string
- func (ctx PrepareContext) Freeze()
- func (ctx PrepareContext) Hash() (uint32, error)
- func (ctx PrepareContext) String() string
- func (ctx PrepareContext) Truth() starlark.Bool
- func (ctx PrepareContext) Type() string
- type PrepareResult
- func (r PrepareResult) Attr(name string) (starlark.Value, error)
- func (r PrepareResult) AttrNames() []string
- func (r PrepareResult) Freeze()
- func (r PrepareResult) Hash() (uint32, error)
- func (r PrepareResult) String() string
- func (r PrepareResult) Truth() starlark.Bool
- func (r PrepareResult) Type() string
- type Property
- type PropertyType
- type PropertyValues
- func (pv PropertyValues) Add(name string, value interface{})
- func (p PropertyValues) Freeze()
- func (p PropertyValues) Get(k starlark.Value) (v starlark.Value, found bool, err error)
- func (p PropertyValues) Hash() (uint32, error)
- func (p PropertyValues) String() string
- func (p PropertyValues) Truth() starlark.Bool
- func (p PropertyValues) Type() string
- type QueryCapture
- type QueryDefinition
- func (qd QueryDefinition) Attr(name string) (starlark.Value, error)
- func (qd QueryDefinition) AttrNames() []string
- func (qd QueryDefinition) Freeze()
- func (qd QueryDefinition) Hash() (uint32, error)
- func (q QueryDefinition) Match(f string) bool
- func (qd QueryDefinition) String() string
- func (qd QueryDefinition) Truth() starlark.Bool
- func (qd QueryDefinition) Type() string
- type QueryMatch
- type QueryMatches
- func (q QueryMatches) Freeze()
- func (q QueryMatches) Hash() (uint32, error)
- func (q QueryMatches) Index(i int) starlark.Value
- func (q QueryMatches) Iterate() starlark.Iterator
- func (q QueryMatches) Len() int
- func (q QueryMatches) String() string
- func (q QueryMatches) Truth() starlark.Bool
- func (q QueryMatches) Type() string
- type QueryProcessorResult
- type QueryResults
- type QueryType
- type RegexQueryParams
- type RemoveTargetAction
- type RuleKind
- type SourceExtensionsFilter
- func (r SourceExtensionsFilter) Attr(name string) (starlark.Value, error)
- func (r SourceExtensionsFilter) AttrNames() []string
- func (r SourceExtensionsFilter) Freeze()
- func (r SourceExtensionsFilter) Hash() (uint32, error)
- func (f SourceExtensionsFilter) Match(p string) bool
- func (r SourceExtensionsFilter) String() string
- func (r SourceExtensionsFilter) Truth() starlark.Bool
- func (r SourceExtensionsFilter) Type() string
- type SourceFileFilter
- func (r SourceFileFilter) Attr(name string) (starlark.Value, error)
- func (r SourceFileFilter) AttrNames() []string
- func (r SourceFileFilter) Freeze()
- func (r SourceFileFilter) Hash() (uint32, error)
- func (sf SourceFileFilter) Match(p string) bool
- func (r SourceFileFilter) String() string
- func (r SourceFileFilter) Truth() starlark.Bool
- func (r SourceFileFilter) Type() string
- type SourceFilter
- type SourceGlobFilter
- func (r SourceGlobFilter) Attr(name string) (starlark.Value, error)
- func (r SourceGlobFilter) AttrNames() []string
- func (r SourceGlobFilter) Freeze()
- func (r SourceGlobFilter) Hash() (uint32, error)
- func (f SourceGlobFilter) Match(p string) bool
- func (r SourceGlobFilter) String() string
- func (r SourceGlobFilter) Truth() starlark.Bool
- func (r SourceGlobFilter) Type() string
- type Symbol
- type TargetAction
- type TargetDeclaration
- type TargetImport
- func (ti TargetImport) Attr(name string) (starlark.Value, error)
- func (ti TargetImport) AttrNames() []string
- func (ti TargetImport) Freeze()
- func (ti TargetImport) Hash() (uint32, error)
- func (ti TargetImport) String() string
- func (ti TargetImport) Truth() starlark.Bool
- func (ti TargetImport) Type() string
- type TargetSource
- func (ctx TargetSource) Attr(name string) (starlark.Value, error)
- func (ctx TargetSource) AttrNames() []string
- func (TargetSource) Freeze()
- func (ts TargetSource) Hash() (uint32, error)
- func (ts TargetSource) String() string
- func (TargetSource) Truth() starlark.Bool
- func (TargetSource) Type() string
- type TargetSourceList
- func (t TargetSourceList) Freeze()
- func (t TargetSourceList) Hash() (uint32, error)
- func (t TargetSourceList) Index(i int) starlark.Value
- func (t TargetSourceList) Iterate() starlark.Iterator
- func (t TargetSourceList) Len() int
- func (t TargetSourceList) String() string
- func (t TargetSourceList) Truth() starlark.Bool
- func (t TargetSourceList) Type() string
- type TargetSources
- func (c TargetSources) Attr(name string) (starlark.Value, error)
- func (c TargetSources) AttrNames() []string
- func (c TargetSources) Freeze()
- func (c TargetSources) Hash() (uint32, error)
- func (ts TargetSources) Index(i int) starlark.Value
- func (ts TargetSources) Iterate() starlark.Iterator
- func (ts TargetSources) Len() int
- func (c TargetSources) String() string
- func (c TargetSources) Truth() starlark.Bool
- func (c TargetSources) Type() string
- type TargetSymbol
- func (te TargetSymbol) Attr(name string) (starlark.Value, error)
- func (te TargetSymbol) AttrNames() []string
- func (te TargetSymbol) Freeze()
- func (te TargetSymbol) Hash() (uint32, error)
- func (te TargetSymbol) String() string
- func (te TargetSymbol) Truth() starlark.Bool
- func (te TargetSymbol) Type() string
- type YamlQueryParams
Constants ¶
const ( QueryTypeAst QueryType = "ast" QueryTypeRegex = "regex" QueryTypeJson = "json" QueryTypeYaml = "yaml" QueryTypeRaw = "raw" )
const DeclareTargetsContextDefaultGroup = "default"
Variables ¶
This section is empty.
Functions ¶
func TargetExportComparator ¶
func TargetExportComparator(a, b interface{}) int
func TargetImportComparator ¶
func TargetImportComparator(a, b interface{}) int
Types ¶
type AddTargetAction ¶
type AddTargetAction struct {
TargetAction
TargetDeclaration
}
type AnalyzeContext ¶
type AnalyzeContext struct {
PrepareContext
Source *TargetSource
// contains filtered or unexported fields
}
func NewAnalyzeContext ¶
func NewAnalyzeContext(prep PrepareContext, source *TargetSource, database *Database) AnalyzeContext
func (AnalyzeContext) AddSymbol ¶
func (a AnalyzeContext) AddSymbol(label Label, symbol Symbol)
func (AnalyzeContext) AttrNames ¶
func (a AnalyzeContext) AttrNames() []string
func (AnalyzeContext) Freeze ¶
func (a AnalyzeContext) Freeze()
func (AnalyzeContext) Hash ¶
func (a AnalyzeContext) Hash() (uint32, error)
func (AnalyzeContext) String ¶
func (a AnalyzeContext) String() string
func (AnalyzeContext) Truth ¶
func (a AnalyzeContext) Truth() starlark.Bool
func (AnalyzeContext) Type ¶
func (a AnalyzeContext) Type() string
type AstQueryParams ¶
type Database ¶
type Database struct {
Symbols []TargetSymbol
// contains filtered or unexported fields
}
type DeclareTargetActions ¶
type DeclareTargetActions interface {
Add(target TargetDeclaration)
Remove(name, kind string)
Actions() []TargetAction
}
func NewDeclareTargetActions ¶
func NewDeclareTargetActions() DeclareTargetActions
type DeclareTargetsContext ¶
type DeclareTargetsContext struct {
PrepareContext
Sources TargetSources
Targets DeclareTargetActions
// contains filtered or unexported fields
}
The context for an extension to generate targets.
Queries results are mapped by file extension, each containing a map of query name to result.
func NewDeclareTargetsContext ¶
func NewDeclareTargetsContext(prep PrepareContext, sources TargetSources, targets DeclareTargetActions, database *Database) DeclareTargetsContext
func (DeclareTargetsContext) AddSymbol ¶
func (d DeclareTargetsContext) AddSymbol(label Label, symbol Symbol)
func (DeclareTargetsContext) Attr ¶
func (ctx DeclareTargetsContext) Attr(name string) (starlark.Value, error)
func (DeclareTargetsContext) AttrNames ¶
func (ctx DeclareTargetsContext) AttrNames() []string
func (DeclareTargetsContext) String ¶
func (ctx DeclareTargetsContext) String() string
func (DeclareTargetsContext) Type ¶
func (ctx DeclareTargetsContext) Type() string
type DeclareTargetsResult ¶
type DeclareTargetsResult struct {
Actions []TargetAction
}
The result of declaring targets
type JsonQueryParams ¶
type JsonQueryParams = string
type KindInfo ¶
type KindInfo struct {
// MatchAny is true if a rule of this kind may be matched with any rule
// of the same kind, regardless of attributes, if exactly one rule is
// present a build file.
MatchAny bool
// MatchAttrs is a list of attributes used in matching. For example,
// for go_library, this list contains "importpath". Attributes are matched
// in order.
MatchAttrs []string
// NonEmptyAttrs is a set of attributes that, if present, disqualify a rule
// from being deleted after merge.
NonEmptyAttrs []string
// MergeableAttrs is a set of attributes that should be merged before
// dependency resolution. For example "srcs" are often merged before resolution
// to compute the full set of sources for a target before resolving dependencies.
MergeableAttrs []string
// ResolveAttrs is a set of attributes that should be merged after
// dependency resolution. For example "deps" are often merged after resolution.
ResolveAttrs []string
}
Subset of the bazel-gazelle rule.KindInfo. See bazel-gazelle for details.
type NamedQueries ¶
type NamedQueries map[string]QueryDefinition
A set of queries keyed by name.
func (NamedQueries) Freeze ¶
func (nq NamedQueries) Freeze()
func (NamedQueries) Hash ¶
func (nq NamedQueries) Hash() (uint32, error)
func (NamedQueries) String ¶
func (nq NamedQueries) String() string
func (NamedQueries) Truth ¶
func (nq NamedQueries) Truth() starlark.Bool
func (NamedQueries) Type ¶
func (nq NamedQueries) Type() string
type Plugin ¶
type Plugin interface {
// Static plugin metadata
Name() PluginId
Properties() map[string]Property
// Prepare for generating targets
Prepare(ctx PrepareContext) PrepareResult
Analyze(ctx AnalyzeContext) error
DeclareTargets(ctx DeclareTargetsContext) DeclareTargetsResult
}
TODO: change the interface into a factory method (at least in starzelle)
type PluginHost ¶
type PrepareContext ¶
type PrepareContext struct {
RepoName string
Rel string
Properties PropertyValues
}
The context for an extension to prepare for generating targets.
func (PrepareContext) AttrNames ¶
func (ctx PrepareContext) AttrNames() []string
func (PrepareContext) Freeze ¶
func (ctx PrepareContext) Freeze()
func (PrepareContext) Hash ¶
func (ctx PrepareContext) Hash() (uint32, error)
func (PrepareContext) String ¶
func (ctx PrepareContext) String() string
func (PrepareContext) Truth ¶
func (ctx PrepareContext) Truth() starlark.Bool
func (PrepareContext) Type ¶
func (ctx PrepareContext) Type() string
type PrepareResult ¶
type PrepareResult struct {
Sources map[string][]SourceFilter
Queries NamedQueries
}
The result of an extension preparing for generating targets.
Queries are mapped by file extension and will be executed against all matching extensions.
Example:
PrepareResult {
Extensions: [".java"],
Queries: {
"imports": {
"Type": "string|strings|exists",
"Extensions": ["*.java"],
"Query": "(import_list)",
},
},
}
func (PrepareResult) AttrNames ¶
func (r PrepareResult) AttrNames() []string
func (PrepareResult) Freeze ¶
func (r PrepareResult) Freeze()
func (PrepareResult) Hash ¶
func (r PrepareResult) Hash() (uint32, error)
func (PrepareResult) String ¶
func (r PrepareResult) String() string
func (PrepareResult) Truth ¶
func (r PrepareResult) Truth() starlark.Bool
func (PrepareResult) Type ¶
func (r PrepareResult) Type() string
type Property ¶
type Property struct {
Name string // TODO: drop because it's always specified in a map[Name]?
PropertyType PropertyType
Default interface{}
}
Properties an extension can be configured
type PropertyType ¶
type PropertyType = string
const ( PropertyType_String PropertyType = "string" PropertyType_Strings PropertyType = "[]string" PropertyType_Bool PropertyType = "bool" PropertyType_Number PropertyType = "number" )
type PropertyValues ¶
type PropertyValues struct {
// contains filtered or unexported fields
}
func NewPropertyValues ¶
func NewPropertyValues() PropertyValues
func (PropertyValues) Add ¶
func (pv PropertyValues) Add(name string, value interface{})
func (PropertyValues) Freeze ¶
func (p PropertyValues) Freeze()
func (PropertyValues) Hash ¶
func (p PropertyValues) Hash() (uint32, error)
func (PropertyValues) String ¶
func (p PropertyValues) String() string
func (PropertyValues) Truth ¶
func (p PropertyValues) Truth() starlark.Bool
func (PropertyValues) Type ¶
func (p PropertyValues) Type() string
type QueryCapture ¶
The captures of a single query match
func (*QueryCapture) Freeze ¶
func (q *QueryCapture) Freeze()
func (*QueryCapture) Hash ¶
func (q *QueryCapture) Hash() (uint32, error)
func (*QueryCapture) String ¶
func (q *QueryCapture) String() string
func (*QueryCapture) Truth ¶
func (q *QueryCapture) Truth() starlark.Bool
func (*QueryCapture) Type ¶
func (q *QueryCapture) Type() string
type QueryDefinition ¶
A query to run on source files
func (QueryDefinition) AttrNames ¶
func (qd QueryDefinition) AttrNames() []string
func (QueryDefinition) Freeze ¶
func (qd QueryDefinition) Freeze()
func (QueryDefinition) Hash ¶
func (qd QueryDefinition) Hash() (uint32, error)
func (QueryDefinition) Match ¶
func (q QueryDefinition) Match(f string) bool
func (QueryDefinition) String ¶
func (qd QueryDefinition) String() string
func (QueryDefinition) Truth ¶
func (qd QueryDefinition) Truth() starlark.Bool
func (QueryDefinition) Type ¶
func (qd QueryDefinition) Type() string
type QueryMatch ¶
type QueryMatch struct {
Result interface{}
Captures QueryCapture
}
A single match.
func NewQueryMatch ¶
func NewQueryMatch(captures QueryCapture, result interface{}) QueryMatch
func (*QueryMatch) AttrNames ¶
func (q *QueryMatch) AttrNames() []string
func (*QueryMatch) Freeze ¶
func (q *QueryMatch) Freeze()
func (*QueryMatch) Hash ¶
func (q *QueryMatch) Hash() (uint32, error)
func (*QueryMatch) String ¶
func (q *QueryMatch) String() string
func (*QueryMatch) Truth ¶
func (q *QueryMatch) Truth() starlark.Bool
func (*QueryMatch) Type ¶
func (q *QueryMatch) Type() string
type QueryMatches ¶
type QueryMatches []QueryMatch
Multiple matches
func (QueryMatches) Freeze ¶
func (q QueryMatches) Freeze()
func (QueryMatches) Hash ¶
func (q QueryMatches) Hash() (uint32, error)
func (QueryMatches) Iterate ¶
func (q QueryMatches) Iterate() starlark.Iterator
func (QueryMatches) Len ¶
func (q QueryMatches) Len() int
func (QueryMatches) String ¶
func (q QueryMatches) String() string
func (QueryMatches) Truth ¶
func (q QueryMatches) Truth() starlark.Bool
func (QueryMatches) Type ¶
func (q QueryMatches) Type() string
type QueryProcessorResult ¶
type QueryProcessorResult struct {
Result interface{}
Key string
}
Intermediate object to hold a query key+result in a single struct.
type QueryResults ¶
type QueryResults map[string]interface{}
TODO: better naming? QueryMapping?
func (QueryResults) Freeze ¶
func (qr QueryResults) Freeze()
func (QueryResults) Hash ¶
func (qr QueryResults) Hash() (uint32, error)
func (QueryResults) String ¶
func (qr QueryResults) String() string
func (QueryResults) Truth ¶
func (qr QueryResults) Truth() starlark.Bool
func (QueryResults) Type ¶
func (qr QueryResults) Type() string
type RegexQueryParams ¶
type RegexQueryParams = string
type RemoveTargetAction ¶
type RemoveTargetAction struct {
TargetAction
Name string
Kind string
}
type SourceExtensionsFilter ¶
type SourceExtensionsFilter struct {
Extensions []string
}
func (SourceExtensionsFilter) Attr ¶
func (r SourceExtensionsFilter) Attr(name string) (starlark.Value, error)
func (SourceExtensionsFilter) AttrNames ¶
func (r SourceExtensionsFilter) AttrNames() []string
func (SourceExtensionsFilter) Freeze ¶
func (r SourceExtensionsFilter) Freeze()
func (SourceExtensionsFilter) Hash ¶
func (r SourceExtensionsFilter) Hash() (uint32, error)
func (SourceExtensionsFilter) Match ¶
func (f SourceExtensionsFilter) Match(p string) bool
func (SourceExtensionsFilter) String ¶
func (r SourceExtensionsFilter) String() string
func (SourceExtensionsFilter) Truth ¶
func (r SourceExtensionsFilter) Truth() starlark.Bool
func (SourceExtensionsFilter) Type ¶
func (r SourceExtensionsFilter) Type() string
type SourceFileFilter ¶
type SourceFileFilter struct {
Files []string
}
func (SourceFileFilter) AttrNames ¶
func (r SourceFileFilter) AttrNames() []string
func (SourceFileFilter) Freeze ¶
func (r SourceFileFilter) Freeze()
func (SourceFileFilter) Hash ¶
func (r SourceFileFilter) Hash() (uint32, error)
func (SourceFileFilter) Match ¶
func (sf SourceFileFilter) Match(p string) bool
func (SourceFileFilter) String ¶
func (r SourceFileFilter) String() string
func (SourceFileFilter) Truth ¶
func (r SourceFileFilter) Truth() starlark.Bool
func (SourceFileFilter) Type ¶
func (r SourceFileFilter) Type() string
type SourceFilter ¶
type SourceGlobFilter ¶
type SourceGlobFilter struct {
Globs []string
}
func (SourceGlobFilter) AttrNames ¶
func (r SourceGlobFilter) AttrNames() []string
func (SourceGlobFilter) Freeze ¶
func (r SourceGlobFilter) Freeze()
func (SourceGlobFilter) Hash ¶
func (r SourceGlobFilter) Hash() (uint32, error)
func (SourceGlobFilter) Match ¶
func (f SourceGlobFilter) Match(p string) bool
func (SourceGlobFilter) String ¶
func (r SourceGlobFilter) String() string
func (SourceGlobFilter) Truth ¶
func (r SourceGlobFilter) Truth() starlark.Bool
func (SourceGlobFilter) Type ¶
func (r SourceGlobFilter) Type() string
type Symbol ¶
type TargetAction ¶
type TargetAction interface{}
type TargetDeclaration ¶
type TargetDeclaration struct {
Name string
Kind string
Attrs map[string]interface{}
// Names (possibly as paths) exported from this target
Symbols []Symbol
}
*
- A bazel target declaration describing the target name/type/attributes as
- well as symbols representing imports and exports of the target.
type TargetImport ¶
type TargetImport struct {
Symbol
// Optional imports will not be treated as resolution errors when not found.
Optional bool
// Where the import is from such as file path, for debugging
From string
}
func (TargetImport) AttrNames ¶
func (ti TargetImport) AttrNames() []string
func (TargetImport) Freeze ¶
func (ti TargetImport) Freeze()
func (TargetImport) Hash ¶
func (ti TargetImport) Hash() (uint32, error)
func (TargetImport) String ¶
func (ti TargetImport) String() string
func (TargetImport) Truth ¶
func (ti TargetImport) Truth() starlark.Bool
func (TargetImport) Type ¶
func (ti TargetImport) Type() string
type TargetSource ¶
type TargetSource struct {
Path string
QueryResults QueryResults
}
func (TargetSource) AttrNames ¶
func (ctx TargetSource) AttrNames() []string
func (TargetSource) Freeze ¶
func (TargetSource) Freeze()
func (TargetSource) Hash ¶
func (ts TargetSource) Hash() (uint32, error)
func (TargetSource) String ¶
func (ts TargetSource) String() string
func (TargetSource) Truth ¶
func (TargetSource) Truth() starlark.Bool
func (TargetSource) Type ¶
func (TargetSource) Type() string
type TargetSourceList ¶
type TargetSourceList []TargetSource
func (TargetSourceList) Freeze ¶
func (t TargetSourceList) Freeze()
func (TargetSourceList) Hash ¶
func (t TargetSourceList) Hash() (uint32, error)
func (TargetSourceList) Iterate ¶
func (t TargetSourceList) Iterate() starlark.Iterator
func (TargetSourceList) Len ¶
func (t TargetSourceList) Len() int
func (TargetSourceList) String ¶
func (t TargetSourceList) String() string
func (TargetSourceList) Truth ¶
func (t TargetSourceList) Truth() starlark.Bool
func (TargetSourceList) Type ¶
func (t TargetSourceList) Type() string
type TargetSources ¶
type TargetSources map[string]TargetSourceList
func (TargetSources) AttrNames ¶
func (c TargetSources) AttrNames() []string
func (TargetSources) Freeze ¶
func (c TargetSources) Freeze()
func (TargetSources) Hash ¶
func (c TargetSources) Hash() (uint32, error)
func (TargetSources) Iterate ¶
func (ts TargetSources) Iterate() starlark.Iterator
func (TargetSources) Len ¶
func (ts TargetSources) Len() int
func (TargetSources) String ¶
func (c TargetSources) String() string
func (TargetSources) Truth ¶
func (c TargetSources) Truth() starlark.Bool
func (TargetSources) Type ¶
func (c TargetSources) Type() string
type TargetSymbol ¶
func (TargetSymbol) AttrNames ¶
func (te TargetSymbol) AttrNames() []string
func (TargetSymbol) Freeze ¶
func (te TargetSymbol) Freeze()
func (TargetSymbol) Hash ¶
func (te TargetSymbol) Hash() (uint32, error)
func (TargetSymbol) String ¶
func (te TargetSymbol) String() string
func (TargetSymbol) Truth ¶
func (te TargetSymbol) Truth() starlark.Bool
func (TargetSymbol) Type ¶
func (te TargetSymbol) Type() string
type YamlQueryParams ¶
type YamlQueryParams = string