Documentation
¶
Index ¶
- Constants
- Variables
- func AllDictLeafEntries[TReference any](ctx context.Context, ...) ...
- func AllListLeafElements[TReference object.BasicReference](ctx context.Context, ...) iter.Seq[model_core.Message[*model_starlark_pb.Value, TReference]]
- func AllListLeafElementsSkippingDuplicateParents[TReference object.BasicReference](ctx context.Context, ...) iter.Seq[model_core.Message[*model_starlark_pb.Value, TReference]]
- func AllStructFields[TReference any](ctx context.Context, ...) iter.Seq2[string, model_core.Message[*model_starlark_pb.Value, TReference]]
- func ConfigurationReferenceToComponent[TReference object.BasicReference](...) (string, error)
- func CurrentFilePackage(thread *starlark.Thread, depth int) pg_label.CanonicalPackage
- func DecodeGlobals[TReference object.BasicReference, ...](...) (starlark.StringDict, error)
- func DecodeValue[TReference object.BasicReference, ...](encodedValue model_core.Message[*model_starlark_pb.Value, TReference], ...) (starlark.Value, error)
- func EncodeCompiledProgram[TReference any, TMetadata model_core.CloneableReferenceMetadata](program *starlark.Program, globals starlark.StringDict, ...) (model_core.PatchedMessage[*model_starlark_pb.CompiledProgram, TMetadata], ...)
- func EncodeValue[TReference any, TMetadata model_core.CloneableReferenceMetadata](value starlark.Value, path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func FileGetInputRootPath[TReference object.BasicReference](f model_core.Message[*model_starlark_pb.File, TReference], ...) (string, error)
- func FileGetRunfilesPath[TReference object.BasicReference](f model_core.Message[*model_starlark_pb.File, TReference]) (string, error)
- func GetBuiltins[TReference object.BasicReference, ...]() (starlark.StringDict, starlark.StringDict)
- func GetStructFieldValue[TReference any](ctx context.Context, ...) (model_core.Message[*model_starlark_pb.Value, TReference], error)
- func NameAndExtractGlobals(globals starlark.StringDict, canonicalLabel pg_label.CanonicalLabel)
- func NewAspect[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, ...) starlark.Value
- func NewLabel[TReference any, TMetadata model_core.CloneableReferenceMetadata](value pg_label.ResolvedLabel) starlark.Value
- func NewLabelOrStringUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](basePackage pg_label.CanonicalPackage) unpack.UnpackerInto[pg_label.ResolvedLabel]
- func NewLabelUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[pg_label.ResolvedLabel]
- func NewListBuilder[TReference any, TMetadata model_core.CloneableReferenceMetadata](options *ValueEncodingOptions[TReference, TMetadata]) btree.Builder[*model_starlark_pb.List_Element, TMetadata]
- func NewListToDepsetUnpackerInto[TReference object.BasicReference, ...](base unpack.Canonicalizer) unpack.UnpackerInto[*Depset[TReference, TMetadata]]
- func NewModuleExtension[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition ModuleExtensionDefinition[TReference, TMetadata]) starlark.Value
- func NewNamedFunctionUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[NamedFunction[TReference, TMetadata]]
- func NewPackageGroupFromVisibility[TMetadata model_core.ReferenceMetadata](visibility []pg_label.ResolvedLabel, encoder model_encoding.BinaryEncoder, ...) (model_core.PatchedMessage[*model_starlark_pb.PackageGroup, TMetadata], error)
- func NewPath(bp *BarePath, filesystem Filesystem) starlark.Value
- func NewPathOrLabelOrStringUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](repoPathResolver RepoPathResolver, workingDirectory *BarePath) unpack.UnpackerInto[*BarePath]
- func NewRepositoryRule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, ...) starlark.Value
- func NewRule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, ...) starlark.Value
- func NewSelectUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](valueUnpackerInto unpack.Canonicalizer) unpack.UnpackerInto[*Select[TReference, TMetadata]]
- func NewSubrule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, ...) starlark.Value
- func NewTagClass[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition TagClassDefinition[TReference, TMetadata]) starlark.Value
- func NewTargetReference[TReference object.BasicReference, ...](label pg_label.ResolvedLabel, ...) starlark.Value
- func NewToolchainTypeUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[*ToolchainType[TReference, TMetadata]]
- func NewTransition[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition TransitionDefinition[TReference, TMetadata]) starlark.Value
- func NewTransitionDefinitionUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[TransitionDefinition[TReference, TMetadata]]
- func ParseBoolBuildSettingString(s string) (bool, error)
- func ParseRepoDotBazel[TReference any, TMetadata model_core.CloneableReferenceMetadata](contents string, filename pg_label.CanonicalLabel, ...) (model_core.PatchedMessage[*model_starlark_pb.InheritableAttrs, TMetadata], ...)
- func VisitLabels(thread *starlark.Thread, v starlark.Value, path map[starlark.Value]struct{}, ...) error
- type Aspect
- func (a *Aspect[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (a *Aspect[TReference, TMetadata]) Freeze()
- func (a *Aspect[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (a *Aspect[TReference, TMetadata]) String() string
- func (a *Aspect[TReference, TMetadata]) Truth() starlark.Bool
- func (a *Aspect[TReference, TMetadata]) Type() string
- type Attr
- func (a *Attr[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
- func (a *Attr[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Attr, TMetadata], bool, error)
- func (a *Attr[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (Attr[TReference, TMetadata]) Freeze()
- func (a *Attr[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (a *Attr[TReference, TMetadata]) String() string
- func (Attr[TReference, TMetadata]) Truth() starlark.Bool
- func (a *Attr[TReference, TMetadata]) Type() string
- type AttrType
- func DecodeAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](attr *model_starlark_pb.Attr) (AttrType, error)
- func NewIntAttrType(values []int32) AttrType
- func NewIntListAttrType() AttrType
- func NewLabelAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](allowNone, allowSingleFile, executable bool, valueAllowFiles []byte, ...) AttrType
- func NewLabelKeyedStringDictAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](dictKeyAllowFiles []byte, ...) AttrType
- func NewLabelListAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](listValueAllowFiles []byte, ...) AttrType
- func NewOutputAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](filenameTemplate string) AttrType
- func NewOutputListAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata]() AttrType
- func NewStringAttrType(values []string) AttrType
- func NewStringDictAttrType() AttrType
- func NewStringListAttrType() AttrType
- func NewStringListDictAttrType() AttrType
- type BarePath
- func (bp *BarePath) Append(component bb_path.Component) *BarePath
- func (bp *BarePath) GetRelativeTo(other *BarePath) []bb_path.Component
- func (bp *BarePath) GetUNIXString() string
- func (bp *BarePath) ParseScope(scopeWalker bb_path.ScopeWalker) (bb_path.ComponentWalker, bb_path.RelativeParser, error)
- type BuildSetting
- type BuildSettingCanonicalizer
- type BuildSettingType
- func DecodeBuildSettingType[TReference object.BasicReference, ...](buildSetting *model_starlark_pb.BuildSetting) (BuildSettingType, error)
- func NewLabelListBuildSettingType[TReference any, TMetadata model_core.CloneableReferenceMetadata](repeatable bool) BuildSettingType
- func NewStringListBuildSettingType(repeatable bool) BuildSettingType
- type CanonicalRepoResolver
- type CreatedObjectCapturerForTesting
- type Depset
- func (d *Depset[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (d *Depset[TReference, TMetadata]) AttrNames() []string
- func (d *Depset[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
- func (d *Depset[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Depset, TMetadata], bool, error)
- func (d *Depset[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (Depset[TReference, TMetadata]) Freeze()
- func (re *Depset) Hash(thread *starlark.Thread) (uint32, error)
- func (Depset[TReference, TMetadata]) String() string
- func (d *Depset[TReference, TMetadata]) Truth() starlark.Bool
- func (Depset[TReference, TMetadata]) Type() string
- type DepsetContents
- func NewDepsetContents[TReference object.BasicReference, ...](thread *starlark.Thread, direct []starlark.Value, ...) (*DepsetContents[TReference, TMetadata], error)
- func NewDepsetContentsFromList[TReference object.BasicReference, ...](children []any, order model_starlark_pb.Depset_Order) *DepsetContents[TReference, TMetadata]
- type EncodableValue
- type ExecGroup
- func (eg *ExecGroup[TReference, TMetadata]) Encode() *model_starlark_pb.ExecGroup
- func (eg *ExecGroup[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (ExecGroup[TReference, TMetadata]) Freeze()
- func (ExecGroup[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (ExecGroup[TReference, TMetadata]) String() string
- func (ExecGroup[TReference, TMetadata]) Truth() starlark.Bool
- func (ExecGroup[TReference, TMetadata]) Type() string
- type File
- func (f *File[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (File[TReference, TMetadata]) AttrNames() []string
- func (f *File[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
- func (f *File[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (File[TReference, TMetadata]) Freeze()
- func (f *File[TReference, TMetadata]) GetDefinition() model_core.Message[*model_starlark_pb.File, TReference]
- func (f *File[TReference, TMetadata]) GetTreeRelativePath() *bb_path.Trace
- func (f *File[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (f *File[TReference, TMetadata]) String() string
- func (File[TReference, TMetadata]) Truth() starlark.Bool
- func (File[TReference, TMetadata]) Type() string
- func (f *File[TReference, TMetadata]) WithTreeRelativePath(treeRelativePath *bb_path.Trace) *File[TReference, TMetadata]
- type Filesystem
- type FunctionFactoryResolver
- type GlobExpander
- type GlobalResolver
- type HasLabels
- type Label
- func (l Label[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (l Label[TReference, TMetadata]) AttrNames() []string
- func (l Label[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (l Label[TReference, TMetadata]) Freeze()
- func (l Label[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (l Label[TReference, TMetadata]) String() string
- func (l Label[TReference, TMetadata]) Truth() starlark.Bool
- func (l Label[TReference, TMetadata]) Type() string
- func (l Label[TReference, TMetadata]) VisitLabels(thread *starlark.Thread, path map[starlark.Value]struct{}, ...) error
- type LateNamedValue
- type ModuleExtensionDefinition
- func NewProtoModuleExtensionDefinition[TReference object.BasicReference, ...](message model_core.Message[*model_starlark_pb.ModuleExtension, TReference]) ModuleExtensionDefinition[TReference, TMetadata]
- func NewStarlarkModuleExtensionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](implementation NamedFunction[TReference, TMetadata], ...) ModuleExtensionDefinition[TReference, TMetadata]
- type NamedFunction
- func (f NamedFunction[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (f NamedFunction[TReference, TMetadata]) Freeze()
- func (f NamedFunction[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (f NamedFunction[TReference, TMetadata]) String() string
- func (f NamedFunction[TReference, TMetadata]) Truth() starlark.Bool
- func (f NamedFunction[TReference, TMetadata]) Type() string
- type NamedFunctionDefinition
- func NewProtoNamedFunctionDefinition[TReference object.BasicReference, ...](message model_core.Message[*model_starlark_pb.Function, TReference]) NamedFunctionDefinition[TReference, TMetadata]
- func NewStarlarkNamedFunctionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](function *starlark.Function) NamedFunctionDefinition[TReference, TMetadata]
- type NamedGlobal
- type PathResolver
- func (r *PathResolver) OnAbsolute() (bb_path.ComponentWalker, error)
- func (r *PathResolver) OnDirectory(name bb_path.Component) (bb_path.GotDirectoryOrSymlink, error)
- func (r *PathResolver) OnDriveLetter(drive rune) (bb_path.ComponentWalker, error)
- func (r *PathResolver) OnRelative() (bb_path.ComponentWalker, error)
- func (r *PathResolver) OnShare(server, share string) (bb_path.ComponentWalker, error)
- func (r *PathResolver) OnTerminal(name bb_path.Component) (*bb_path.GotSymlink, error)
- func (r *PathResolver) OnUp() (bb_path.ComponentWalker, error)
- type Provider
- func DecodeProvider[TReference object.BasicReference, ...](m model_core.Message[*model_starlark_pb.Provider, TReference]) (*Provider[TReference, TMetadata], error)
- func NewProvider[TReference object.BasicReference, ...](instanceProperties *ProviderInstanceProperties[TReference, TMetadata], ...) *Provider[TReference, TMetadata]
- func (p *Provider[TReference, TMetadata]) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (p *Provider[TReference, TMetadata]) Cmp(other starlark.Value, depth int) (int, error)
- func (p *Provider[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (p *Provider[TReference, TMetadata]) Freeze()
- func (p *Provider[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (p *Provider[TReference, TMetadata]) Instantiate(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (*Struct[TReference, TMetadata], error)
- func (p *Provider[TReference, TMetadata]) Name() string
- func (p *Provider[TReference, TMetadata]) String() string
- func (p *Provider[TReference, TMetadata]) Truth() starlark.Bool
- func (p *Provider[TReference, TMetadata]) Type() string
- type ProviderInstanceProperties
- type ReferenceEqualIdentifierGenerator
- type RepoPathResolver
- type RepoRegistrar
- type RepositoryRuleDefinition
- func NewProtoRepositoryRuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](...) RepositoryRuleDefinition[TReference, TMetadata]
- func NewStarlarkRepositoryRuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](implementation NamedFunction[TReference, TMetadata], ...) RepositoryRuleDefinition[TReference, TMetadata]
- type RootModuleResolver
- type RuleDefinition
- func NewProtoRuleDefinition[TReference object.BasicReference, ...](message model_core.Message[*model_starlark_pb.Rule_Definition, TReference]) RuleDefinition[TReference, TMetadata]
- func NewReloadingRuleDefinition[TReference object.BasicReference, ...](identifier pg_label.CanonicalStarlarkIdentifier) RuleDefinition[TReference, TMetadata]
- func NewStarlarkRuleDefinition[TReference object.BasicReference, ...](attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], ...) RuleDefinition[TReference, TMetadata]
- type Select
- func (s *Select[TReference, TMetadata]) Binary(thread *starlark.Thread, op syntax.Token, y starlark.Value, side starlark.Side) (starlark.Value, error)
- func (s *Select[TReference, TMetadata]) EncodeGroups(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[[]*model_starlark_pb.Select_Group, TMetadata], bool, ...)
- func (s *Select[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (s *Select[TReference, TMetadata]) Freeze()
- func (Select[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (Select[TReference, TMetadata]) String() string
- func (Select[TReference, TMetadata]) Truth() starlark.Bool
- func (Select[TReference, TMetadata]) Type() string
- func (s *Select[TReference, TMetadata]) VisitLabels(thread *starlark.Thread, path map[starlark.Value]struct{}, ...) error
- type SelectGroup
- type Struct
- func DecodeStruct[TReference object.BasicReference, ...](m model_core.Message[*model_starlark_pb.Struct, TReference], ...) (*Struct[TReference, TMetadata], error)
- func NewStructFromDict[TReference object.BasicReference, ...](providerInstanceProperties *ProviderInstanceProperties[TReference, TMetadata], ...) *Struct[TReference, TMetadata]
- func (s *Struct[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (s *Struct[TReference, TMetadata]) AttrNames() []string
- func (s *Struct[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
- func (s *Struct[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Struct, TMetadata], bool, error)
- func (s *Struct[TReference, TMetadata]) EncodeStructFields(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Struct_Fields, TMetadata], bool, ...)
- func (s *Struct[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (s *Struct[TReference, TMetadata]) Freeze()
- func (s *Struct[TReference, TMetadata]) Get(thread *starlark.Thread, key starlark.Value) (starlark.Value, bool, error)
- func (s *Struct[TReference, TMetadata]) GetProviderIdentifier() (pg_label.CanonicalStarlarkIdentifier, error)
- func (s *Struct[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (s *Struct[TReference, TMetadata]) String() string
- func (s *Struct[TReference, TMetadata]) ToDict() map[string]any
- func (Struct[TReference, TMetadata]) Truth() starlark.Bool
- func (s *Struct[TReference, TMetadata]) Type() string
- type Subrule
- func (sr *Subrule[TReference, TMetadata]) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (sr *Subrule[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (Subrule[TReference, TMetadata]) Freeze()
- func (Subrule[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (sr *Subrule[TReference, TMetadata]) Name() string
- func (Subrule[TReference, TMetadata]) String() string
- func (Subrule[TReference, TMetadata]) Truth() starlark.Bool
- func (Subrule[TReference, TMetadata]) Type() string
- type SubruleDefinition
- func NewProtoSubruleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata]() SubruleDefinition[TReference, TMetadata]
- func NewStarlarkSubruleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], ...) SubruleDefinition[TReference, TMetadata]
- type SubruleInvoker
- type TagClass
- func (tc *TagClass[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (TagClass[TReference, TMetadata]) Freeze()
- func (TagClass[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (TagClass[TReference, TMetadata]) String() string
- func (TagClass[TReference, TMetadata]) Truth() starlark.Bool
- func (TagClass[TReference, TMetadata]) Type() string
- type TagClassDefinition
- func NewProtoTagClassDefinition[TReference object.BasicReference, ...](message model_core.Message[*model_starlark_pb.TagClass, TReference]) TagClassDefinition[TReference, TMetadata]
- func NewStarlarkTagClassDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata]) TagClassDefinition[TReference, TMetadata]
- type TargetReference
- func (tr *TargetReference[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (tr *TargetReference[TReference, TMetadata]) AttrNames() []string
- func (tr *TargetReference[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
- func (tr *TargetReference[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (TargetReference[TReference, TMetadata]) Freeze()
- func (tr *TargetReference[TReference, TMetadata]) Get(thread *starlark.Thread, v starlark.Value) (starlark.Value, bool, error)
- func (tr *TargetReference[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (tr *TargetReference[TReference, TMetadata]) String() string
- func (TargetReference[TReference, TMetadata]) Truth() starlark.Bool
- func (TargetReference[TReference, TMetadata]) Type() string
- type TargetRegistrar
- type ToolchainType
- func (tt *ToolchainType[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
- func (tt *ToolchainType[TReference, TMetadata]) AttrNames() []string
- func (tt *ToolchainType[TReference, TMetadata]) Encode() *model_starlark_pb.ToolchainType
- func (tt *ToolchainType[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, ...) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
- func (ToolchainType[TReference, TMetadata]) Freeze()
- func (ToolchainType[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (tt *ToolchainType[TReference, TMetadata]) Merge(other *ToolchainType[TReference, TMetadata]) *ToolchainType[TReference, TMetadata]
- func (ToolchainType[TReference, TMetadata]) String() string
- func (ToolchainType[TReference, TMetadata]) Truth() starlark.Bool
- func (ToolchainType[TReference, TMetadata]) Type() string
- type Transition
- func (Transition[TReference, TMetadata]) Freeze()
- func (Transition[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
- func (Transition[TReference, TMetadata]) String() string
- func (Transition[TReference, TMetadata]) Truth() starlark.Bool
- func (Transition[TReference, TMetadata]) Type() string
- type TransitionDefinition
- func NewReferenceTransitionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](reference *model_starlark_pb.Transition_Reference) TransitionDefinition[TReference, TMetadata]
- func NewUserDefinedTransitionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, ...) TransitionDefinition[TReference, TMetadata]
- type ValueDecodingOptions
- type ValueEncodingOptions
- type ValueReaders
Constants ¶
const ( CanonicalPackageKey = "canonical_package" CurrentCtxKey = "current_ctx" GlobExpanderKey = "glob_expander" )
const ( ComponentStrBazelOut = "bazel-out" ComponentStrBin = "bin" ComponentStrExternal = "external" )
Names of commonly used pathname components of source and output files.
const FunctionFactoryResolverKey = "function_factory_resolver"
const GlobalResolverKey = "global_resolver"
const (
LabelResolverKey = "label_resolver"
)
const ReferenceEqualIdentifierGeneratorKey = "reference_equal_identifier_generator"
const RepoRegistrarKey = "repo_registrar"
const SubruleInvokerKey = "subrule_invoker"
SubruleInvokerKey is the key under which the SubruleInvoker should be registered as a local variable in the Starlark thread.
const TargetRegistrarKey = "target_registrar"
const ValueDecodingOptionsKey = "value_decoding_options"
const ValueEncodingOptionsKey = "value_encoding_options"
Variables ¶
var ( ComponentBazelOut = bb_path.MustNewComponent(ComponentStrBazelOut) ComponentBin = bb_path.MustNewComponent(ComponentStrBin) ComponentExternal = bb_path.MustNewComponent(ComponentStrExternal) )
Typed instances of the names specified above.
var ( DefaultExecGroupTransitionReference = model_starlark_pb.Transition_Reference{ Kind: &model_starlark_pb.Transition_Reference_ExecGroup{ ExecGroup: "", }, } NoneTransitionReference = model_starlark_pb.Transition_Reference{ Kind: &model_starlark_pb.Transition_Reference_None{ None: &emptypb.Empty{}, }, } TargetTransitionReference = model_starlark_pb.Transition_Reference{ Kind: &model_starlark_pb.Transition_Reference_Target{ Target: &emptypb.Empty{}, }, } UnconfiguredTransitionReference = model_starlark_pb.Transition_Reference{ Kind: &model_starlark_pb.Transition_Reference_Unconfigured{ Unconfigured: &emptypb.Empty{}, }, } )
References to transitions that are used frequently (e.g., "exec", "target", config.none()).
var DefaultInheritableAttrs = model_starlark_pb.InheritableAttrs{ Visibility: &model_starlark_pb.PackageGroup{ Tree: &model_starlark_pb.PackageGroup_Subpackages{}, }, }
Functions ¶
func AllDictLeafEntries ¶
func AllDictLeafEntries[TReference any]( ctx context.Context, reader model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.Dict_Entry, TReference]], rootDict model_core.Message[*model_starlark_pb.Dict, TReference], errOut *error, ) iter.Seq2[model_core.Message[*model_starlark_pb.Value, TReference], model_core.Message[*model_starlark_pb.Value, TReference]]
func AllListLeafElements ¶
func AllListLeafElements[TReference object.BasicReference]( ctx context.Context, reader model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.List_Element, TReference]], rootList model_core.Message[[]*model_starlark_pb.List_Element, TReference], errOut *error, ) iter.Seq[model_core.Message[*model_starlark_pb.Value, TReference]]
AllListLeafElementsDeduplicatingParents walks over a list and returns all leaf elements contained within.
func AllListLeafElementsSkippingDuplicateParents ¶
func AllListLeafElementsSkippingDuplicateParents[TReference object.BasicReference]( ctx context.Context, reader model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.List_Element, TReference]], rootList model_core.Message[[]*model_starlark_pb.List_Element, TReference], listsSeen map[model_core.Decodable[object.LocalReference]]struct{}, errOut *error, ) iter.Seq[model_core.Message[*model_starlark_pb.Value, TReference]]
AllListLeafElementsDeduplicatingParents walks over a list and returns all leaf elements contained within. In the process, it records which parent elements are encountered and skips duplicates.
This function can be used to efficiently iterate lists that should be interpreted as sets. As depsets are backed by lists internally, this function can be used in part to implement depset.to_list().
Note that this function does not perform deduplication of leaf elements. Only parents are deduplicated.
func AllStructFields ¶
func AllStructFields[TReference any]( ctx context.Context, reader model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.List_Element, TReference]], structFields model_core.Message[*model_starlark_pb.Struct_Fields, TReference], errOut *error, ) iter.Seq2[string, model_core.Message[*model_starlark_pb.Value, TReference]]
AllStructFields iterates over all fields contained in a Starlark struct that has been encoded and is backed by storage.
func ConfigurationReferenceToComponent ¶
func ConfigurationReferenceToComponent[TReference object.BasicReference](configurationReference model_core.Message[*model_core_pb.DecodableReference, TReference]) (string, error)
ConfigurationReferenceToComponent determines the pathname component to use for a given configuration, so that it may be embedded into bazel-out/.../bin pathnames.
func CurrentFilePackage ¶
func CurrentFilePackage(thread *starlark.Thread, depth int) pg_label.CanonicalPackage
func DecodeGlobals ¶
func DecodeGlobals[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](encodedGlobals model_core.Message[*model_starlark_pb.Struct_Fields, TReference], currentFilename pg_label.CanonicalLabel, options *ValueDecodingOptions[TReference]) (starlark.StringDict, error)
func DecodeValue ¶
func DecodeValue[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](encodedValue model_core.Message[*model_starlark_pb.Value, TReference], currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueDecodingOptions[TReference]) (starlark.Value, error)
func EncodeCompiledProgram ¶
func EncodeCompiledProgram[TReference any, TMetadata model_core.CloneableReferenceMetadata](program *starlark.Program, globals starlark.StringDict, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.CompiledProgram, TMetadata], error)
func EncodeValue ¶
func EncodeValue[TReference any, TMetadata model_core.CloneableReferenceMetadata](value starlark.Value, path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
func FileGetInputRootPath ¶
func FileGetInputRootPath[TReference object.BasicReference](f model_core.Message[*model_starlark_pb.File, TReference], treeRelativePath *bb_path.Trace) (string, error)
FileGetInputRootPath returns the full input root path corresponding to a File object, similar to accessing the "path" attribute of a File from within Starlark code.
func FileGetRunfilesPath ¶
func FileGetRunfilesPath[TReference object.BasicReference](f model_core.Message[*model_starlark_pb.File, TReference]) (string, error)
FileGetRunfilesPath returns a runfiles root directory relative path corresponding to a File object.
func GetBuiltins ¶
func GetBuiltins[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata]() (starlark.StringDict, starlark.StringDict)
func GetStructFieldValue ¶
func GetStructFieldValue[TReference any]( ctx context.Context, reader model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.List_Element, TReference]], structFields model_core.Message[*model_starlark_pb.Struct_Fields, TReference], key string, ) (model_core.Message[*model_starlark_pb.Value, TReference], error)
GetStructFieldValue returns the value that is associated with a field of a struct. This function assumes that the struct was created previous and is backed by storage.
func NameAndExtractGlobals ¶
func NameAndExtractGlobals(globals starlark.StringDict, canonicalLabel pg_label.CanonicalLabel)
func NewAspect ¶
func NewAspect[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, definition *model_starlark_pb.Aspect_Definition) starlark.Value
func NewLabel ¶
func NewLabel[TReference any, TMetadata model_core.CloneableReferenceMetadata](value pg_label.ResolvedLabel) starlark.Value
func NewLabelOrStringUnpackerInto ¶
func NewLabelOrStringUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](basePackage pg_label.CanonicalPackage) unpack.UnpackerInto[pg_label.ResolvedLabel]
func NewLabelUnpackerInto ¶
func NewLabelUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[pg_label.ResolvedLabel]
func NewListBuilder ¶
func NewListBuilder[TReference any, TMetadata model_core.CloneableReferenceMetadata](options *ValueEncodingOptions[TReference, TMetadata]) btree.Builder[*model_starlark_pb.List_Element, TMetadata]
func NewListToDepsetUnpackerInto ¶
func NewListToDepsetUnpackerInto[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](base unpack.Canonicalizer) unpack.UnpackerInto[*Depset[TReference, TMetadata]]
func NewModuleExtension ¶
func NewModuleExtension[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition ModuleExtensionDefinition[TReference, TMetadata]) starlark.Value
func NewNamedFunctionUnpackerInto ¶
func NewNamedFunctionUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[NamedFunction[TReference, TMetadata]]
func NewPackageGroupFromVisibility ¶
func NewPackageGroupFromVisibility[TMetadata model_core.ReferenceMetadata](visibility []pg_label.ResolvedLabel, encoder model_encoding.BinaryEncoder, inlinedTreeOptions *inlinedtree.Options, objectCapturer model_core.CreatedObjectCapturer[TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.PackageGroup, TMetadata], error)
NewPackageGroupFromVisibility generates a PackageGroup message based on a sequence of "visibility" labels provided to repo(), package(), or rule targets.
func NewPathOrLabelOrStringUnpackerInto ¶
func NewPathOrLabelOrStringUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](repoPathResolver RepoPathResolver, workingDirectory *BarePath) unpack.UnpackerInto[*BarePath]
func NewRepositoryRule ¶
func NewRepositoryRule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, definition RepositoryRuleDefinition[TReference, TMetadata]) starlark.Value
func NewRule ¶
func NewRule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, definition RuleDefinition[TReference, TMetadata]) starlark.Value
func NewSelectUnpackerInto ¶
func NewSelectUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata](valueUnpackerInto unpack.Canonicalizer) unpack.UnpackerInto[*Select[TReference, TMetadata]]
NewSelectUnpackerInto returns an unpacker for Starlark function arguments that is capable of unpacking Starlark select() objects.
If the provided value is not a select() object, it is converted to a select() object that only has a single group, having a default condition corresponding to the provided value.
func NewSubrule ¶
func NewSubrule[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, definition SubruleDefinition[TReference, TMetadata]) starlark.Value
NewSubrule returns a Starlark value corresponding to a subrule. Such values are typically created using the subrule() function.
func NewTagClass ¶
func NewTagClass[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition TagClassDefinition[TReference, TMetadata]) starlark.Value
NewTagClass returns a Starlark value corresponding to a module extension tag class. Such values are normally created by calling tag_class().
func NewTargetReference ¶
func NewTargetReference[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](label pg_label.ResolvedLabel, providers model_core.Message[[]*model_starlark_pb.Struct, TReference]) starlark.Value
NewTargetReference creates a new Starlark Target value corresponding to a given label, exposing struct instances corresponding to a set of providers. This function expects these struct instances to be alphabetically sorted by provider identifier.
func NewToolchainTypeUnpackerInto ¶
func NewToolchainTypeUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[*ToolchainType[TReference, TMetadata]]
NewToolchainTypeUnpackerInto is capable of unpacking arguments that are provided to functions that accept toolchain types.
Toolchain types may either be provided in the form of strings or labels, or as values explicitly constructed using the toolchain_type() function. When the former is used, toolchain type dependencies are assumed to be mandatory.
func NewTransition ¶
func NewTransition[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition TransitionDefinition[TReference, TMetadata]) starlark.Value
NewTransition creates a new Starlark transition value having a given definition. This function is typically invoked when exec_transition() or transition() is called.
func NewTransitionDefinitionUnpackerInto ¶
func NewTransitionDefinitionUnpackerInto[TReference any, TMetadata model_core.CloneableReferenceMetadata]() unpack.UnpackerInto[TransitionDefinition[TReference, TMetadata]]
NewTransitionDefinitionUnpackerInto is capable of unpacking arguments to a Starlark function that are expected to refer to a configuration transition. These may either be user defined transitions, or strings referring to predefined transitions (i.e., "exec" or "target").
func ParseRepoDotBazel ¶
func ParseRepoDotBazel[TReference any, TMetadata model_core.CloneableReferenceMetadata]( contents string, filename pg_label.CanonicalLabel, encoder model_encoding.BinaryEncoder, inlinedTreeOptions *inlinedtree.Options, objectCapturer model_core.CreatedObjectCapturer[TMetadata], labelResolver pg_label.Resolver, ) (model_core.PatchedMessage[*model_starlark_pb.InheritableAttrs, TMetadata], error)
ParseRepoDotBazel parses a REPO.bazel file that may be stored at the root of a repository.
func VisitLabels ¶
func VisitLabels(thread *starlark.Thread, v starlark.Value, path map[starlark.Value]struct{}, visitor func(pg_label.ResolvedLabel) error) error
VisitLabels recursively visits a Starlark value and reports any labels that are contained within. This method can, for example, be used to walk all labels contained in rule attributes to determine their dependencies.
Types ¶
type Aspect ¶
type Aspect[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { LateNamedValue // contains filtered or unexported fields }
func (*Aspect[TReference, TMetadata]) EncodeValue ¶
func (a *Aspect[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
type Attr ¶
type Attr[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
func NewAttr ¶
func NewAttr[TReference any, TMetadata model_core.CloneableReferenceMetadata](attrType AttrType, defaultValue starlark.Value) *Attr[TReference, TMetadata]
func (*Attr[TReference, TMetadata]) CompareSameType ¶
func (*Attr[TReference, TMetadata]) Encode ¶
func (a *Attr[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Attr, TMetadata], bool, error)
func (*Attr[TReference, TMetadata]) EncodeValue ¶
func (a *Attr[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
type AttrType ¶
type AttrType interface { Type() string Encode(out *model_starlark_pb.Attr) error GetCanonicalizer(currentPackage pg_label.CanonicalPackage) unpack.Canonicalizer IsOutput() (filenameTemplate string, ok bool) }
var BoolAttrType AttrType = boolAttrType{}
func DecodeAttrType ¶
func DecodeAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](attr *model_starlark_pb.Attr) (AttrType, error)
func NewIntAttrType ¶
func NewIntListAttrType ¶
func NewIntListAttrType() AttrType
func NewLabelAttrType ¶
func NewLabelAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](allowNone, allowSingleFile, executable bool, valueAllowFiles []byte, valueCfg TransitionDefinition[TReference, TMetadata]) AttrType
func NewLabelKeyedStringDictAttrType ¶
func NewLabelKeyedStringDictAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](dictKeyAllowFiles []byte, dictKeyCfg TransitionDefinition[TReference, TMetadata]) AttrType
func NewLabelListAttrType ¶
func NewLabelListAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](listValueAllowFiles []byte, listValueCfg TransitionDefinition[TReference, TMetadata]) AttrType
func NewOutputAttrType ¶
func NewOutputAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata](filenameTemplate string) AttrType
func NewOutputListAttrType ¶
func NewOutputListAttrType[TReference any, TMetadata model_core.CloneableReferenceMetadata]() AttrType
func NewStringAttrType ¶
func NewStringDictAttrType ¶
func NewStringDictAttrType() AttrType
func NewStringListAttrType ¶
func NewStringListAttrType() AttrType
func NewStringListDictAttrType ¶
func NewStringListDictAttrType() AttrType
type BarePath ¶
type BarePath struct {
// contains filtered or unexported fields
}
BarePath stores an absolute pathname contained in a Starlark path object.
func (*BarePath) GetRelativeTo ¶
GetRelativeTo returns whether the receiving path is below another path. If so, it returns a non-nil slice of the components of the trailing part of the path that is below the other. If not, it returns nil.
func (*BarePath) GetUNIXString ¶
func (*BarePath) ParseScope ¶
func (bp *BarePath) ParseScope(scopeWalker bb_path.ScopeWalker) (bb_path.ComponentWalker, bb_path.RelativeParser, error)
type BuildSetting ¶
type BuildSetting struct {
// contains filtered or unexported fields
}
func NewBuildSetting ¶
func NewBuildSetting(buildSettingType BuildSettingType, flag bool) *BuildSetting
func (*BuildSetting) Encode ¶
func (bs *BuildSetting) Encode() *model_starlark_pb.BuildSetting
func (*BuildSetting) Freeze ¶
func (bs *BuildSetting) Freeze()
func (*BuildSetting) String ¶
func (bs *BuildSetting) String() string
func (*BuildSetting) Truth ¶
func (bs *BuildSetting) Truth() starlark.Bool
func (*BuildSetting) Type ¶
func (bs *BuildSetting) Type() string
type BuildSettingCanonicalizer ¶
type BuildSettingCanonicalizer interface { unpack.Canonicalizer CanonicalizeStringList(values []string, labelResolver pg_label.Resolver) (starlark.Value, error) }
BuildSettingCanonicalizer can be used to convert Starlark values to a canonical representation for assignment to a build setting.
This interface also provides a method for converting lists of strings to a canonical Starlark value. This is used to process build setting overrides that are provided on the command line (e.g., --@rules_go//go/config:gc_goopts=-e).
func NewLabelBuildSettingCanonicalizer ¶
func NewLabelBuildSettingCanonicalizer[TReference any, TMetadata model_core.CloneableReferenceMetadata](currentPackage pg_label.CanonicalPackage, singletonList bool) BuildSettingCanonicalizer
NewLabelBuildSettingCanonicalizer creates a BuildSettingCanonicalizer that is capable of canonicalizing values assigned to label_setting()s and label_flag()s.
As label_setting()s and label_flag()s are implemented as a kind of alias() and not as a rule target, this type does not have an associated BuildSettingType. This is why this BuildSettingCanonicalizer can be constructed independently.
type BuildSettingType ¶
type BuildSettingType interface { Type() string Encode(out *model_starlark_pb.BuildSetting) GetCanonicalizer(currentPackage pg_label.CanonicalPackage) BuildSettingCanonicalizer }
var BoolBuildSettingType BuildSettingType = boolBuildSettingType{}
var IntBuildSettingType BuildSettingType = intBuildSettingType{}
var StringBuildSettingType BuildSettingType = stringBuildSettingType{}
func DecodeBuildSettingType ¶
func DecodeBuildSettingType[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](buildSetting *model_starlark_pb.BuildSetting) (BuildSettingType, error)
func NewLabelListBuildSettingType ¶
func NewLabelListBuildSettingType[TReference any, TMetadata model_core.CloneableReferenceMetadata](repeatable bool) BuildSettingType
func NewStringListBuildSettingType ¶
func NewStringListBuildSettingType(repeatable bool) BuildSettingType
type CanonicalRepoResolver ¶
type CanonicalRepoResolver = func(fromCanonicalRepo pg_label.CanonicalRepo, toApparentRepo pg_label.ApparentRepo) (*pg_label.CanonicalRepo, error)
type CreatedObjectCapturerForTesting ¶
type CreatedObjectCapturerForTesting = model_core.CreatedObjectCapturer[model_core.CreatedObjectTree]
type Depset ¶
type Depset[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { DepsetContents[TReference, TMetadata] // contains filtered or unexported fields }
Depset is an order preserving set type for Starlark values that supports fast union operations.
func NewDepset ¶
func NewDepset[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](contents *DepsetContents[TReference, TMetadata], identifierGenerator ReferenceEqualIdentifierGenerator) *Depset[TReference, TMetadata]
NewDepset creates a Starlark depset object that holds the provided contents. If the depset is non-empty, it attaches a unique identifier to it. This ensures that when depsets provide reference equality.
func (*Depset[TReference, TMetadata]) Attr ¶
func (d *Depset[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
Attr can be used to access attributes of the depset. Depsets only provide a single method named to_list(), which can be used to convert it to a deduplicated list.
func (*Depset[TReference, TMetadata]) AttrNames ¶
AttrNames returns the names of the attributes of the depset object.
func (*Depset[TReference, TMetadata]) CompareSameType ¶
func (d *Depset[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
CompareSameType can be used to compare depsets for equality. Depsets only offer reference equality.
func (*Depset[TReference, TMetadata]) Encode ¶
func (d *Depset[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Depset, TMetadata], bool, error)
Encode a depset value to a Protobuf message. This method is identical to EncodeValue(), except that can be used in cases where the value may only be a depset.
func (*Depset[TReference, TMetadata]) EncodeValue ¶
func (d *Depset[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a depset value to a Starlark value Protobuf message.
Whereas the depset.to_list() function only returns unique occurrences of every element, an encoded depset may still contain duplicates.
Even though we use the same message format as regular lists, there is no guarantee that all leaves are stored at the same depth. The reason for this is that when merging depset, we never attempt to reload any existing lists from torage. If a depset with a non-zero height is encountered, we merely copy over its top level elements. Even though this leads to an imbalance, it does lead to faster deduplication in depset.to_list().
func (Depset[TReference, TMetadata]) Freeze ¶
func (Depset[TReference, TMetadata]) Freeze()
Freeze the contents of the depset. As we assume that all values contained in the depset are hashable and therefore immutable, this method does nothing.
type DepsetContents ¶
type DepsetContents[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
DepsetContents holds the elements contained in a Starlark depset object.
This type is not directly usable as a Starlark value type. The reason being that Bazel requires depsets to provide reference equality. This is provided by the Depset type, which embeds DepsetContents and a unique identifier.
func NewDepsetContents ¶
func NewDepsetContents[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata]( thread *starlark.Thread, direct []starlark.Value, transitive []*Depset[TReference, TMetadata], order model_starlark_pb.Depset_Order, ) (*DepsetContents[TReference, TMetadata], error)
NewDepsetContents takes lists of Starlark values and depsets and returns a DepsetContents that corresponds to the union of all values. This function can be used to implement the depset() constructor function.
func NewDepsetContentsFromList ¶
func NewDepsetContentsFromList[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata]( children []any, order model_starlark_pb.Depset_Order, ) *DepsetContents[TReference, TMetadata]
NewDepsetContentsFromList constructs a DepsetContents, given a single list of decoded values (starlark.Value) or lists of encoded values (model_core.Message[*model_starlark_pb.List_Element, TReference]). This function can be used to construct depsets that are (partially) backed by storage.
func (*DepsetContents[TReference, TMetadata]) EncodeList ¶
func (dc *DepsetContents[TReference, TMetadata]) EncodeList(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[[]*model_starlark_pb.List_Element, TMetadata], bool, error)
EncodeList encodes a depset value to a Protobuf message in the form of a (non-deduplicated) list. This method is identical to Encode(), except that can be used in cases where only the elements need to be retained, and the "order" field of the depset is of no importance.
func (*DepsetContents[TReference, TMetadata]) ToList ¶
func (dc *DepsetContents[TReference, TMetadata]) ToList(thread *starlark.Thread) ([]starlark.Value, error)
ToList extracts all elements contained in the depset and returns them as a list. If the depset contains duplicate elements, only the first occurrence is retained.
type EncodableValue ¶
type EncodableValue[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error) }
type ExecGroup ¶
type ExecGroup[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
func NewExecGroup ¶
func NewExecGroup[TReference any, TMetadata model_core.CloneableReferenceMetadata](execCompatibleWith []pg_label.ResolvedLabel, toolchains []*ToolchainType[TReference, TMetadata]) *ExecGroup[TReference, TMetadata]
func (*ExecGroup[TReference, TMetadata]) Encode ¶
func (eg *ExecGroup[TReference, TMetadata]) Encode() *model_starlark_pb.ExecGroup
func (*ExecGroup[TReference, TMetadata]) EncodeValue ¶
func (eg *ExecGroup[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
type File ¶
type File[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
func NewFile ¶
func NewFile[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](definition model_core.Message[*model_starlark_pb.File, TReference]) *File[TReference, TMetadata]
func (*File[TReference, TMetadata]) CompareSameType ¶
func (*File[TReference, TMetadata]) EncodeValue ¶
func (f *File[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
func (*File[TReference, TMetadata]) GetDefinition ¶
func (f *File[TReference, TMetadata]) GetDefinition() model_core.Message[*model_starlark_pb.File, TReference]
func (*File[TReference, TMetadata]) GetTreeRelativePath ¶
func (*File[TReference, TMetadata]) WithTreeRelativePath ¶
func (f *File[TReference, TMetadata]) WithTreeRelativePath(treeRelativePath *bb_path.Trace) *File[TReference, TMetadata]
WithTreeRelativePath can be used by DirectoryExpander.expand() to convert a File of a directory to an instance that refers to a regular file contained within the directory.
type Filesystem ¶
type FunctionFactoryResolver ¶
type FunctionFactoryResolver = func(filename pg_label.CanonicalLabel) (*starlark.FunctionFactory, error)
type GlobExpander ¶
type GlobalResolver ¶
type GlobalResolver[TReference any] = func(identifier pg_label.CanonicalStarlarkIdentifier) (model_core.Message[*model_starlark_pb.Value, TReference], error)
type HasLabels ¶
type HasLabels interface {
VisitLabels(thread *starlark.Thread, path map[starlark.Value]struct{}, visitor func(pg_label.ResolvedLabel) error) error
}
HasLabels can be implemented by Starlark values that potentially contain label values. This allows the labels contained within to be visited by calling VisitLabels().
type Label ¶
type Label[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
func (Label[TReference, TMetadata]) EncodeValue ¶
func (l Label[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
type LateNamedValue ¶
type LateNamedValue struct {
Identifier *pg_label.CanonicalStarlarkIdentifier
}
func (*LateNamedValue) AssignIdentifier ¶
func (lnv *LateNamedValue) AssignIdentifier(identifier pg_label.CanonicalStarlarkIdentifier)
type ModuleExtensionDefinition ¶
type ModuleExtensionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { EncodableValue[TReference, TMetadata] }
func NewProtoModuleExtensionDefinition ¶
func NewProtoModuleExtensionDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](message model_core.Message[*model_starlark_pb.ModuleExtension, TReference]) ModuleExtensionDefinition[TReference, TMetadata]
func NewStarlarkModuleExtensionDefinition ¶
func NewStarlarkModuleExtensionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](implementation NamedFunction[TReference, TMetadata], tagClasses map[pg_label.StarlarkIdentifier]*TagClass[TReference, TMetadata]) ModuleExtensionDefinition[TReference, TMetadata]
type NamedFunction ¶
type NamedFunction[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { NamedFunctionDefinition[TReference, TMetadata] }
func NewNamedFunction ¶
func NewNamedFunction[TReference any, TMetadata model_core.CloneableReferenceMetadata](definition NamedFunctionDefinition[TReference, TMetadata]) NamedFunction[TReference, TMetadata]
func (NamedFunction[TReference, TMetadata]) EncodeValue ¶
func (f NamedFunction[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
func (NamedFunction[TReference, TMetadata]) Freeze ¶
func (f NamedFunction[TReference, TMetadata]) Freeze()
func (NamedFunction[TReference, TMetadata]) Hash ¶
func (f NamedFunction[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
func (NamedFunction[TReference, TMetadata]) String ¶
func (f NamedFunction[TReference, TMetadata]) String() string
func (NamedFunction[TReference, TMetadata]) Truth ¶
func (f NamedFunction[TReference, TMetadata]) Truth() starlark.Bool
func (NamedFunction[TReference, TMetadata]) Type ¶
func (f NamedFunction[TReference, TMetadata]) Type() string
type NamedFunctionDefinition ¶
type NamedFunctionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Function, TMetadata], bool, error) Name() string Position() syntax.Position NumParams(thread *starlark.Thread) (int, error) }
func NewProtoNamedFunctionDefinition ¶
func NewProtoNamedFunctionDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](message model_core.Message[*model_starlark_pb.Function, TReference]) NamedFunctionDefinition[TReference, TMetadata]
func NewStarlarkNamedFunctionDefinition ¶
func NewStarlarkNamedFunctionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](function *starlark.Function) NamedFunctionDefinition[TReference, TMetadata]
type NamedGlobal ¶
type NamedGlobal interface { starlark.Value AssignIdentifier(identifier pg_label.CanonicalStarlarkIdentifier) }
type PathResolver ¶
type PathResolver struct {
CurrentPath *BarePath
}
func (*PathResolver) OnAbsolute ¶
func (r *PathResolver) OnAbsolute() (bb_path.ComponentWalker, error)
func (*PathResolver) OnDirectory ¶
func (r *PathResolver) OnDirectory(name bb_path.Component) (bb_path.GotDirectoryOrSymlink, error)
func (*PathResolver) OnDriveLetter ¶
func (r *PathResolver) OnDriveLetter(drive rune) (bb_path.ComponentWalker, error)
func (*PathResolver) OnRelative ¶
func (r *PathResolver) OnRelative() (bb_path.ComponentWalker, error)
func (*PathResolver) OnShare ¶
func (r *PathResolver) OnShare(server, share string) (bb_path.ComponentWalker, error)
func (*PathResolver) OnTerminal ¶
func (r *PathResolver) OnTerminal(name bb_path.Component) (*bb_path.GotSymlink, error)
func (*PathResolver) OnUp ¶
func (r *PathResolver) OnUp() (bb_path.ComponentWalker, error)
type Provider ¶
type Provider[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { *ProviderInstanceProperties[TReference, TMetadata] // contains filtered or unexported fields }
func DecodeProvider ¶
func DecodeProvider[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](m model_core.Message[*model_starlark_pb.Provider, TReference]) (*Provider[TReference, TMetadata], error)
func NewProvider ¶
func NewProvider[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](instanceProperties *ProviderInstanceProperties[TReference, TMetadata], fields []string, initFunction *NamedFunction[TReference, TMetadata]) *Provider[TReference, TMetadata]
func (*Provider[TReference, TMetadata]) CallInternal ¶
func (*Provider[TReference, TMetadata]) EncodeValue ¶
func (p *Provider[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
func (*Provider[TReference, TMetadata]) Instantiate ¶
type ProviderInstanceProperties ¶
type ProviderInstanceProperties[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { LateNamedValue // contains filtered or unexported fields }
func NewProviderInstanceProperties ¶
func NewProviderInstanceProperties[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, dictLike bool, computedFields map[string]NamedFunction[TReference, TMetadata], typeName string) *ProviderInstanceProperties[TReference, TMetadata]
func (*ProviderInstanceProperties[TReference, TMetadata]) Encode ¶
func (pip *ProviderInstanceProperties[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Provider_InstanceProperties, TMetadata], bool, error)
type ReferenceEqualIdentifierGenerator ¶
type ReferenceEqualIdentifierGenerator func() []byte
ReferenceEqualIdentifierGenerator is called when Starlark values are created that only offer reference equality, such as depsets. This function is supposed to yield a unique identifier for each Starlark value.
type RepoPathResolver ¶
type RepoPathResolver func(canonicalRepo pg_label.CanonicalRepo) (*BarePath, error)
type RepoRegistrar ¶
type RepoRegistrar[TMetadata model_core.ReferenceMetadata] struct { // contains filtered or unexported fields }
func NewRepoRegistrar ¶
func NewRepoRegistrar[TMetadata model_core.ReferenceMetadata]() *RepoRegistrar[TMetadata]
func (*RepoRegistrar[TMetadata]) GetRepos ¶
func (rr *RepoRegistrar[TMetadata]) GetRepos() map[string]model_core.PatchedMessage[*model_starlark_pb.Repo, TMetadata]
type RepositoryRuleDefinition ¶
type RepositoryRuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.RepositoryRule_Definition, TMetadata], bool, error) GetAttrsCheap(thread *starlark.Thread) (map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], error) }
func NewProtoRepositoryRuleDefinition ¶
func NewProtoRepositoryRuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](message model_core.Message[*model_starlark_pb.RepositoryRule_Definition, TReference]) RepositoryRuleDefinition[TReference, TMetadata]
func NewStarlarkRepositoryRuleDefinition ¶
func NewStarlarkRepositoryRuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](implementation NamedFunction[TReference, TMetadata], attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata]) RepositoryRuleDefinition[TReference, TMetadata]
type RootModuleResolver ¶
type RuleDefinition ¶
type RuleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Rule_Definition, TMetadata], bool, error) GetAttrsCheap(thread *starlark.Thread) (map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], error) GetBuildSetting(thread *starlark.Thread) (*BuildSetting, error) GetInitializer(thread *starlark.Thread) (*NamedFunction[TReference, TMetadata], error) GetTest(thread *starlark.Thread) (bool, error) }
func NewProtoRuleDefinition ¶
func NewProtoRuleDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](message model_core.Message[*model_starlark_pb.Rule_Definition, TReference]) RuleDefinition[TReference, TMetadata]
func NewReloadingRuleDefinition ¶
func NewReloadingRuleDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](identifier pg_label.CanonicalStarlarkIdentifier) RuleDefinition[TReference, TMetadata]
func NewStarlarkRuleDefinition ¶
func NewStarlarkRuleDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata]( attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], buildSetting *BuildSetting, cfg *Transition[TReference, TMetadata], execGroups map[string]*ExecGroup[TReference, TMetadata], implementation NamedFunction[TReference, TMetadata], initializer *NamedFunction[TReference, TMetadata], provides []*Provider[TReference, TMetadata], test bool, subrules []*Subrule[TReference, TMetadata], ) RuleDefinition[TReference, TMetadata]
type Select ¶
type Select[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
Select is the type of the Starlark value that is returned by the select() function. These values can be used to make a value provided to a rule attribute configurable by letting the eventual value depend on whether conditions are satisfied.
The select() function is not responsible for actually evaluating the conditions and selecting the eventual value. Instead, it merely records the conditions and their values.
It is possible to combine multiple Starlark select() objects using the + or | operator. This also does not cause any conditions to be evaluated. Instead, it causes a new select() object to be returned, recording all of the conditions and the order in which they are supplied.
func NewSelect ¶
func NewSelect[TReference any, TMetadata model_core.CloneableReferenceMetadata](groups []SelectGroup, concatenationOperator syntax.Token) *Select[TReference, TMetadata]
NewSelect returns a new Starlark select() object that contains the provided groups of conditions.
func (*Select[TReference, TMetadata]) Binary ¶
func (s *Select[TReference, TMetadata]) Binary(thread *starlark.Thread, op syntax.Token, y starlark.Value, side starlark.Side) (starlark.Value, error)
Binary implements concatenation of two Starlark select() objects, or concatenation of a Starlark select() object with another value. In case of the latter, the value is converted to a select() group having only a default condition.
func (*Select[TReference, TMetadata]) EncodeGroups ¶
func (s *Select[TReference, TMetadata]) EncodeGroups(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[[]*model_starlark_pb.Select_Group, TMetadata], bool, error)
EncodeGroups encodes the groups contained within the Starlark select() object to a list of Protobuf messages.
This method differs from EncodeValue() in that it only returns the groups. This is sufficient for cases where the value is known to be a select() object, such as during the computation of targets in a package.
func (*Select[TReference, TMetadata]) EncodeValue ¶
func (s *Select[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a Starlar select() object to a Starlark value Protobuf message. This allows the object to be written to storage and subsequently reloaded.
func (*Select[TReference, TMetadata]) Freeze ¶
func (s *Select[TReference, TMetadata]) Freeze()
Freeze a Starlark select() object, so that it can no longer be mutated.
Even though Starlark select() objects themselves are immutable, they may contain conditions whose values are mutable. We therefore need to traverse over all condition values and freeze them.
func (Select[TReference, TMetadata]) Hash ¶
Hash the Starlark select() object, so that it can be used as a key in a dictionary. For Starlark select() objects, this is not supported.
func (Select[TReference, TMetadata]) Truth ¶
Truth returns whether a Starlark select() object should be true or false when implicitly converted to a Boolean value. Starlark select() objects always evaluate to true.
func (Select[TReference, TMetadata]) Type ¶
Type returns the type name of a Starlark select() object.
func (*Select[TReference, TMetadata]) VisitLabels ¶
func (s *Select[TReference, TMetadata]) VisitLabels(thread *starlark.Thread, path map[starlark.Value]struct{}, visitor func(pg_label.ResolvedLabel) error) error
VisitLabels visits all labels contained within the Starlark select() object. This includes identifiers of conditions and labels contained within condition values.
type SelectGroup ¶
type SelectGroup struct {
// contains filtered or unexported fields
}
SelectGroup contains all of the conditions provided to a single call to select(). Each Starlark select() object contains one or more groups. Multiple groups occur if select() objects are combined using the + or | operator.
func NewSelectGroup ¶
func NewSelectGroup(conditions map[pg_label.ResolvedLabel]starlark.Value, defaultValue starlark.Value, noMatchError string) SelectGroup
NewSelectGroup creates a single group of conditions of a Starlark select() object. This function is called exactly once for each invocation to select().
type Struct ¶
type Struct[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
Struct value that is either created using struct() or by calling into a provider.
We assume that the number of fields in a struct is small enough, that the keys of a struct don't exceed the maximum size of an object in storage. This allows us to store all keys in a sorted list. The values of the fields may then be stored in a separate B-tree backed list. This allows functions like dir() and hasattr() to perform well and not read an excessive amount of data from storage.
func DecodeStruct ¶
func DecodeStruct[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](m model_core.Message[*model_starlark_pb.Struct, TReference], options *ValueDecodingOptions[TReference]) (*Struct[TReference, TMetadata], error)
func NewStructFromDict ¶
func NewStructFromDict[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](providerInstanceProperties *ProviderInstanceProperties[TReference, TMetadata], entries map[string]any) *Struct[TReference, TMetadata]
NewStructFromDict creates a Starlark struct value that has the fields that are specified in a map. Values may either be decoded or encoded, having types starlark.Value and model_core.Message[*model_starlark_pb.Value, TReference], respectively.
func (*Struct[TReference, TMetadata]) Attr ¶
func (s *Struct[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
Attr returns the value of a field contained in a Starlark struct value.
func (*Struct[TReference, TMetadata]) AttrNames ¶
AttrNames returns the names of the fields contained in a Starlark struct value.
func (*Struct[TReference, TMetadata]) CompareSameType ¶
func (s *Struct[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
CompareSameType compares two Starlark struct values for equality. Structs are considered equal if the names and values of each field are equal.
func (*Struct[TReference, TMetadata]) Encode ¶
func (s *Struct[TReference, TMetadata]) Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Struct, TMetadata], bool, error)
Encode a Starlark struct value and all of its fields to a Struct Protobuf message. This allows it to be written to storage and reloaded later.
This method differs from EncodeValue() in that it returns a bare Struct message. This should be used in cases where a value is expected to only be a struct or provider instance, such as the return value of a rule implementation function.
func (*Struct[TReference, TMetadata]) EncodeStructFields ¶
func (s *Struct[TReference, TMetadata]) EncodeStructFields(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Struct_Fields, TMetadata], bool, error)
EncodeStructFields encodes the fields of a Starlark struct value to a list of a list of Protobuf messages. This allows the fields to be written to storage and reloaded later.
This method differs from Encode() and EncodeValue() in that it returns a bare list of fields. This should be used in cases where a value is expected to only be a struct, and any provider identifier may be discarded.
func (*Struct[TReference, TMetadata]) EncodeValue ¶
func (s *Struct[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a Starlark struct value and all of its fields to a Starlark value Protobuf message. This allows it to be written to storage and reloaded later.
func (*Struct[TReference, TMetadata]) Freeze ¶
func (s *Struct[TReference, TMetadata]) Freeze()
Freeze a Starlark struct value and any value contained inside of it. Even though the struct itself is immutable, a struct is permitted to contain fields having mutable values. We therefore need to traverse all fields.
func (*Struct[TReference, TMetadata]) Get ¶
func (s *Struct[TReference, TMetadata]) Get(thread *starlark.Thread, key starlark.Value) (starlark.Value, bool, error)
Get a field contained in a Starlark struct value.
func (*Struct[TReference, TMetadata]) GetProviderIdentifier ¶
func (s *Struct[TReference, TMetadata]) GetProviderIdentifier() (pg_label.CanonicalStarlarkIdentifier, error)
GetProviderIdentifier returns the identifier of the provider that was used to construct this Starlark struct value. This method fails if this Starlark struct value was created by calling struct(), as opposed to using a provider.
func (*Struct[TReference, TMetadata]) ToDict ¶
ToDict returns the fields contained in a Starlark struct value in the form of a dictionary. The resulting values may either be decoded or encoded, having types starlark.Value and model_core.Message[*model_starlark_pb.Value, TReference], respectively.
type Subrule ¶
type Subrule[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { LateNamedValue // contains filtered or unexported fields }
Subrule corresponds to a Starlark value of a subrule. Subrules are effectively simplified rules that cannot be instantiated in the form of rule targets. Instead, they can be invoked as part of the implementation function of a rule or another subrule.
Subrules effectively act as utility functions that also have label attributes bound to them.
func (*Subrule[TReference, TMetadata]) CallInternal ¶
func (sr *Subrule[TReference, TMetadata]) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
CallInternal is invoked when a rule implementation calls into a subrule.
func (*Subrule[TReference, TMetadata]) EncodeValue ¶
func (sr *Subrule[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a subrule to a Starlark value Protobuf message. This allows it to be written to storage and subsequently reloaded during target configuration.
func (Subrule[TReference, TMetadata]) Freeze ¶
func (Subrule[TReference, TMetadata]) Freeze()
Freeze the subrule. Because subrules are immutable, this method has no effect.
func (Subrule[TReference, TMetadata]) Hash ¶
Hash a subrule, so that it can be used as a key in a dictionary. For subrules, this is not supported.
func (*Subrule[TReference, TMetadata]) Name ¶
Name returns the name of the subrule. This typically corresponds to the Starlark identifier of the global variable to which the subrule is assigned. If no such assignment is made, a placeholder string is returned.
type SubruleDefinition ¶
type SubruleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Subrule_Definition, TMetadata], bool, error) }
SubruleDefinition contains the definition of a subrule.
func NewProtoSubruleDefinition ¶
func NewProtoSubruleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata]() SubruleDefinition[TReference, TMetadata]
NewProtoSubruleDefinition contains the definition of a subrule that was declared in another .bzl file and has subsequently been written to storage.
As subrules are only accessed during target configuration and this is not done by directly referencing the Starlark value object, there is no need for this type to retain any information. There is also no way for the definition of a subrule to be carried over between .bzl files, as such indirection is always done by referencing the original identifier of the subrule. This type therefore merely acts as a placeholder.
func NewStarlarkSubruleDefinition ¶
func NewStarlarkSubruleDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata]( attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata], implementation NamedFunction[TReference, TMetadata], subrules []*Subrule[TReference, TMetadata], ) SubruleDefinition[TReference, TMetadata]
NewStarlarkSubruleDefinition creates the definition of a subrule, given the parameters that were provided to the subrule() function.
type SubruleInvoker ¶
type SubruleInvoker = func(subruleIdentifier pg_label.CanonicalStarlarkIdentifier, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
SubruleInvoker is a callback type that is invoked when a rule implementation calls into a subrule. It is the callback's responsibility for actually executing the subrule and returning the subrule's return value.
type TagClass ¶
type TagClass[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { TagClassDefinition[TReference, TMetadata] }
TagClass is a Starlark value type for module extension tag classes. MODULE.bazel files may call use_extension() to declare a dependency on a module extension. After calling use_extension(), the module extension may be annotated with tags. A tag class describes a kind of tag, and defines which attributes may be provided to the tag.
func (*TagClass[TReference, TMetadata]) EncodeValue ¶
func (tc *TagClass[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a module extension tag class to a Starlark value Protobuf message. This allows it to be written to storage, so that it can be reloaded at a later point in time.
func (TagClass[TReference, TMetadata]) Freeze ¶
func (TagClass[TReference, TMetadata]) Freeze()
Freeze the contents of a module extension tag class. This function has no effect, as tag classes are immutable.
func (TagClass[TReference, TMetadata]) Hash ¶
Hash a module extension tag class, so that it can be used as the key of a dictionary. This is not supported.
type TagClassDefinition ¶
type TagClassDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { Encode(path map[starlark.Value]struct{}, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.TagClass, TMetadata], bool, error) }
TagClassDefinition contains the definition of a module extension tag class, which may either be backed by other Starlark values due to a call to tag_class() from within a .bzl file, or be backed by a previous encoded definition that has been written to storage.
func NewProtoTagClassDefinition ¶
func NewProtoTagClassDefinition[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata](message model_core.Message[*model_starlark_pb.TagClass, TReference]) TagClassDefinition[TReference, TMetadata]
NewProtoTagClassDefinition creates a new module extension tag class definition that is backed by a definition that is backed by storage.
This function is invoked when a module extension tag class is stored in a global variable, so that it can be reused by other .bzl files. This is not very common, but does occur in practice.
func NewStarlarkTagClassDefinition ¶
func NewStarlarkTagClassDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](attrs map[pg_label.StarlarkIdentifier]*Attr[TReference, TMetadata]) TagClassDefinition[TReference, TMetadata]
NewStarlarkTagClassDefinition creates a new module extension tag class definition, given definitions for the tag class's attributes.
This function is called when tag_class() is invoked from within a .bzl file.
type TargetReference ¶
type TargetReference[TReference object.BasicReference, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
TargetReference is a Starlark value corresponding to the Target type. These are the values that rule implementations may access through ctx.attr or ctx.split_attr.
func (*TargetReference[TReference, TMetadata]) Attr ¶
func (tr *TargetReference[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
Attr returns the value of an attribute of a Starlark Target value.
The only attribute provided by the Target value itself is "label", which returns the label of the configured target. The other attributes are merely forwarded to the DefaultInfo provider. This allows these commonly used fields to be accessed with less indirection.
func (*TargetReference[TReference, TMetadata]) AttrNames ¶
func (tr *TargetReference[TReference, TMetadata]) AttrNames() []string
AttrNames returns the attribute names of a Starlark Target value.
func (*TargetReference[TReference, TMetadata]) CompareSameType ¶
func (tr *TargetReference[TReference, TMetadata]) CompareSameType(thread *starlark.Thread, op syntax.Token, other starlark.Value, depth int) (bool, error)
CompareSameType can be used to compare Starlark Target values for equality.
func (*TargetReference[TReference, TMetadata]) EncodeValue ¶
func (tr *TargetReference[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes a Starlark Target value to a Protobuf message, so that it can be written to storage and restored at a later point in time.
func (TargetReference[TReference, TMetadata]) Freeze ¶
func (TargetReference[TReference, TMetadata]) Freeze()
Freeze the contents of a Starlark Target value. This function has no effect, as a Target value is immutable.
func (*TargetReference[TReference, TMetadata]) Get ¶
func (tr *TargetReference[TReference, TMetadata]) Get(thread *starlark.Thread, v starlark.Value) (starlark.Value, bool, error)
Get the value of a given provider from the Starlark Target value. This is called when a rule invokes ctx.attr.myattr[MyProviderInfo].
func (*TargetReference[TReference, TMetadata]) Hash ¶
func (tr *TargetReference[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
Hash a Starlark Target value, so that it can be used as the key of a dictionary. As we assume that the number of targets having the same label, but a different configuration is fairly low, we simply hash the target's label.
func (*TargetReference[TReference, TMetadata]) String ¶
func (tr *TargetReference[TReference, TMetadata]) String() string
func (TargetReference[TReference, TMetadata]) Truth ¶
func (TargetReference[TReference, TMetadata]) Truth() starlark.Bool
Truth returns whether the Starlark Target value evaluates to true or false when implicitly converted to a Boolean value. Starlark Target values always convert to true.
func (TargetReference[TReference, TMetadata]) Type ¶
func (TargetReference[TReference, TMetadata]) Type() string
Type returns the name of the type of a Starlark Target value.
type TargetRegistrar ¶
type TargetRegistrar[TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
TargetRegistrar can be called into by functions like alias(), exports_files(), label_flag(), label_setting(), package_group() and invocations of rules to register any targets in the current package.
func NewTargetRegistrar ¶
func NewTargetRegistrar[TMetadata model_core.CloneableReferenceMetadata](encoder model_encoding.BinaryEncoder, inlinedTreeOptions *inlinedtree.Options, objectCapturer model_core.CreatedObjectCapturer[TMetadata], defaultInheritableAttrs model_core.Message[*model_starlark_pb.InheritableAttrs, model_core.CloneableReference[TMetadata]]) *TargetRegistrar[TMetadata]
NewTargetRegistrar creates a TargetRegistrar that at the time of creation contains no targets. The caller needs to provide default values for attributes that are provided to calls to repo() in REPO.bazel, so that they can be inherited by registered targets.
func (*TargetRegistrar[TMetadata]) GetTargets ¶
func (tr *TargetRegistrar[TMetadata]) GetTargets() map[string]model_core.PatchedMessage[*model_starlark_pb.Target_Definition, TMetadata]
GetTargets returns the set of targets in the current package that have been registered against this TargetRegistrar.
This method returns a map that is keyed by target name. The value denotes the definition of the target. The value may be left unset if the target is implicit, meaning that it is referenced by one of its siblings, but no explicit declaration is provided. The caller may assume that such targets refer to source files that are part of this package.
type ToolchainType ¶
type ToolchainType[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { // contains filtered or unexported fields }
ToolchainType corresponds to a Starlark toolchain type object, as normally created by the config_common.toolchain_type() function. These objects can be used to refer to toolchains, expressing whether the dependency on a toolchain is mandatory or optional.
func NewToolchainType ¶
func NewToolchainType[TReference any, TMetadata model_core.CloneableReferenceMetadata](toolchainType pg_label.ResolvedLabel, mandatory bool) *ToolchainType[TReference, TMetadata]
NewToolchainType returns a Starlark toolchain type object, as normally created by the config_common.toolchain_type() function.
func (*ToolchainType[TReference, TMetadata]) Attr ¶
func (tt *ToolchainType[TReference, TMetadata]) Attr(thread *starlark.Thread, name string) (starlark.Value, error)
Attr can be used to access attributes of the Starlark toolchain type object. These attributes correspond to the properties that were used to construct the toolchain type object.
func (*ToolchainType[TReference, TMetadata]) AttrNames ¶
func (tt *ToolchainType[TReference, TMetadata]) AttrNames() []string
AttrNames returns the names of the attributes of the Starlark toolchain type object. These attributes can be used to access the properties that were used to construct the toolchain type object.
func (*ToolchainType[TReference, TMetadata]) Encode ¶
func (tt *ToolchainType[TReference, TMetadata]) Encode() *model_starlark_pb.ToolchainType
Encode the properties of a Starlark toolchain type value in the form of a Protobuf message, so that it can be written to storage.
func (*ToolchainType[TReference, TMetadata]) EncodeValue ¶
func (tt *ToolchainType[TReference, TMetadata]) EncodeValue(path map[starlark.Value]struct{}, currentIdentifier *pg_label.CanonicalStarlarkIdentifier, options *ValueEncodingOptions[TReference, TMetadata]) (model_core.PatchedMessage[*model_starlark_pb.Value, TMetadata], bool, error)
EncodeValue encodes the properties of a Starlark toolchain type value in the form of a Starlark value Protobuf message, so that it can be written to storage. As toolchain types contain relatively little information, the resulting message never contains any outgoing references.
func (ToolchainType[TReference, TMetadata]) Freeze ¶
func (ToolchainType[TReference, TMetadata]) Freeze()
Freeze the contents of the toolchain type object. As toolchain type objects are immutable, this method has no effect.
func (ToolchainType[TReference, TMetadata]) Hash ¶
func (ToolchainType[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
Hash the Starlark toolchain type object, so that it can be used as a key in a dictionary. This method is not implemented for toolchain type objects.
func (*ToolchainType[TReference, TMetadata]) Merge ¶
func (tt *ToolchainType[TReference, TMetadata]) Merge(other *ToolchainType[TReference, TMetadata]) *ToolchainType[TReference, TMetadata]
Merge two toolchain type objects together that have the same toolchain type label. This is used when constructing exec group objects to filter any toolchain types that are specified redundantly.
func (ToolchainType[TReference, TMetadata]) String ¶
func (ToolchainType[TReference, TMetadata]) String() string
func (ToolchainType[TReference, TMetadata]) Truth ¶
func (ToolchainType[TReference, TMetadata]) Truth() starlark.Bool
Truth returns whether the Starlark toolchain type object should evaluate to true or false when implicitly converted to a Boolean value. Toolchain type objects always evaluate to true.
func (ToolchainType[TReference, TMetadata]) Type ¶
func (ToolchainType[TReference, TMetadata]) Type() string
Type returns the type name of the Starlark toolchain type object.
type Transition ¶
type Transition[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { TransitionDefinition[TReference, TMetadata] }
Transition is a Starlark value type that corresponds to a predeclared or user defined transition. Transitions can be used to mutate a configuration, either as part of an incoming or outgoing edge in the build graph.
func (Transition[TReference, TMetadata]) Freeze ¶
func (Transition[TReference, TMetadata]) Freeze()
Freeze the definition of the transition. As transitions are immutable, this function has no effect.
func (Transition[TReference, TMetadata]) Hash ¶
func (Transition[TReference, TMetadata]) Hash(thread *starlark.Thread) (uint32, error)
Hash the transition object, so that it may be used as the key in a dictionary. This is currently not supported.
func (Transition[TReference, TMetadata]) String ¶
func (Transition[TReference, TMetadata]) String() string
func (Transition[TReference, TMetadata]) Truth ¶
func (Transition[TReference, TMetadata]) Truth() starlark.Bool
Truth returns whether the transition is a truthy or a falsy. Transitions are always truthy.
func (Transition[TReference, TMetadata]) Type ¶
func (Transition[TReference, TMetadata]) Type() string
Type returns a string representation of the type of a transition.
type TransitionDefinition ¶
type TransitionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata] interface { EncodableValue[TReference, TMetadata] AssignIdentifier(identifier pg_label.CanonicalStarlarkIdentifier) EncodeReference() (*model_starlark_pb.Transition_Reference, error) GetUserDefinedTransitionIdentifier() (string, error) }
TransitionDefinition contains the definition of a configuration transition. For user defined transitions this may contain all of the transition's properties (inputs, outputs, reference to an implementation function). For predeclared transitions ("exec", "target", config.none(), etc.), the definition may be trivial.
func NewReferenceTransitionDefinition ¶
func NewReferenceTransitionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](reference *model_starlark_pb.Transition_Reference) TransitionDefinition[TReference, TMetadata]
NewReferenceTransitionDefinition creates a reference to a transition. These may either refer to a user defined transition using its Starlark identifier, or a predeclared transition ("exec", "target", config.none(), etc.).
func NewUserDefinedTransitionDefinition ¶
func NewUserDefinedTransitionDefinition[TReference any, TMetadata model_core.CloneableReferenceMetadata](identifier *pg_label.CanonicalStarlarkIdentifier, implementation NamedFunction[TReference, TMetadata], inputs, outputs []string) TransitionDefinition[TReference, TMetadata]
NewUserDefinedTransitionDefinition creates an object holding the properties of a new user defined transition, as normally done by exec_transition() or transition().
type ValueDecodingOptions ¶
type ValueDecodingOptions[TReference any] struct { Context context.Context Readers *ValueReaders[TReference] LabelCreator func(pg_label.ResolvedLabel) (starlark.Value, error) BzlFileBuiltins starlark.StringDict }
type ValueEncodingOptions ¶
type ValueEncodingOptions[TReference any, TMetadata model_core.CloneableReferenceMetadata] struct { CurrentFilename *pg_label.CanonicalLabel // Options to use when storing Starlark values in separate objects. ObjectEncoder model_encoding.BinaryEncoder ObjectReferenceFormat object.ReferenceFormat ObjectCapturer model_core.ObjectCapturer[TReference, TMetadata] ObjectMinimumSizeBytes int ObjectMaximumSizeBytes int }
func (*ValueEncodingOptions[TReference, TMetadata]) ComputeListParentNode ¶
func (o *ValueEncodingOptions[TReference, TMetadata]) ComputeListParentNode(createdObject model_core.Decodable[model_core.CreatedObject[TMetadata]], childNodes []*model_starlark_pb.List_Element) model_core.PatchedMessage[*model_starlark_pb.List_Element, TMetadata]
type ValueReaders ¶
type ValueReaders[TReference any] struct { Dict model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.Dict_Entry, TReference]] List model_parser.ParsedObjectReader[model_core.Decodable[TReference], model_core.Message[[]*model_starlark_pb.List_Element, TReference]] }
Source Files
¶
- aspect.go
- attr.go
- build_setting.go
- builtins.go
- depset.go
- dict.go
- encode_compiled_program.go
- exec_group.go
- file.go
- label.go
- list.go
- module_extension.go
- named_function.go
- named_global.go
- package_group.go
- parse_repo_dot_bazel.go
- path.go
- provider.go
- reference_equal.go
- repo_registrar.go
- repository_rule.go
- rule.go
- select.go
- struct.go
- subrule.go
- tag_class.go
- target_reference.go
- target_registrar.go
- toolchain_type.go
- transition.go
- visit_labels.go