specs

package
v0.0.0-...-5a0513b Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindAddr  matcherKind = "addr"
	KindLabel             = "label"
)
View Source
const SupportFilesOutput = "@support_files"

Variables

View Source
var (
	FileEnvIgnore  = "ignore"
	FileEnvRelRoot = "rel_root"
	FileEnvRelPkg  = "rel_pkg"
	FileEnvAbs     = "abs"

	FileEnvValues = []string{FileEnvIgnore, FileEnvRelRoot, FileEnvRelPkg, FileEnvAbs}
)
View Source
var (
	HashFileContent = "content"
	HashFileModTime = "mod_time"

	HashFileValues = []string{HashFileContent, HashFileModTime}
)
View Source
var (
	EntrypointExec = "exec"
	EntrypointBash = "bash"
	EntrypointSh   = "sh"

	EntrypointValues = []string{EntrypointExec, EntrypointSh, EntrypointBash}
)
View Source
var (
	CodegenNone          = ""
	CodegenLink          = "link"
	CodegenCopy          = "copy"
	CodegenCopyNoExclude = "copy_noexclude"

	CodegenValues = []string{CodegenNone, CodegenLink, CodegenCopy, CodegenCopyNoExclude}
)
View Source
var DepModes = []DepMode{
	DepModeCopy,
	DepModeLink,
}
View Source
var PublicMatcher = MustParseMatcher("!:_*")

Functions

func IsAddrMatcher

func IsAddrMatcher(m Matcher) bool

func IsLabelMatcher

func IsLabelMatcher(m Matcher) bool

func IsMatcherExplicit

func IsMatcherExplicit(m Matcher) bool

func LabelValidate

func LabelValidate(s string) error

func NewTargetNotFoundError

func NewTargetNotFoundError(target string, targets specer) error

func ParsePkgAddr

func ParsePkgAddr(s string, validate bool) (string, error)

func SortOutputsForHashing

func SortOutputsForHashing(names []string) []string

Types

type AstNode

type AstNode interface {
	String() string
}

func IsFuncNode

func IsFuncNode(m Matcher, name string) (bool, []AstNode)

type Cache

type Cache struct {
	Enabled bool
	Named   []string
	History int
}

func (Cache) Equal

func (this Cache) Equal(that Cache) bool

func (Cache) NamedEnabled

func (c Cache) NamedEnabled(name string) bool

type DepExpr

type DepExpr struct {
	Name string
	Expr exprs.Expr
}

func (DepExpr) Equal

func (this DepExpr) Equal(that DepExpr) bool

type DepFile

type DepFile struct {
	Name string
	Path string
}

func (DepFile) Equal

func (this DepFile) Equal(that DepFile) bool

type DepMode

type DepMode string
const (
	DepModeCopy DepMode = "copy"
	DepModeLink DepMode = "link"
)

type DepTarget

type DepTarget struct {
	Name   string
	Output string
	Target string
	Mode   DepMode
}

type Deps

type Deps struct {
	Targets []DepTarget
	Files   []DepFile
	Exprs   []DepExpr
}

func (Deps) Equal

func (this Deps) Equal(that Deps) bool

type ExprTool

type ExprTool struct {
	Name   string
	Expr   exprs.Expr
	Output string
}

func (ExprTool) Equal

func (this ExprTool) Equal(that ExprTool) bool

type GenSource

type GenSource struct {
	Addr    string
	Sources []Source
}

type HostTool

type HostTool struct {
	Name    string
	BinName string
	Path    string
}

func (HostTool) ResolvedPath

func (t HostTool) ResolvedPath() (string, error)

type IntersectResult

type IntersectResult int
const (
	IntersectTrue    IntersectResult = 1
	IntersectFalse   IntersectResult = 0
	IntersectUnknown IntersectResult = 2
)

func Intersects

func Intersects(a, b Matcher) IntersectResult

func (IntersectResult) Bool

func (r IntersectResult) Bool() bool

func (IntersectResult) Not

func (IntersectResult) String

func (r IntersectResult) String() string

type KindMatcher

type KindMatcher map[matcherKind]orNode

func (KindMatcher) Add

func (a KindMatcher) Add(m Matcher)

func (KindMatcher) Intersects

func (a KindMatcher) Intersects(m Matcher) IntersectResult

func (KindMatcher) MarshalJSON

