Documentation ¶
Overview ¶
Package parse implements parsing of the BUILD files via an embedded Python interpreter.
The actual work here is done by an embedded PyPy instance. Various rules are built in to the binary itself using go-bindata to embed the .py files; these are always available to all programs which is rather nice, but it does mean that must be run before 'go run' etc will work as expected.
Index ¶
- func AddCommand(cTarget uintptr, cConfig *C.char, cCommand *C.char) *C.char
- func AddData(cTarget uintptr, cData *C.char) *C.char
- func AddDep(cTarget uintptr, cDep *C.char) *C.char
- func AddDependency(cPackage uintptr, cTarget *C.char, cDep *C.char, exported bool) *C.char
- func AddExportedDep(cTarget uintptr, cDep *C.char) *C.char
- func AddHash(cTarget uintptr, cHash *C.char) *C.char
- func AddLabel(cTarget uintptr, cLabel *C.char) *C.char
- func AddLicence(cTarget uintptr, cLicence *C.char) *C.char
- func AddLicencePost(cPackage uintptr, cTarget *C.char, cLicence *C.char) *C.char
- func AddNamedOutput(cTarget uintptr, cName *C.char, cOutput *C.char) *C.char
- func AddNamedOutputPost(cPackage uintptr, cTarget, cName, cOut *C.char) *C.char
- func AddNamedSource(cTarget uintptr, cName *C.char, cSource *C.char) *C.char
- func AddNamedTool(cTarget uintptr, cName *C.char, cTool *C.char) *C.char
- func AddOptionalOutput(cTarget uintptr, cOutput *C.char) *C.char
- func AddOutput(cTarget uintptr, cOutput *C.char) *C.char
- func AddOutputPost(cPackage uintptr, cTarget, cOut *C.char) *C.char
- func AddProvide(cTarget uintptr, cLanguage *C.char, cDep *C.char) *C.char
- func AddRequire(cTarget uintptr, cRequire *C.char) *C.char
- func AddSecret(cTarget uintptr, cSecret *C.char) *C.char
- func AddSource(cTarget uintptr, cSource *C.char) *C.char
- func AddTarget(pkgPtr uintptr, cName, cCmd, cTestCmd *C.char, ...) (ret C.size_t)
- func AddTestCommand(cTarget uintptr, cConfig *C.char, cCommand *C.char) *C.char
- func AddTestOutput(cTarget uintptr, cTestOutput *C.char) *C.char
- func AddTool(cTarget uintptr, cTool *C.char) *C.char
- func AddVis(cTarget uintptr, cVis *C.char) *C.char
- func GetCommand(cPackage uintptr, cTarget *C.char, cConfig *C.char) *C.char
- func GetIncludeFile(cPackage uintptr, cLabel *C.char) *C.char
- func GetLabels(cPackage uintptr, cTarget *C.char, cPrefix *C.char) **C.char
- func GetSubincludeFile(cPackage uintptr, cLabel *C.char) *C.char
- func Glob(cPackage *C.char, cIncludes **C.char, numIncludes int, cExcludes **C.char, ...) **C.char
- func InitParser(state *core.BuildState)
- func IsValidTargetName(name *C.char) bool
- func Log(level int, cPackage uintptr, cMessage *C.char)
- func Parse(tid int, state *core.BuildState, label, dependor core.BuildLabel, noDeps bool, ...)
- func PrintRuleArgs(state *core.BuildState, labels []core.BuildLabel)
- func RunCode(state *core.BuildState, code string) error
- func SetCommand(cPackage uintptr, cTarget *C.char, cConfigOrCommand *C.char, cCommand *C.char) *C.char
- func SetContainerSetting(cTarget uintptr, cName, cValue *C.char) *C.char
- func SetPostBuildFunction(callback uintptr, cBytecode *C.char, cTarget uintptr)
- func SetPreBuildFunction(callback uintptr, cBytecode *C.char, cTarget uintptr)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶
AddCommand adds a (possibly config-specific) command to a target.
func AddDependency ¶
AddDependency is called by the add_dep builtin to add a dependency to an existing target. It's only invoked by post-build functions.
func AddExportedDep ¶
AddExportedDep adds an exported dependency to a target.
func AddLicence ¶
AddLicence adds a licence to a build target.
func AddLicencePost ¶
AddLicencePost is called by the add_licence builtin to add a licence to a target during a post-build function.
func AddNamedOutput ¶
AddNamedOutput adds a named output to a build target.
func AddNamedOutputPost ¶
AddNamedOutputPost is called by the add_out builtin to add an output to an existing target.
func AddNamedSource ¶
AddNamedSource adds a named source to a target.
func AddNamedTool ¶
AddNamedTool adds a named tool to a build target.
func AddOptionalOutput ¶
AddOptionalOutput adds an optional output to a build target.
func AddOutputPost ¶
AddOutputPost is called by the add_out builtin to add an output to an existing target.
func AddProvide ¶
AddProvide adds a provide mapping to a build target.
func AddRequire ¶
AddRequire adds a require statement to a build target.
func AddTarget ¶
func AddTarget(pkgPtr uintptr, cName, cCmd, cTestCmd *C.char, binary, test, needsTransitiveDeps, outputIsComplete, containerise, sandbox, testSandbox, noTestOutput, testOnly, stamp, progress, filegroup, hashFilegroup bool, flakiness, buildTimeout, testTimeout int, cBuildingDescription *C.char) (ret C.size_t)
AddTarget is a cgo callback to add a new build target to the graph.
func AddTestCommand ¶
AddTestCommand adds a (possibly config-specific) test command to a target.
func AddTestOutput ¶
AddTestOutput adds a test output file to a build target.
func GetCommand ¶
GetCommand is a cgo callback that returns the command for a target.
func GetIncludeFile ¶
GetIncludeFile is a callback to the interpreter that returns the path it should be opening in order to include_defs() a file. We use in-band signalling for some errors since C can't handle multiple return values :)
func GetLabels ¶
GetLabels returns the set of labels for a build target and its transitive dependencies. The labels are filtered by the given prefix, which is stripped from the returned labels.
func GetSubincludeFile ¶
GetSubincludeFile is a callback to the interpreter that returns the path it should be opening in order to subinclude() a build target. We use in-band signalling for some errors since C can't handle multiple return values :)
func Glob ¶
func Glob(cPackage *C.char, cIncludes **C.char, numIncludes int, cExcludes **C.char, numExcludes int, includeHidden bool) **C.char
Glob implements the glob() builtin build function.
func InitParser ¶
func InitParser(state *core.BuildState)
InitParser initialises the parser engine. This is guaranteed to be called exactly once before any calls to Parse().
func IsValidTargetName ¶
IsValidTargetName returns true if the given name is valid in a package. This is provided to help error handling on the Python side.
func Log ¶
Log is a cgo callback that is called by the log() builtin to log into our normal logging framework.
func Parse ¶
func Parse(tid int, state *core.BuildState, label, dependor core.BuildLabel, noDeps bool, include, exclude []string, forSubinclude bool)
Parse parses the package corresponding to a single build label. The label can be :all to add all targets in a package. It is not an error if the package has already been parsed.
By default, after the package is parsed, any targets that are now needed for the build and ready to be built are queued, and any new packages are queued for parsing. When a specific label is requested this is straightforward, but when parsing for pseudo-targets like :all and ..., various flags affect it: If 'noDeps' is true, then no new packages will be added and no new targets queued. 'include' and 'exclude' refer to the labels of targets to be added. If 'include' is non-empty then only targets with at least one matching label are added. Any targets with a label in 'exclude' are not added. 'forSubinclude' is set when the parse is required for a subinclude target so should proceed even when we're not otherwise building targets.
func PrintRuleArgs ¶
func PrintRuleArgs(state *core.BuildState, labels []core.BuildLabel)
PrintRuleArgs prints the arguments of all builtin rules (plus any associated ones from the given targets)
func RunCode ¶
func RunCode(state *core.BuildState, code string) error
RunCode will run some arbitrary Python code using our embedded interpreter.
func SetCommand ¶
func SetCommand(cPackage uintptr, cTarget *C.char, cConfigOrCommand *C.char, cCommand *C.char) *C.char
SetCommand is a cgo callback that sets a (possibly config-specific) command on a target.
func SetContainerSetting ¶
SetContainerSetting sets a particular container setting on a target.
func SetPostBuildFunction ¶
SetPostBuildFunction sets a post-build function on a target.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package asp implements an experimental BUILD-language parser.
|
Package asp implements an experimental BUILD-language parser. |
main
Package main implements a compiler for the builtin build rules, which is used at bootstrap time.
|
Package main implements a compiler for the builtin build rules, which is used at bootstrap time. |