Entry point into Phing.
This class handles the full lifecycle of a build -- from parsing & handling commandline arguments to assembling the project to shutting down and cleaning up in the end.
If you are invoking Phing from an external application, this is still the class to use. Your applicaiton can invoke the start() method, passing any commandline arguments or additional properties.
| author | Andreas Aderhold |
|---|---|
| author | Hans Lellelid |
| version | $Id: 1c51e37f5b2590517dd6d60a805ab2d0cda7cf6b $ |
| package | phing |
__import(string $path, mixed $classpath)
stringPath to the PHP file
mixedString or object supporting __toString()
\BuildException |
- if cannot find the specified file |
|---|
clearCapturedPhpErrors()
currentTimeMillis()
execute(array $args) : void
arraycommandline args passed to phing shell.
fire(array $args) : void
This method kicks off the building of a project object and executes a build using either a given target or the default target.
arrayCommand line args.
getCapturedPhpErrors() : array
arrayarray('message' => message, 'line' => line number, 'file' => file name, 'level' => error level)getCurrentProject() : \Project
\ProjectCurrent Project or NULL if none is set yet/still.getDefinedProperty(string $name) : string
"Defined" in this case means "externally defined". The reason this method exists is to provide a public means of accessing commandline properties for (e.g.) logger or listener scripts. E.g. to specify which logfile to use, PearLogger needs to be able to access the pear.log.name property.
string
stringvalue of found property (or null, if none found).getMsgOutputLevel() : int
backtraces -- for "debug" level.
intgetOutputStream() : \OutputStream
getPhingVersion() : string
getProperties()
getProperty($propName) : string
System properties are "global" properties like application.startdir, and user.dir. Many of these correspond to similar properties in Java or Ant.
stringValue of found property (or null, if none found).getResourcePath($path) : string
stringFile found (null if no file found).halt()
| deprecated | This method is deprecated and is no longer called by Phing internally. Any normal shutdown routines are handled by the shutdown() method. |
|---|---|
| see | \shutdown() |
handlePhpError($level, $message, $file, $line)
This uses the logging for the currently configured project.
import(string $dotPath, mixed $classpath) : string
string
mixedString or object supporting __toString()
\BuildException |
- if cannot find the specified file |
|---|
stringThe unqualified classname (which can be instantiated).log(string $message, int $priority)
If there is no currently-configured Project, then this will do nothing.
string
intProject::MSG_INFO, etc.
printDescription(\Project $project)
printMessage(\Exception $t)
\Exception
printTargets($project)
printUsage()
printVersion()
runBuild() : void
setDefinedProperty(string $name, $value) : string
string
stringvalue of found property (or null, if none found).setErrorStream(\OutputStream $stream)
setOutputStream(\OutputStream $stream)
setProperty($propName, $propValue)
shutdown() : void
start(array $args, array $additionalUserProperties)
This method encapsulates the complete build lifecycle.
| see | \execute() |
|---|---|
| see | \runBuild() |
arrayThe commandline args passed to phing shell script.
arrayAny additional properties to be passed to Phing (alternative front-end might implement this). These additional properties will be available using the getDefinedProperty() method and will be added to the project's "user" properties
\Exception |
- if there is an error during build |
|---|
startPhpErrorCapture()
While errors are being captured, they are not logged.
startup() : void
Sets up the Phing environment but does not initiate the build process.
\Exception |
- If the Phing environment cannot be initialized. |
|---|
stopPhpErrorCapture()
The errors will once again be logged after calling this method.
unsetCurrentProject()
_findBuildFile(string $start, string $suffix) : \PhingFile
Takes the given target as a suffix to append to each parent directory in search of a build file. Once the root of the file-system has been reached an exception is thrown.
stringStart file path.
stringSuffix filename to look for in parents.
\BuildException |
Failed to locate a build file |
|---|
\PhingFileA handle to the build file_printTargets(array $names, array $descriptions, string $heading, int $maxlen)
arrayThe names to be printed.
Must not be null.
arrayThe associated target descriptions.
May be null, in which case
no descriptions are displayed.
If non-null, this should have
as many elements as names.
stringThe heading to display.
Should not be null.
intThe maximum length of the names of the targets. If descriptions are given, they are padded to this position so they line up (so long as the names really are shorter than this).
addBuildListeners(\Project $project) : void
This means adding the logger and any build listeners that were specified with -listener arg.
\Project
addInputHandler(\Project $project)
comparePhingVersion($version)
convertShorthand(string $val)
createLogger() : \BuildLogger
\BuildLoggerThe created LoggerhandleLogfile()
| since | Phing 2.3.0 |
|---|
initializeOutputStreams()
restoreIni() : void
Currently the following settings are not restored: - max_execution_time (because getting current time limit is not possible) - memory_limit (which may have been increased by Phing)
setIncludePaths() : void
\ConfigurationException |
- if the include_path could not be set (for some bizarre reason) |
|---|
setIni() : void
setSystemConstants() : void
$buildFile
$capturedPhpErrors
$currentProject
$definedProps : \Properties
$importPaths
$inputHandlerClassname
$isLogFileUsed : boolean
$listeners
$loggerClassname
$msgOutputLevel
Follows Project::MSG_XXX
$origIniSettings : array
| see | \restoreIni() |
|---|
$out : \OUtputStream
$phpErrorCapture
$projectHelp
$properties
$readyToRun
$targets
$timer
DEFAULT_BUILD_FILENAME