Documentation ¶
Overview ¶
Package responsible for parsing build files and constructing build targets & the graph.
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 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 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 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 RunCode(state *core.BuildState, code string) error
- func RunPostBuildFunction(tid int, state *core.BuildState, target *core.BuildTarget, out string) error
- func RunPreBuildFunction(tid int, state *core.BuildState, target *core.BuildTarget) 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)
- func UndeferAnyParses(state *core.BuildState, target *core.BuildTarget)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDependency ¶
func AddLicencePost ¶
func AddNamedOutputPost ¶
func AddTestCommand ¶
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 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 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 Parse ¶
func Parse(tid int, state *core.BuildState, label, dependor core.BuildLabel, noDeps bool, include, exclude []string)
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.
func RunCode ¶
func RunCode(state *core.BuildState, code string) error
RunCode will run some arbitrary Python code using our embedded interpreter.
func RunPostBuildFunction ¶
func RunPostBuildFunction(tid int, state *core.BuildState, target *core.BuildTarget, out string) error
RunPostBuildFunction runs a post-build callback function registered on a build target via post_build = <...>.
This is called after the target has been built and it is given the combined stdout/stderr of the build process. This output is passed to the post-build Python function which can then generate new targets or add dependencies to existing unbuilt targets.
func RunPreBuildFunction ¶
func RunPreBuildFunction(tid int, state *core.BuildState, target *core.BuildTarget) error
RunPreBuildFunction runs a pre-build callback function registered on a build target via pre_build = <...>.
This is called before the target is built. It doesn't receive any output like the post-build one does but can be useful for other things; for example if you want to investigate a target's transitive labels to adjust its build command, you have to do that here (because in general the transitive dependencies aren't known when the rule is evaluated).
func SetCommand ¶
func SetPostBuildFunction ¶
func SetPreBuildFunction ¶
func UndeferAnyParses ¶
func UndeferAnyParses(state *core.BuildState, target *core.BuildTarget)
UndeferAnyParses un-defers the parsing of a package if it depended on some subinclude target being built.
Types ¶
This section is empty.