Documentation
¶
Overview ¶
Package graph builds and represents the dependency graph derived from parsed ninja files, resolving targets, inputs, and discovered dependencies into the nodes the build engine schedules over.
Index ¶
- type Graph
- type GraphBackend
- type Node
- func (n *Node) AddTarget(t string)
- func (n *Node) Command() string
- func (n *Node) DepFile() string
- func (n *Node) Description() string
- func (n *Node) InDegree() int
- func (n *Node) OutDegree() int
- func (n *Node) Pool() string
- func (n *Node) RSPContent() string
- func (n *Node) RSPFile() string
- func (n *Node) String() string
- func (n *Node) TargetsMatch(re *regexp.Regexp) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
BuildStartTime time.Time
GoalTargets []string
Defaults []string
BuildDir string
Pools map[string]*ninja.Pool
Goals xxmap.ObjectsSet[Node]
Targets xxmap.StringMap[*Node]
Nodes xxmap.ObjectsSet[Node]
Files xxmap.StringsSet
}
Graph holds the resolved build graph and the metadata needed to drive a build.
func NewGraph ¶
func NewGraph() *Graph
NewGraph returns an empty Graph ready to be populated by Load.
func (*Graph) Load ¶
func (g *Graph) Load(ctx context.Context, ninjas *ninja.ParsedFiles, goals []string, withDeps bool) error
Load resolves the supplied goals against ninjas and populates g with the transitive build graph. If withDeps is true, the graph also includes dependencies recorded in .ninja_deps.
type GraphBackend ¶
type GraphBackend interface {
GraphLoading() error
GraphLoaded(graph *Graph) error
GetDeps(n *Node) ([]string, error)
}
GraphBackend is implemented by backends that participate in graph loading.
type Node ¶
type Node struct {
Targets []string
Build *ninja.Build
Inputs map[*Node]int
Outputs map[*Node]int
Validations map[*Node]struct{}
Deps []string
Data any
// contains filtered or unexported fields
}
Node is a vertex in the build graph: one build edge with its inputs, outputs, and optional validations.
func (*Node) Description ¶
Description returns the rule's expanded "description" field, falling back to the command and finally the node's first target.
func (*Node) Pool ¶
Pool returns the name of the pool that owns n, or "default" if none was specified.
func (*Node) RSPContent ¶
RSPContent returns the expanded contents of the response file, if any.