parse

package
v9.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(cTarget uintptr, cConfig *C.char, cCommand *C.char) *C.char

AddCommand adds a (possibly config-specific) command to a target.

func AddData

func AddData(cTarget uintptr, cData *C.char) *C.char

AddData adds a runtime data file to a test.

func AddDep

func AddDep(cTarget uintptr, cDep *C.char) *C.char

AddDep adds a dependency to a target.

func AddDependency

func AddDependency(cPackage uintptr, cTarget *C.char, cDep *C.char, exported bool) *C.char

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

func AddExportedDep(cTarget uintptr, cDep *C.char) *C.char

AddExportedDep adds an exported dependency to a target.

func AddHash

func AddHash(cTarget uintptr, cHash *C.char) *C.char

AddHash adds a hash to a build target.

func AddLabel

func AddLabel(cTarget uintptr, cLabel *C.char) *C.char

AddLabel adds a label to a build target.

func AddLicence

func AddLicence(cTarget uintptr, cLicence *C.char) *C.char

AddLicence adds a licence to a build target.

func AddLicencePost

func AddLicencePost(cPackage uintptr, cTarget *C.char, cLicence *C.char) *C.char

AddLicencePost is called by the add_licence builtin to add a licence to a target during a post-build function.

func AddNamedOutput

func AddNamedOutput(cTarget uintptr, cName *C.char, cOutput *C.char) *C.char

AddNamedOutput adds a named output to a build target.

func AddNamedOutputPost

func AddNamedOutputPost(cPackage uintptr, cTarget, cName, cOut *C.char) *C.char

AddNamedOutputPost is called by the add_out builtin to add an output to an existing target.

func AddNamedSource

func AddNamedSource(cTarget uintptr, cName *C.char, cSource *C.char) *C.char

AddNamedSource adds a named source to a target.

func AddNamedTool

func AddNamedTool(cTarget uintptr, cName *C.char, cTool *C.char) *C.char

AddNamedTool adds a named tool to a build target.

func AddOptionalOutput

func AddOptionalOutput(cTarget uintptr, cOutput *C.char) *C.char

AddOptionalOutput adds an optional output to a build target.

func AddOutput

func AddOutput(cTarget uintptr, cOutput *C.char) *C.char

AddOutput adds an output to a build target.

func AddOutputPost

func AddOutputPost(cPackage uintptr, cTarget, cOut *C.char) *C.char

AddOutputPost is called by the add_out builtin to add an output to an existing target.

func AddProvide

func AddProvide(cTarget uintptr, cLanguage *C.char, cDep *C.char) *C.char

AddProvide adds a provide mapping to a build target.

func AddRequire

func AddRequire(cTarget uintptr, cRequire *C.char) *C.char

AddRequire adds a require statement to a build target.

func AddSecret

func AddSecret(cTarget uintptr, cSecret *C.char) *C.char

AddSecret adds a secret to a target.

func AddSource

func AddSource(cTarget uintptr, cSource *C.char) *C.char

AddSource is a cgo callback that adds a source to a target.

func AddTarget

func AddTarget(pkgPtr uintptr, cName, cCmd, cTestCmd *C.char, binary, test, needsTransitiveDeps,
	outputIsComplete, containerise, sandbox, testSandbox, noTestOutput, testOnly, stamp, 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

func AddTestCommand(cTarget uintptr, cConfig *C.char, cCommand *C.char) *C.char

AddTestCommand adds a (possibly config-specific) test command to a target.

func AddTestOutput

func AddTestOutput(cTarget uintptr, cTestOutput *C.char) *C.char

AddTestOutput adds a test output file to a build target.

func AddTool

func AddTool(cTarget uintptr, cTool *C.char) *C.char

AddTool adds a tool to a build target.

func AddVis

func AddVis(cTarget uintptr, cVis *C.char) *C.char

AddVis adds a visibility directive to a build target.

func GetCommand

func GetCommand(cPackage uintptr, cTarget *C.char, cConfig *C.char) *C.char

GetCommand is a cgo callback that returns the command for a target.

func GetIncludeFile

func GetIncludeFile(cPackage uintptr, cLabel *C.char) *C.char

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

func GetLabels(cPackage uintptr, cTarget *C.char, cPrefix *C.char) **C.char

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

func GetSubincludeFile(cPackage uintptr, cLabel *C.char) *C.char

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 IsValidTargetName

func IsValidTargetName(name *C.char) bool

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

func Log(level int, cPackage uintptr, cMessage *C.char)

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 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 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

func SetContainerSetting(cTarget uintptr, cName, cValue *C.char) *C.char

SetContainerSetting sets a particular container setting on a target.

func SetPostBuildFunction

func SetPostBuildFunction(callback uintptr, cBytecode *C.char, cTarget uintptr)

SetPostBuildFunction sets a post-build function on a target.

func SetPreBuildFunction

func SetPreBuildFunction(callback uintptr, cBytecode *C.char, cTarget uintptr)

SetPreBuildFunction sets a pre-build function on a target.

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.

Jump to

Keyboard shortcuts

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