graph

package
v0.0.0-...-016edcc Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const InlineGroups = true

Variables

This section is empty.

Functions

func Contains

func Contains(ts []*Target, addr string) bool

Types

type ArtifactHash

type ArtifactHash [2]artifacts.Artifact

func (ArtifactHash) Hash

func (a ArtifactHash) Hash() artifacts.Artifact

func (ArtifactHash) Tar

type ArtifactRegistry

type ArtifactRegistry struct {
	InputHash    artifacts.Artifact
	Log          artifacts.Artifact
	Manifest     artifacts.Artifact
	Out          map[string]ArtifactHash
	RestoreCache *artifacts.Artifact
	// contains filtered or unexported fields
}

func (*ArtifactRegistry) All

func (o *ArtifactRegistry) All() []artifacts.Artifact

func (*ArtifactRegistry) GetRestoreCache

func (o *ArtifactRegistry) GetRestoreCache() (artifacts.Artifact, bool)

func (*ArtifactRegistry) OutHash

func (o *ArtifactRegistry) OutHash(name string) artifacts.Artifact

func (*ArtifactRegistry) OutTar

func (o *ArtifactRegistry) OutTar(name string) artifacts.Artifact

func (*ArtifactRegistry) OutTar2

func (o *ArtifactRegistry) OutTar2(name string) (artifacts.Artifact, bool)

type DAG

type DAG struct {
	*dag.DAG
}

func (*DAG) GetAncestors

func (d *DAG) GetAncestors(target specs.Specer) ([]*Target, error)

func (*DAG) GetAncestorsOfAddr

func (d *DAG) GetAncestorsOfAddr(addr string) ([]*Target, error)

func (*DAG) GetChildren

func (d *DAG) GetChildren(target specs.Specer) ([]*Target, error)

func (*DAG) GetDescendants

func (d *DAG) GetDescendants(target specs.Specer) ([]*Target, error)

func (*DAG) GetDescendantsOfAddr

func (d *DAG) GetDescendantsOfAddr(addr string) ([]*Target, error)

func (*DAG) GetFileChildren

func (d *DAG) GetFileChildren(paths []string, universe []*Target) []*Target

GetFileChildren returns targets directly depending on file

func (*DAG) GetLeaves

func (d *DAG) GetLeaves() []*Target

func (*DAG) GetOrderedAncestors

func (d *DAG) GetOrderedAncestors(targets []*Target, includeRoot bool) ([]*Target, error)

func (*DAG) GetOrderedAncestorsWithOutput

func (d *DAG) GetOrderedAncestorsWithOutput(targets *Targets, includeRoot bool) (*Targets, *maps.Map[string, *sets.Set[string, string]], error)

func (*DAG) GetOrderedDescendants

func (d *DAG) GetOrderedDescendants(targets []*Target, includeRoot bool) ([]*Target, error)

func (*DAG) GetParents

func (d *DAG) GetParents(target specs.Specer) ([]*Target, error)

func (*DAG) GetVertices

func (d *DAG) GetVertices() []*Target

type ErrDoesNotHaveOutput

type ErrDoesNotHaveOutput struct {
	Addr, Output string
}

func (ErrDoesNotHaveOutput) Error

func (e ErrDoesNotHaveOutput) Error() string

type OutNamedPaths

type OutNamedPaths = tgt.NamedPaths[xfs.RelPaths, xfs.RelPath]

type State

type State struct {
	Root   *hroot.State
	Config *config.Config

	Tools *Targets
	// contains filtered or unexported fields
}

func NewState

func NewState(root *hroot.State, cfg *config.Config) *State

func (*State) CodegenPaths

func (e *State) CodegenPaths() map[string]*Target

func (*State) DAG

func (e *State) DAG() *DAG

func (*State) GeneratedTargets

func (e *State) GeneratedTargets() []*Target

func (*State) GetCodegenOrigin

func (e *State) GetCodegenOrigin(path string) (*Target, bool)

func (*State) HasLabel

func (e *State) HasLabel(label string) bool

func (*State) Labels

func (e *State) Labels() *sets.StringSet

func (*State) LinkTarget

func (e *State) LinkTarget(t *Target, breadcrumb *sets.StringSet) (rerr error)

func (*State) LinkTargets

func (e *State) LinkTargets(ctx context.Context, ignoreNotFoundError bool, targets []*Target, emit bool) error

func (*State) Register

func (e *State) Register(spec specs.Target) (*Target, error)

func (*State) RequiredMatchers

func (e *State) RequiredMatchers(ts []*Target) (specs.Matcher, error)

func (*State) Targets

func (e *State) Targets() *Targets

type Target

type Target struct {
	specs.Target

	GenSources        []*Target       `json:"-"`
	Tools             TargetTools     `json:"-"`
	Deps              TargetNamedDeps `json:"-"`
	RuntimeDeps       TargetNamedDeps `json:"-"`
	HashDeps          TargetDeps      `json:"-"`
	OutWithSupport    *OutNamedPaths
	Out               *OutNamedPaths
	RestoreCachePaths xfs.RelPaths
	Env               map[string]string
	RuntimeEnv        map[string]TargetRuntimeEnv
	RuntimePassEnv    []string
	Platforms         []specs.Platform

	// Collected transitive deps from deps/tools
	TransitiveDeps TargetTransitive

	// Own transitive config
	OwnTransitive TargetTransitive
	// Own transitive config plus their own transitive
	DeepOwnTransitive TargetTransitive

	Artifacts *ArtifactRegistry `json:"-"`

	// Deps + HashDeps + TargetTools
	AllTargetDeps *Targets `json:"-"`
	// contains filtered or unexported fields
}

func (*Target) DeepGenSources

