core

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildFlags = map[string]string{}

Functions

func Assert

func Assert(cond bool, format string, a ...interface{})

Assert can be used in build rules to abort build file generation with an error message if `cond` is true.

func BuildDir

func BuildDir() string

BuildDir returns the workspace build directory.

func Fatal

func Fatal(format string, a ...interface{})

Fatal can be used in build rules to abort build file generation with an error message unconditionally.

func Flag

func Flag(name string) string

Flag provides the value of a build config flags.

func LockBuildFlags

func LockBuildFlags()

LockBuildFlags prevents new flags from being used.

func SourceDir

func SourceDir() string

SourceDir returns the workspace source directory.

func WorkingDir

func WorkingDir() string

WorkingDir returns the directory the build command was executed in.

Types

type BuildStep

type BuildStep struct {
	Out     OutPath
	In      Path
	Ins     Paths
	Depfile *OutPath
	Cmd     string
	Descr   string
}

BuildStep represents one build step (i.e., one build command). Each BuildStep produces `Out` from `Ins` and `In` by running `Cmd`.

type Context

type Context interface {
	AddTarget(name string, target interface{})
	AddBuildStep(BuildStep)
}

type CopyFile

type CopyFile struct {
	From Path
	To   OutPath
}

CopyFile copies a single file.

func (CopyFile) Build

func (copy CopyFile) Build(ctx Context) OutPath

Build for CopyFile.

type ExpandTemplate

type ExpandTemplate struct {
	Out           OutPath
	Template      Path
	Substitutions map[string]string
}

ExpandTemplate expands `Template` by performing `Substitutions` and storing the result in `Out`.

func (ExpandTemplate) Build

func (tmpl ExpandTemplate) Build(ctx Context) OutPath

BuildSteps for ExpandTemplate.

type Flags

type Flags []string

Flags is a list of flags passed to a tool or command.

func (Flags) String

func (f Flags) String() string

type GlobalPath

type GlobalPath interface {
	Absolute() string
}

GlobalPath is a global path.

func NewGlobalPath

func NewGlobalPath(p string) GlobalPath

NewGlobalPath creates a globalPath.

type ListTargetsContext

type ListTargetsContext struct{}

func (*ListTargetsContext) AddBuildStep

func (ctx *ListTargetsContext) AddBuildStep(step BuildStep)

func (*ListTargetsContext) AddTarget

func (ctx *ListTargetsContext) AddTarget(name string, target interface{})

type NinjaContext

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

func (*NinjaContext) AddBuildStep

func (ctx *NinjaContext) AddBuildStep(step BuildStep)

func (*NinjaContext) AddTarget

func (ctx *NinjaContext) AddTarget(name string, target interface{})

type OutPath

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

OutPath is a path relative to the workspace build directory.

func NewOutPath

func NewOutPath(p string) OutPath

NewOutPath creates an OutPath for a path relativ to the build directory.

func (OutPath) Absolute

func (p OutPath) Absolute() string

Absolute returns the absolute path.

func (OutPath) Relative

func (p OutPath) Relative() string

Relative returns the path relative to the workspace build directory.

func (OutPath) String

func (p OutPath) String() string

String representation of an OutPath is its quoted absolute path.

func (OutPath) WithExt

func (p OutPath) WithExt(ext string) OutPath

WithExt creates an OutPath with the same relative path and the given extension.

func (OutPath) WithPrefix

func (p OutPath) WithPrefix(prefix string) OutPath

WithPrefix creates an OutPath with the same relative path and the given prefix.

func (OutPath) WithSuffix

func (p OutPath) WithSuffix(suffix string) OutPath

WithSuffix creates an OutPath with the same relative path and the given suffix.

type Path

type Path interface {
	Absolute() string
	Relative() string
	String() string
	WithExt(ext string) OutPath
	WithPrefix(prefix string) OutPath
	WithSuffix(suffix string) OutPath
}

Path represents an on-disk path that is either an input to or an output from a BuildStep (or both).

func NewInPath

func NewInPath(p string) Path

NewInPath creates an inPath for a path relativ to the source directory.

type Paths

type Paths []Path

Paths represents a list of Paths.

func (Paths) String

func (ps Paths) String() string

Jump to

Keyboard shortcuts

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