build

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// We do not want to build the edge, but we might want to build one of
	// its dependents.
	WantNothing = iota

	// We want to build the edge, but have not yet scheduled it.
	WantToStart

	// We want to build the edge, have scheduled it, and are waiting
	// for it to complete.
	WantToFinish
)
View Source
const (
	EdgeFailed = iota
	EdgeSucceeded
)

Variables

This section is empty.

Functions

func EdgeWeightHeuristic

func EdgeWeightHeuristic(edge *graph.Edge) int64

Heuristic for edge priority weighting. Phony edges are free (0 cost), all other edges are weighted equally.

Types

type Builder

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

func NewBuilder

func NewBuilder(state *state.State, config *build_config.Config, buildLog *build_log.BuildLog,
	depsLog *deps_log.DepsLog, diskInterface disk.Interface, status status.Status, startTimeMillis int64) *Builder

func (*Builder) AddTarget

func (b *Builder) AddTarget(target *graph.Node) (bool, error)

func (*Builder) AddTargetByName

func (b *Builder) AddTargetByName(name string) (*graph.Node, error)

func (*Builder) AlreadyUpToDate

func (b *Builder) AlreadyUpToDate() bool

func (*Builder) Build

func (b *Builder) Build() (exit_status.ExitStatusType, error)

func (*Builder) Cleanup

func (b *Builder) Cleanup()

func (*Builder) Close

func (b *Builder) Close()

func (*Builder) Dump

func (b *Builder) Dump()

func (*Builder) ExtractDeps

func (b *Builder) ExtractDeps(result *spawn.Result, depsType, depsPrefix string) ([]*graph.Node, error)

func (*Builder) FinishCommand

func (b *Builder) FinishCommand(result *spawn.Result) (bool, error)

func (*Builder) GetExitCode

func (b *Builder) GetExitCode() exit_status.ExitStatusType

func (*Builder) LoadDyndeps

func (b *Builder) LoadDyndeps(node *graph.Node) error

func (*Builder) SetFailureCode

func (b *Builder) SetFailureCode(code exit_status.ExitStatusType)

func (*Builder) SetJobserverClient

func (b *Builder) SetJobserverClient(jobserver jobserver.Client)

func (*Builder) StartEdge

func (b *Builder) StartEdge(edge *graph.Edge) (bool, error)

func (*Builder) TestOnlyPlan

func (b *Builder) TestOnlyPlan() *Plan

func (*Builder) TestOnlySetCommandRunner

func (b *Builder) TestOnlySetCommandRunner(runner CommandRunner)

type CachingCommandRunner

type CachingCommandRunner interface {
	CommandRunner
	CacheResult(*spawn.Result, []*graph.Node) error
	WaitForUploads() error
}

type CancellableCommandRunner

type CancellableCommandRunner interface {
	Cancel()
}

CancellableCommandRunner is an optional interface that command runners can implement to support cancelling in-flight work without a full abort. This is used to stop pending remote actions promptly when the failure budget is exhausted, rather than waiting for all of them to complete.

type CommandRunner

type CommandRunner interface {
	CanRunMore() int
	StartCommand(edge *graph.Edge) error
	WaitForCommand() *spawn.Result
	GetActiveEdges() []*graph.Edge
	Abort()
	ClearJobTokens()
}

func NewRealCommandRunner

func NewRealCommandRunner(config *build_config.Config, jobserver jobserver.Client) CommandRunner

type DryCommandRunner

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

func NewDryCommandRunner

func NewDryCommandRunner() *DryCommandRunner

func (*DryCommandRunner) Abort

func (d *DryCommandRunner) Abort()

func (*DryCommandRunner) CanRunMore

func (d *DryCommandRunner) CanRunMore() int

CanRunMore always returns true for dry run

func (*DryCommandRunner) ClearJobTokens

func (r *DryCommandRunner) ClearJobTokens()

func (*DryCommandRunner) GetActiveEdges

func (d *DryCommandRunner) GetActiveEdges() []*graph.Edge

func (*DryCommandRunner) StartCommand

func (d *DryCommandRunner) StartCommand(edge *graph.Edge) error

StartCommand simulates starting a command

func (*DryCommandRunner) WaitForCommand

func (d *DryCommandRunner) WaitForCommand() *spawn.Result

type EdgeResult

type EdgeResult int

type Plan

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

Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute.

func NewPlan

func NewPlan(builder *Builder) *Plan

func (*Plan) AddSubTarget

func (p *Plan) AddSubTarget(node, dependent *graph.Node, dyndepWalk map[*graph.Edge]struct{}) (bool, error)

func (*Plan) AddTarget

func (p *Plan) AddTarget(target *graph.Node) (bool, error)

Add a target to our plan (including all its dependencies). Returns false if we don't need to build this target.

func (*Plan) CleanNode

func (p *Plan) CleanNode(scan *dependency_scan.DependencyScan, node *graph.Node) bool

func (*Plan) CommandEdgeCount

func (p *Plan) CommandEdgeCount() int

func (*Plan) ComputeCriticalPath

func (p *Plan) ComputeCriticalPath()

func (*Plan) Dump

func (p *Plan) Dump()

Dumps the current state of the plan.

func (*Plan) DyndepsLoaded

func (p *Plan) DyndepsLoaded(scan *dependency_scan.DependencyScan, node *graph.Node, ddf dyndep.DyndepFile) (bool, error)