func (t *Target) DeepGenSources() []*Target

func (*Target) EmptyDeps

func (t *Target) EmptyDeps() bool

func (*Target) GraphTarget

func (t *Target) GraphTarget() *Target

func (*Target) HasAnyLabel

func (t *Target) HasAnyLabel(labels []string) bool

func (*Target) ID

func (t *Target) ID() string

func (*Target) ResetLinking

func (t *Target) ResetLinking()

func (*Target) String

func (t *Target) String() string

func (*Target) ToolTarget

func (t *Target) ToolTarget() TargetTool

type TargetDeps

type TargetDeps struct {
	Targets    []TargetWithOutput // Targets with groups inlined
	RawTargets []TargetWithOutput // Targets with no inlining
	Files      []xfs.Path
}

func (TargetDeps) Copy

func (d TargetDeps) Copy() TargetDeps

func (*TargetDeps) Dedup

func (d *TargetDeps) Dedup()

func (TargetDeps) Empty

func (d TargetDeps) Empty() bool

func (TargetDeps) Merge

func (d TargetDeps) Merge(deps TargetDeps) TargetDeps

func (*TargetDeps) Sort

func (d *TargetDeps) Sort()

type TargetNamedDeps

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

func (*TargetNamedDeps) Add

func (tp *TargetNamedDeps) Add(name string, p TargetDeps)

func (*TargetNamedDeps) All

func (tp *TargetNamedDeps) All() TargetDeps

func (TargetNamedDeps) Copy

func (tp TargetNamedDeps) Copy() TargetNamedDeps

func (*TargetNamedDeps) Dedup

func (tp *TargetNamedDeps) Dedup()

func (*TargetNamedDeps) Empty

func (tp *TargetNamedDeps) Empty() bool

func (*TargetNamedDeps) HasName

func (tp *TargetNamedDeps) HasName(name string) bool

func (*TargetNamedDeps) IsNamed

func (tp *TargetNamedDeps) IsNamed() bool

func (*TargetNamedDeps) Map

func (tp *TargetNamedDeps) Map(fn func(deps TargetDeps) TargetDeps)

func (*TargetNamedDeps) Merge

func (*TargetNamedDeps) Name

func (tp *TargetNamedDeps) Name(name string) TargetDeps

func (*TargetNamedDeps) Named

func (tp *TargetNamedDeps) Named() map[string]TargetDeps

func (*TargetNamedDeps) Names

func (tp *TargetNamedDeps) Names() []string

func (*TargetNamedDeps) Set

func (tp *TargetNamedDeps) Set(name string, p TargetDeps)

func (*TargetNamedDeps) Sort

func (tp *TargetNamedDeps) Sort()

type TargetRuntimeEnv

type TargetRuntimeEnv struct {
	Value  string
	Target *Target `json:"-"`
}

func (TargetRuntimeEnv) MarshalJSON

func (v TargetRuntimeEnv) MarshalJSON() ([]byte, error)

type TargetTool

type TargetTool struct {
	Target *Target
	Output string
	Name   string
	File   xfs.RelPath
}

func (TargetTool) Full

func (t TargetTool) Full() string

type TargetTools

type TargetTools struct {
	// Holds targets references that do not have output (for transitive for ex)
	TargetReferences []*Target
	Targets          []TargetTool
	Hosts            []specs.HostTool
}

func (*TargetTools) Dedup

func (t *TargetTools) Dedup()

func (TargetTools) Empty

func (t TargetTools) Empty() bool

func (TargetTools) HasHeph

func (t TargetTools) HasHeph() bool

func (TargetTools) Merge

func (t TargetTools) Merge(tools TargetTools) TargetTools

func (TargetTools) Sort

func (t TargetTools) Sort()

type TargetTransitive

type TargetTransitive struct {
	Tools          TargetTools     `json:"-"`
	Deps           TargetNamedDeps `json:"-"`
	HashDeps       TargetDeps      `json:"-"`
	RuntimeDeps    TargetNamedDeps `json:"-"`
	Env            map[string]string
	RuntimeEnv     map[string]TargetRuntimeEnv
	PassEnv        []string
	RuntimePassEnv []string
}

func (TargetTransitive) Empty

func (tr TargetTransitive) Empty() bool

func (TargetTransitive) Merge

type TargetWithOutput

type TargetWithOutput struct {
	Target *Target
	Output string
	Mode   specs.DepMode
	Name   string
}

func (*TargetWithOutput) Full

func (t *TargetWithOutput) Full() string

type Targeter

type Targeter interface {
	specs.Specer
	GraphTarget() *Target
}

type Targets

type Targets struct {
	*sets.Set[string, *Target]
}

func NewTargets

func NewTargets(cap int) *Targets

func NewTargetsFrom

func NewTargetsFrom(ts []*Target) *Targets

func (*Targets) Addrs

func (ts *Targets) Addrs() []string

func (*Targets) Copy

func (ts *Targets) Copy() *Targets

func (*Targets) Filter

func (ts *Targets) Filter(m specs.Matcher) (*Targets, error)

func (*Targets) Find

func (ts *Targets) Find(addr string) *Target

func (*Targets) FindT

func (ts *Targets) FindT(s specs.Specer) *Target

func (*Targets) Public

func (ts *Targets) Public() *Targets

func (*Targets) Sort

func (ts *Targets) Sort()

func (*Targets) Specs

func (ts *Targets) Specs() specs.Targets

func (*Targets) Suggest

func (ts *Targets) Suggest(s string) specs.Targets

type Walker

type Walker func(target *Target)

func (Walker) Visit

func (w Walker) Visit(vertexer dag.Vertexer)

Jump to

Keyboard shortcuts

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