core

package
v3.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertIsAnalyzeTarget

func AssertIsAnalyzeTarget(iface AnalyzeInterface)

func AssertIsBuildableTarget

func AssertIsBuildableTarget(iface BuildInterface)

func AssertIsCoverageTarget

func AssertIsCoverageTarget(iface CoverageInterface)

func AssertIsReportTarget

func AssertIsReportTarget(iface reportInterface)

func AssertIsRunnableTarget

func AssertIsRunnableTarget(iface runInterface)

func AssertIsTestableTarget

func AssertIsTestableTarget(iface testInterface)

func CompileTemplate

func CompileTemplate(tmpl, name string, data interface{}) string

Compile a go text template, execute it, and return the result as a string

func CompileTemplateFile added in v1.1.0

func CompileTemplateFile(tmplFile string, data interface{}) string

Compile a go text template from a file, execute it, and return the result as a string

func Fatal

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

func GeneratorMain

func GeneratorMain(vars map[string]interface{})

Types

type AnalyzeInterface added in v1.11.3

type AnalyzeInterface interface {
	TranslationUnits(ctx Context) []TranslationUnit
	AnalysisDeps(ctx Context) []AnalyzeInterface
}

AnalyzeInterface is an interface for targets compatible with static analysis

type BoolFlag

type BoolFlag struct {
	Name        string
	Description string
	DefaultFn   func() bool
	// contains filtered or unexported fields
}

func (BoolFlag) Register

func (flag BoolFlag) Register() *BoolFlag

func (*BoolFlag) Value

func (flag *BoolFlag) Value() bool

type BuildInterface

type BuildInterface interface {
	Build(ctx Context)
}

type BuildRule added in v1.7.0

type BuildRule struct {
	Name      string
	Variables map[string]string
}

type BuildStep

type BuildStep struct {
	Out          OutPath
	Outs         []OutPath
	In           Path
	Ins          []Path
	Depfile      OutPath
	Cmd          string
	Script       string
	Data         string
	DataFileMode os.FileMode
	Descr        string
	Phony        bool
	Pool         *Pool
}

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

type BuildStepWithRule added in v1.7.0

type BuildStepWithRule struct {
	Outs         []OutPath
	Ins          []Path
	ImplicitDeps []Path
	OrderDeps    []Path
	Variables    map[string]string
	Rule         BuildRule
	Phony        bool
	// contains filtered or unexported fields
}

type Context

type Context interface {
	AddBuildStep(BuildStep)
	AddBuildStepWithRule(BuildStepWithRule)
	Cwd() OutPath
	BuildChild(c BuildInterface)

	// WithTrace calls the given function, with the given value added
	// to the trace.
	WithTrace(id string, f func(Context))

	// Trace returns the strings in the current trace (most recent last).
	Trace() []string

	// Rules to be collected in a compilation database. Their name must be unique
	RegisterCompDbRule(rule *BuildRule)

	// Obtains a registered rule (if it exists). The boolean is true if it exists
	GetCompDbRule(name string) (*BuildRule, bool)
	// contains filtered or unexported methods
}

type CopyFile

type CopyFile struct {
	From Path
	To   OutPath
}

CopyFile copies a single file.

func (CopyFile) Build

func (copy CopyFile) Build(ctx Context)

Build for CopyFile.

func (CopyFile) Output

func (copy CopyFile) Output() OutPath

type CoverageInterface added in v1.11.2

type CoverageInterface interface {
	Test(args []string) string
	Binaries() []Path
	CoverageData() []OutPath
}

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)

BuildSteps for ExpandTemplate.

func (ExpandTemplate) Output

func (tmpl ExpandTemplate) Output() OutPath

type FloatFlag

type FloatFlag struct {
	Name        string
	Description string
	DefaultFn   func() float64
	// contains filtered or unexported fields
}

func (FloatFlag) Register

func (flag FloatFlag) Register() *FloatFlag

func (*FloatFlag) Value

func (flag *FloatFlag) Value() float64

type GlobalPath

type GlobalPath interface {
	Absolute() string
}

GlobalPath is a global path.

func NewGlobalPath

func NewGlobalPath(p string) GlobalPath

NewGlobalPath creates a globalPath.

type IntFlag

type IntFlag struct {
	Name          string
	Description   string
	AllowedValues []int64
	DefaultFn     func() int64
	// contains filtered or unexported fields
}

func (IntFlag) Register

func (flag IntFlag) Register() *IntFlag

func (*IntFlag) Value

func (flag *IntFlag) Value() int64

type OutPath

type OutPath interface {
	Path
	// contains filtered or unexported methods
}

OutPath is a path relative to the workspace build directory.

func BuildPath

func BuildPath(p string) OutPath

BuildPath returns a path relative to the build directory.

func GetSortedOutPaths added in v1.2.0

func GetSortedOutPaths(pathMap map[string]OutPath) []OutPath

Get paths from a path map sorted by key

func NewOutPath

func NewOutPath(pkg interface{}, p string) OutPath

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

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 GetSortedPaths added in v1.2.0

func GetSortedPaths(pathMap map[string]Path) []Path

Get paths from a path map sorted by key

func NewInPath

func NewInPath(pkg PkgPath, p string) Path

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

func SourcePath

func SourcePath(p string) Path

SourcePath returns a path relative to the source directory.

type PkgPath added in v1.9.0

type PkgPath interface {
	SrcDir() string
}

type Pool

type Pool struct {
	Name  string
	Depth uint
}
var ConsolePool Pool = Pool{
	Name: "console",
}

type StringFlag

type StringFlag struct {
	Name          string
	Description   string
	AllowedValues []string
	DefaultFn     func() string
	// contains filtered or unexported fields
}

func (StringFlag) Register

func (flag StringFlag) Register() *StringFlag

func (*StringFlag) Value

func (flag *StringFlag) Value() string

type StringPath added in v1.4.0

type StringPath struct {
	Key   string
	Value Path
}

type StringString added in v1.4.0

type StringString struct {
	Key   string
	Value string
}

type TargetRule added in v1.11.0

type TargetRule struct {
	Target    string
	Ins       []string
	Variables map[string]string
}

type TranslationUnit added in v1.11.3

type TranslationUnit struct {
	Source Path
	Object OutPath
	Flags  []string
}

Jump to

Keyboard shortcuts

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