func (m KindMatcher) MarshalJSON() ([]byte, error)

func (KindMatcher) Match

func (a KindMatcher) Match(s Specer) bool

func (KindMatcher) Replace

func (p KindMatcher) Replace(f Replacer) Matcher

func (KindMatcher) Simplify

func (a KindMatcher) Simplify() Matcher

func (KindMatcher) String

func (a KindMatcher) String() string

type Matcher

type Matcher interface {
	json.Marshaler
	Match(Specer) bool
	String() string
	Intersects(Matcher) IntersectResult
	Simplify() Matcher
	Replace(f Replacer) Matcher
}
var AllMatcher Matcher = staticMatcher{
	// contains filtered or unexported fields
}
var NoneMatcher Matcher = staticMatcher{
	// contains filtered or unexported fields
}

func AndNodeFactory

func AndNodeFactory[T Matcher](ms ...T) Matcher

func MatcherFromIncludeExclude

func MatcherFromIncludeExclude(pkg string, include, exclude []string) (Matcher, error)

func MatcherReplace

func MatcherReplace(m Matcher, f func(m Matcher) Matcher) Matcher

func MustParseMatcher

func MustParseMatcher(input string) Matcher

func NotNodeFactory

func NotNodeFactory(m Matcher) Matcher

func OrNodeFactory

func OrNodeFactory[T Matcher](ms ...T) Matcher

func ParseLabelGlob

func ParseLabelGlob(s string) (Matcher, error)

func ParseMatcher

func ParseMatcher(input string) (Matcher, error)

func ParseMatcherInPkg

func ParseMatcherInPkg(pkg, input string) (Matcher, error)

func ParseTargetGlob

func ParseTargetGlob(s string) (Matcher, error)

type MatcherNot

type MatcherNot interface {
	Not() Matcher
}

type OutFile

type OutFile struct {
	Name string
	Path string
}

type Platform

type Platform struct {
	Labels  map[string]string
	Options map[string]interface{}
	Default bool
}

func (Platform) Equal

func (this Platform) Equal(that Platform) bool

type Replacer

type Replacer = func(m Matcher) Matcher

type RestoreCache

type RestoreCache struct {
	Enabled bool
	Key     string
	Paths   []string
	Env     string
}

func (RestoreCache) Equal

func (this RestoreCache) Equal(that RestoreCache) bool

type Source

type Source struct {
	CallFrames []SourceCallFrame
}

func (Source) SourceFile

func (s Source) SourceFile() string

func (Source) SourceLocation

func (s Source) SourceLocation() string

type SourceCallFrame

type SourceCallFrame struct {
	Name string
	Pos  SourceCallFramePosition
}

func (SourceCallFrame) String

func (s SourceCallFrame) String() string

type SourceCallFramePosition

type SourceCallFramePosition struct {
	syntax.Position
}

func (*SourceCallFramePosition) MarshalJSON

func (u *SourceCallFramePosition) MarshalJSON() ([]byte, error)

type Specer

type Specer interface {
	Spec() Target
}

func AsSpecers

func AsSpecers[T Specer](a []T) []Specer

type SrcEnv

type SrcEnv struct {
	Default string
	Named   map[string]string
}

func (SrcEnv) Get

func (e SrcEnv) Get(name string) string

type StringMatcher

type StringMatcher interface {
	MatchString(s string) bool
}

type Target

type Target struct {
	Name    string
	Addr    string
	Package *packages.Package
	Doc     string

	GenSources          []string
	Run                 []string
	FileContent         []byte // Used by special target `text_file`
	Entrypoint          string
	Platforms           []Platform
	ConcurrentExecution bool
	Dir                 string
	PassArgs            bool
	Deps                Deps
	HashDeps            Deps
	RuntimeDeps         Deps
	Tools               Tools
	Out                 []OutFile
	Cache               Cache
	RestoreCache        RestoreCache
	HasSupportFiles     bool
	Sandbox             bool
	OutInSandbox        bool
	Codegen             string
	Labels              []string
	Env                 map[string]string
	PassEnv             []string
	RuntimePassEnv      []string
	RunInCwd            bool
	Gen                 []Matcher
	Sources             []Source
	RuntimeEnv          map[string]string
	SrcEnv              SrcEnv
	OutEnv              string
	HashFile            string
	Transitive          Transitive
	Timeout             time.Duration
	GenDepsMeta         bool
	Annotations         map[string]interface{}
	Requests            map[string]float64
}

