Documentation ¶
Index ¶
- Variables
- func MatchTarget(pattern string, t *Target) (matched bool, err error)
- func RegisterFileSystem(typ string, fn NewFileSystemFunc)
- type Build
- func (b *Build) Close() error
- func (b *Build) Dependencies() []*Build
- func (b *Build) Done(err error)
- func (b *Build) Err() error
- func (b *Build) Name() string
- func (b *Build) RootErr() error
- func (b *Build) Stderr() io.ReadCloser
- func (b *Build) Stdout() io.ReadCloser
- func (b *Build) Target() *Target
- func (b *Build) Wait()
- type Builder
- type Builds
- type Command
- type ExecCommand
- type File
- type FileSystem
- type FileSystemOptions
- type FileSystemRoot
- type Label
- type NewFileSystemFunc
- type Package
- type Parser
- type Planner
- type ShellCommand
- type Snapshot
- type Target
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDependency is set on a build if a dependent build has an error. ErrDependency = errors.New("dependency error") // ErrCanceled is set on a build if the build was canceled early. ErrCanceled = errors.New("build canceled") )
var ErrSnapshotTargetNotFound = errors.New("snapshot target not found")
ErrSnapshotTargetNotFound is returned when operating on a target that doesn't exist.
var ErrUnregisteredFileSystem = errors.New("unregistered file system")
ErrUnregisteredFileSystem is returned when a file system has not been registered.
Functions ¶
func MatchTarget ¶
MatchTarget returns true if t's name or outputs match pattern.
func RegisterFileSystem ¶
func RegisterFileSystem(typ string, fn NewFileSystemFunc)
RegisterFileSystem registers a filesystem constructor by type.
Types ¶
type Build ¶
type Build struct {
// contains filtered or unexported fields
}
Build represents a build step.
func (*Build) Dependencies ¶
Dependencies returns a list of builds that b depends on.
func (*Build) Done ¶
Done marks the build as complete and sets the error, if any. Calling this method twice on a build will cause it to panic.
func (*Build) Stderr ¶
func (b *Build) Stderr() io.ReadCloser
Stderr returns the standard error stream.
func (*Build) Stdout ¶
func (b *Build) Stdout() io.ReadCloser
Stdout returns the standard output stream.
type Builder ¶
type Builder struct { // Used for tracking read/write access during build steps. FileSystem FileSystem // Used for persisting the last state of the file system. Snapshot *Snapshot Output io.Writer // contains filtered or unexported fields }
Builder processes targets to produce an output Build.
type Command ¶
type Command interface {
// contains filtered or unexported methods
}
Command represents an executable command.
type ExecCommand ¶
type ExecCommand struct {
Args []string
}
ExecCommand represents a command that is executed against the OS's exec().
type FileSystem ¶
type FileSystem interface { Open() error Close() error // The underlying path being served. Path() string // Creates a new root path for the file system where changes can be tracked. CreateRoot() FileSystemRoot }
FileSystem represents a way to mount the build filesystem.
func NewFileSystem ¶
func NewFileSystem(typ string, opt FileSystemOptions) (FileSystem, error)
NewFileSystem returns a new instance of FileSystem for a given type.
type FileSystemOptions ¶
type FileSystemOptions struct { // Underlying path to serve Path string // Directory to mount to. MountPath string }
FileSystemOptions represents a list of options passed to a file sytem on creation.
type FileSystemRoot ¶
type FileSystemRoot interface { Path() string Readset() map[string]struct{} Writeset() map[string]struct{} }
FileSystemRoot represents a copy of the file system root. It can be used for tracking reads & writes.
type Label ¶
Label represents a reference to a project and target. An empty package represents the default package. An empty target represents the default target.
type NewFileSystemFunc ¶
type NewFileSystemFunc func(FileSystemOptions) (FileSystem, error)
NewFileSystemFunc is a function for creating a new file system.
type Package ¶
Package represents a collection of targets.
func (*Package) MatchTargets ¶
MatchTargets returns a list of targets matching a glob pattern. Matches pattern against target name or output files.
func (*Package) TargetNames ¶
TargetNames returns a sorted list of all target names.
type Parser ¶
type Parser struct { // Package being built by the parser. // It is incrementally added to on every parse. Package *Package // contains filtered or unexported fields }
Parser represents a recursive directory parser.
type Planner ¶
type Planner struct { // Used to determine dirty targets since last build. Snapshot *Snapshot // contains filtered or unexported fields }
Planner represents the object that creates a build plan. This type is not safe for multiple goroutines.
func NewPlanner ¶
NewPlanner returns a new instance of Planner.
type ShellCommand ¶
type ShellCommand struct {
Source string
}
ShellCommand represents a command that executes a shell script against /bin/sh.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot represents the state of the build system. This includes the targets, their list of file dependencies, and file states.
func NewSnapshot ¶
NewSnapshot returns a new instance of Snapshot.
func (*Snapshot) AddTarget ¶
AddTarget adds a target to the snapshot.
If the target already exists then it is merged with the existing record. The file dependencies of target are checked for changes and updated if needed.
func (*Snapshot) IsTargetDirty ¶
IsTargetDirty returns true if a target has changed or its file inputs have changed.
type Target ¶
type Target struct { // Unique identifier for the target within the package. Name string // Indicates that the target does not produce a file. // For example, "test" or "clean". Phony bool // Text shown to users instead of commands. Title string // The working directory that commands are run from. WorkDir string // The commands to execute to build the target. Commands []Command // Depedent target names. Dependencies []string // Files to be retained after build. // Any files written that are not declared here are assumed to be temporary files. Outputs []string }
Target represents a buildable rule.