func (*Plan) EdgeFinished

func (p *Plan) EdgeFinished(edge *graph.Edge, result EdgeResult) (bool, error)

func (*Plan) EdgeMaybeReady

func (p *Plan) EdgeMaybeReady(edge *graph.Edge, want Want) (bool, error)

func (*Plan) EdgeWanted

func (p *Plan) EdgeWanted(edge *graph.Edge)

func (*Plan) FindWork

func (p *Plan) FindWork() *graph.Edge

Pop a ready edge off the queue of edges to build. Returns NULL if there's no work to do.

func (*Plan) MoreToDo

func (p *Plan) MoreToDo() bool

Returns true if there's more work to be done.

func (*Plan) NodeFinished

func (p *Plan) NodeFinished(node *graph.Node) (bool, error)

func (*Plan) PrepareQueue

func (p *Plan) PrepareQueue()

func (*Plan) RefreshDyndepDependents

func (p *Plan) RefreshDyndepDependents(scan *dependency_scan.DependencyScan, node *graph.Node) (bool, error)

func (*Plan) Reset

func (p *Plan) Reset()

func (*Plan) ScheduleInitialEdges

func (p *Plan) ScheduleInitialEdges()

func (*Plan) ScheduleWork

func (p *Plan) ScheduleWork(edge *graph.Edge, want Want)

func (*Plan) UnmarkDependents

func (p *Plan) UnmarkDependents(node *graph.Node, dependents map[*graph.Node]struct{})

type RealCommandRunner

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

func (*RealCommandRunner) Abort

func (r *RealCommandRunner) Abort()

func (*RealCommandRunner) CanRunMore

func (r *RealCommandRunner) CanRunMore() int

func (*RealCommandRunner) ClearJobTokens

func (r *RealCommandRunner) ClearJobTokens()

func (*RealCommandRunner) GetActiveEdges

func (r *RealCommandRunner) GetActiveEdges() []*graph.Edge

func (*RealCommandRunner) StartCommand

func (r *RealCommandRunner) StartCommand(edge *graph.Edge) error

func (*RealCommandRunner) WaitForCommand

func (r *RealCommandRunner) WaitForCommand() *spawn.Result

type RemoteCachingCommandRunner

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

func NewRemoteCachingCommandRunner

func NewRemoteCachingCommandRunner(config *build_config.Config, jobserver jobserver.Client) *RemoteCachingCommandRunner

func (*RemoteCachingCommandRunner) Abort

func (r *RemoteCachingCommandRunner) Abort()

func (*RemoteCachingCommandRunner) CacheResult

func (r *RemoteCachingCommandRunner) CacheResult(result *spawn.Result, depsNodes []*graph.Node) error

func (*RemoteCachingCommandRunner) CanRunMore

func (r *RemoteCachingCommandRunner) CanRunMore() int

func (*RemoteCachingCommandRunner) Cancel

func (r *RemoteCachingCommandRunner) Cancel()

func (*RemoteCachingCommandRunner) ClearJobTokens

func (r *RemoteCachingCommandRunner) ClearJobTokens()

func (*RemoteCachingCommandRunner) GetActiveEdges

func (r *RemoteCachingCommandRunner) GetActiveEdges() []*graph.Edge

func (*RemoteCachingCommandRunner) StartCommand

func (r *RemoteCachingCommandRunner) StartCommand(edge *graph.Edge) error

func (*RemoteCachingCommandRunner) WaitForCommand

func (r *RemoteCachingCommandRunner) WaitForCommand() *spawn.Result

func (*RemoteCachingCommandRunner) WaitForUploads

func (r *RemoteCachingCommandRunner) WaitForUploads() error

type RemoteCommandRunner

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

func NewRemoteCommandRunner

func NewRemoteCommandRunner(config *build_config.Config, jobserver jobserver.Client) *RemoteCommandRunner

func (*RemoteCommandRunner) Abort

func (r *RemoteCommandRunner) Abort()

func (*RemoteCommandRunner) CanRunMore

func (r *RemoteCommandRunner) CanRunMore() int

func (*RemoteCommandRunner) Cancel

func (r *RemoteCommandRunner) Cancel()

func (*RemoteCommandRunner) ClearJobTokens

func (r *RemoteCommandRunner) ClearJobTokens()

func (*RemoteCommandRunner) GetActiveEdges

func (r *RemoteCommandRunner) GetActiveEdges() []*graph.Edge

func (*RemoteCommandRunner) StartCommand

func (r *RemoteCommandRunner) StartCommand(edge *graph.Edge) error

func (*RemoteCommandRunner) WaitForCommand

func (r *RemoteCommandRunner) WaitForCommand() *spawn.Result

type RunningEdgeMap

type RunningEdgeMap = map[*graph.Edge]time.Time

type TopoSort

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

func NewTopoSort

func NewTopoSort() *TopoSort

func (*TopoSort) Results

func (s *TopoSort) Results() []*graph.Edge

func (*TopoSort) Visit

func (s *TopoSort) Visit(edge *graph.Edge)

func (*TopoSort) VisitTarget

func (s *TopoSort) VisitTarget(target *graph.Node)

type Want

type Want int

Enumerate possible steps we want for an edge.

Jump to

Keyboard shortcuts

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