func (Target) AddrStruct

func (t Target) AddrStruct() TargetAddr

func (Target) Equal

func (t Target) Equal(spec Target) bool

func (Target) HasDefaultPlatforms

func (t Target) HasDefaultPlatforms() bool

func (Target) IsExecutable

func (t Target) IsExecutable() bool

func (Target) IsGen

func (t Target) IsGen() bool

func (Target) IsGroup

func (t Target) IsGroup() bool

func (Target) IsPrivate

func (t Target) IsPrivate() bool

func (Target) IsTextFile

func (t Target) IsTextFile() bool

func (Target) IsTool

func (t Target) IsTool() bool

func (Target) Json

func (t Target) Json() []byte

func (Target) MarshalJSON

func (t Target) MarshalJSON() ([]byte, error)

func (Target) SourceLocation

func (t Target) SourceLocation() string

func (Target) Spec

func (t Target) Spec() Target

func (Target) Validate

func (t Target) Validate() error

type TargetAddr

type TargetAddr struct {
	Package string
	Name    string
	// contains filtered or unexported fields
}

func ParseTargetAddr

func ParseTargetAddr(pkg string, s string) (TargetAddr, error)

func (TargetAddr) Full

func (p TargetAddr) Full() string

func (TargetAddr) Intersects

func (p TargetAddr) Intersects(other Matcher) IntersectResult

func (TargetAddr) IsPrivate

func (p TargetAddr) IsPrivate() bool

func (TargetAddr) MarshalJSON

func (m TargetAddr) MarshalJSON() ([]byte, error)

func (TargetAddr) Match

func (p TargetAddr) Match(t Specer) bool

func (TargetAddr) Not

func (n TargetAddr) Not() Matcher

func (TargetAddr) Replace

func (p TargetAddr) Replace(f Replacer) Matcher

func (TargetAddr) Simplify

func (p TargetAddr) Simplify() Matcher

func (TargetAddr) String

func (p TargetAddr) String() string

type TargetAddrs

type TargetAddrs []TargetAddr

func (TargetAddrs) Intersects

func (p TargetAddrs) Intersects(m Matcher) IntersectResult

func (TargetAddrs) MarshalJSON

func (m TargetAddrs) MarshalJSON() ([]byte, error)

func (TargetAddrs) Match

func (p TargetAddrs) Match(t Specer) bool

func (TargetAddrs) Replace

func (p TargetAddrs) Replace(f Replacer) Matcher

func (TargetAddrs) Simplify

func (p TargetAddrs) Simplify() Matcher

func (TargetAddrs) String

func (p TargetAddrs) String() string

type TargetNotFoundErr

type TargetNotFoundErr struct {
	String  string
	Targets specer
}

func (TargetNotFoundErr) Error

func (e TargetNotFoundErr) Error() string

func (TargetNotFoundErr) Is

func (e TargetNotFoundErr) Is(err error) bool

type TargetOutputPath

type TargetOutputPath struct {
	TargetAddr
	Output string
}

func TargetOutputOptionsParse

func TargetOutputOptionsParse(pkg string, s string) (TargetOutputPath, map[string]string, error)

func TargetOutputParse

func TargetOutputParse(pkg string, s string) (TargetOutputPath, error)

func (TargetOutputPath) Full

func (p TargetOutputPath) Full() string

type TargetTool

type TargetTool struct {
	Name   string
	Target string
	Output string
}

type Targets

type Targets []Target

func (Targets) Addrs

func (ts Targets) Addrs() []string

func (Targets) Get

func (ts Targets) Get(addr string) (Target, bool)

type Tools

type Tools struct {
	Targets []TargetTool
	Hosts   []HostTool
	Exprs   []ExprTool
}

func (Tools) Equal

func (this Tools) Equal(that Tools) bool

type Transitive

type Transitive struct {
	Deps           Deps
	HashDeps       Deps
	RuntimeDeps    Deps
	Tools          Tools
	Env            map[string]string
	PassEnv        []string
	RuntimePassEnv []string
	RuntimeEnv     map[string]string
	Platforms      []Platform
}

func (Transitive) Equal

func (this Transitive) Equal(that Transitive) bool

Jump to

Keyboard shortcuts

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