Documentation ¶
Index ¶
- type Artifact
- type Builder
- func (b *Builder) Add(task *Task, op Operation) *Task
- func (b *Builder) Build(tasks ...*Task)
- func (b *Builder) DumpTasks()
- func (b *Builder) EstablishPath(perm os.FileMode, paths ...string) string
- func (b *Builder) Execute(t *Task)
- func (b *Builder) GetFreeWorker() *Worker
- func (b *Builder) IsAssignedToWorker(t *Task) bool
- func (b *Builder) IsStamped(t *Task) bool
- func (b *Builder) ReportWorkerUtilization()
- func (b *Builder) Stamp(t *Task)
- func (b *Builder) Task(id string) *Task
- func (b *Builder) WorkspacePath(paths ...string) string
- type Operation
- type Task
- func (t *Task) AllDependenciesDone() bool
- func (t *Task) AssignDefaultSignature()
- func (t *Task) DependsOn(d ...*Task)
- func (t *Task) DependsOnSerial(d ...*Task)
- func (t *Task) DumpStr(deps bool) string
- func (t *Task) GetDependencies() []*Task
- func (t *Task) GetID() string
- func (t Task) IDSig() string
- func (t *Task) IsDone() bool
- func (t *Task) MarkDone()
- func (t *Task) RunAlwaysSignature()
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶
An Artifact describes a payload that is built using data matching a signature and wich should be deployed at a specific location at the workspace.
type Builder ¶
type Builder struct { Verbose bool Variables utils.Variables WorkspaceRoot string // contains filtered or unexported fields }
The Builder is the controller responsible for creating a deterministic execution order between the tasks registered with the Builder. It is also responsible for keeping the Artifacts resulted from the execution of the Tasks and deploying them in case of their existence. The Builder is also responsible for keeping a Task register that will be used when creating implicitly declared Tasks.
func NewBuilder ¶
func NewBuilder(ctxt context.Context, workspaceRoot string, workerCount int, verbose bool, build, host, target string, downloadDir, toolsDir, cacheDir, stampDir string) *Builder
NewBuilder creates a new builder with some workspace level definitions
func (*Builder) Add ¶
Add a new task to the builder. If the task already existed the existing task will be returned and provided task will be nulled, in order to detect erroneous reuse of duplicated task.
func (*Builder) Build ¶
Build will use the registered targets and try to build the provided targets, which also needs to be part of the environment...
func (*Builder) DumpTasks ¶
func (b *Builder) DumpTasks()
DumpTasks will show all registered tasks in the builder
func (*Builder) EstablishPath ¶
EstablishPath will make sure a path exists within the environment. If the supplied path is relative, it will be relative to WorkspaceRoot. The returned path is the absolute path to the directory. It returns the absolute path to the directory
func (*Builder) Execute ¶
Execute a task. If parallell execution is applied then the call should be properly embedded in a go routine and safe-guarded by mutexes.
func (*Builder) GetFreeWorker ¶
GetFreeWorker returns the first worker that indicates it has nothing to do.
func (*Builder) IsAssignedToWorker ¶
IsAssignedToWorker checks to see if there is a worker working on the Target
func (*Builder) ReportWorkerUtilization ¶
func (b *Builder) ReportWorkerUtilization()
ReportWorkerUtilization prints how many tasks each user have executed
func (*Builder) Stamp ¶
Stamp will create a stamp in the stamp directory, marking that the task t is done.
func (*Builder) Task ¶
Task retrievs the MakeTarget based on the ID. It will panic in case the target does not exist in the environment
func (*Builder) WorkspacePath ¶
WorkspacePath returns a path within the workspace. If paths is a absolute path, it will be checked to see if it's within the workspace, and panic if not.
type Task ¶
type Task struct { // The ID must match the Id of the operation in builder ID string Dependencies []*Task Variables utils.Variables Signature string RunAlways bool // contains filtered or unexported fields }
A Task is a combination of an Operation and a set of Variables to call the opration with
func (*Task) AllDependenciesDone ¶
AllDependenciesDone checks if all the dependencies
func (*Task) AssignDefaultSignature ¶
func (t *Task) AssignDefaultSignature()
AssignDefaultSignature will generate an md5 signature based on the id and a sorted list of the task variables.
func (*Task) DependsOnSerial ¶
DependsOnSerial makes t depend on d_N, d_N on d_N-1, etc
func (*Task) RunAlwaysSignature ¶
func (t *Task) RunAlwaysSignature()
RunAlwaysSignature generates a random signature that will make sure it is always run
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker can be assigned by the environment to work on a target
func NewWorker ¶
NewWorker creates a new worker in a context and atttached to the channel it should report to when work is done.