本文整理汇总了PHP中Project::addBuildListener方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::addBuildListener方法的具体用法?PHP Project::addBuildListener怎么用?PHP Project::addBuildListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::addBuildListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProject
/**
* Set the project associated with this recorder entry.
*
* @param Project $project the project instance
*/
public function setProject(Project $project)
{
$this->project = $project;
if ($this->project != null) {
$this->project->addBuildListener($this);
}
}
示例2: main
/**
* Executes this target.
*/
public function main()
{
if ($this->name === null) {
throw new BuildException('The name attribute must be specified');
}
/* Words cannot describe how ridiculously fucking stupid this is. Phing
* seems to resolve properties only once, ever, so in order to run a
* target multiple times with different properties we'll have to create
* a new project, parse the build file all over again, copy everything
* over from the current project, execute the new target, and then copy
* everything back. Fuck. */
$project = new Project();
try {
foreach ($this->project->getBuildListeners() as $listener) {
$project->addBuildListener($listener);
}
$project->setInputHandler($this->project->getInputHandler());
$this->project->copyUserProperties($project);
$this->project->copyInheritedProperties($project);
foreach ($this->project->getProperties() as $name => $property) {
if ($project->getProperty($name) === null) {
$project->setNewProperty($name, $property);
}
}
$project->init();
ProjectConfigurator::configureProject($project, new PhingFile($this->project->getProperty('phing.file')));
Phing::setCurrentProject($project);
$project->executeTarget($this->name);
} catch (BuildException $be) {
if ($this->exceptionsFatal) {
throw $be;
} else {
$this->log('Ignoring build exception: ' . $be->getMessage(), Project::MSG_WARN);
$this->log('Continuing build', Project::MSG_INFO);
}
}
Phing::setCurrentProject($this->project);
/**
* :NOTE: copy all user properties so that child task may overwrite
* properties that were already set in the parent project
*
* using the Project::copyUserProperties() will result in
* properties not adjusted to the new value.
*/
foreach ($project->getUserProperties() as $name => $property) {
$this->project->setUserProperty($name, $property);
}
$project->copyInheritedProperties($this->project);
foreach ($project->getProperties() as $name => $property) {
if ($this->project->getProperty($name) === null) {
$this->project->setNewProperty($name, $property);
}
}
/* Fuck. */
unset($project);
}
示例3: addBuildListeners
/**
* Bind any registered build listeners to this project.
*
* This means adding the logger and any build listeners that were specified
* with -listener arg.
*
* @param Project $project
* @return void
*/
private function addBuildListeners(Project $project)
{
// Add the default listener
$project->addBuildListener($this->createLogger());
foreach ($this->listeners as $listenerClassname) {
try {
$clz = Phing::import($listenerClassname);
} catch (Exception $x) {
$msg = "Unable to instantiate specified listener " . "class " . $listenerClassname . " : " . $e->getMessage();
throw new ConfigurationException($msg);
}
$listener = new $clz();
if ($listener instanceof StreamRequiredBuildLogger) {
throw new ConfigurationException("Unable to add " . $listenerClassname . " as a listener, since it requires explicit error/output streams. (You can specify it as a -logger.)");
}
$project->addBuildListener($listener);
}
}
示例4: addBuildListeners
/**
* Bind any default build listeners to this project.
* Currently this means adding the logger.
* @param Project $project
* @return void
*/
private function addBuildListeners(Project $project)
{
// Add the default listener
$project->addBuildListener($this->createLogger());
}
示例5: addBuildListeners
/**
* Bind any registered build listeners to this project.
*
* This means adding the logger and any build listeners that were specified
* with -listener arg.
*
* @param Project $project
* @return void
*/
private function addBuildListeners(Project $project)
{
// Add the default listener
$project->addBuildListener($this->createLogger());
foreach ($this->listeners as $listenerClassname) {
try {
$clz = Phing::import($listenerClassname);
$listener = new $clz();
$project->addBuildListener($listener);
} catch (Exception $e) {
$msg = "Unable to instantiate specified listener " . "class " . $listenerClassname . " : " . $e->getMessage();
throw new BuildException($msg);
}
}
}
示例6: Project
$GLOBALS['PROPERTIES']['project.directory'] = $GLOBALS['PROJECT_DIRECTORY'];
/* Execute Phing. */
try {
$project = new Project();
// hax for Mac OS X 10.5 Leopard, where "dim" ANSI colors are broken...
if (PHP_OS == 'Darwin' && (isset($_SERVER['TERM_PROGRAM']) && $_SERVER['TERM_PROGRAM'] == 'Apple_Terminal' || isset($_ENV['TERM_PROGRAM']) && $_ENV['TERM_PROGRAM'] == 'Apple_Terminal') && version_compare(preg_replace('/^ProductVersion:\\s*([0-9]+\\.[0-9]+)/ms', '$1', shell_exec('sw_vers')), '10.5', 'eq') && !Phing::getProperty('phing.logger.defaults')) {
Phing::setProperty('phing.logger.defaults', new PhingFile(BUILD_DIRECTORY . '/agavi/phing/ansicolorlogger_osxleopard.properties'));
} elseif (stripos(PHP_OS, 'Win') === 0) {
$GLOBALS['LOGGER'] = 'phing.listener.DefaultLogger';
}
$GLOBALS['LOGGER'] = Phing::import($GLOBALS['LOGGER']);
$logger = new AgaviProxyBuildLogger(new $GLOBALS['LOGGER']());
$logger->setMessageOutputLevel($GLOBALS['VERBOSE'] ? Project::MSG_VERBOSE : Project::MSG_INFO);
$logger->setOutputStream($GLOBALS['OUTPUT']);
$logger->setErrorStream($GLOBALS['ERROR']);
$project->addBuildListener($logger);
$project->setInputHandler(new DefaultInputHandler());
$project->setUserProperty('phing.file', $GLOBALS['BUILD']->getAbsolutePath());
$project->setUserProperty('phing.version', Phing::getPhingVersion());
/* Phing fucks with the cwd. Really, brilliant. */
$project->setUserProperty('application.startdir', START_DIRECTORY);
foreach ($GLOBALS['PROPERTIES'] as $name => $value) {
$project->setUserProperty($name, $value);
}
$project->init();
ProjectConfigurator::configureProject($project, $GLOBALS['BUILD']);
Phing::setCurrentProject($project);
if ($GLOBALS['SHOW_LIST'] === true) {
input_help_display();
$GLOBALS['OUTPUT']->write(PHP_EOL);
$GLOBALS['OUTPUT']->write('Targets:' . PHP_EOL);
示例7: copy
/**
* Copies the configuration from the proxied project into this project.
*
* @author Noah Fontes <noah.fontes@bitextender.com>
* @since 1.0.4
*/
protected function copy()
{
foreach ($this->proxied->getBuildListeners() as $listener) {
parent::addBuildListener($listener);
}
$this->setInputHandler($this->proxied->getInputHandler());
foreach ($this->proxied->getTaskDefinitions() as $name => $class) {
parent::addTaskDefinition($name, $class);
}
foreach ($this->proxied->getDataTypeDefinitions() as $name => $class) {
parent::addDataTypeDefinition($name, $class);
}
/* Assign properties for consistency. */
$this->proxied->copyUserProperties($this);
$this->proxied->copyInheritedProperties($this);
foreach ($this->proxied->getProperties() as $name => $property) {
if (!AgaviProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) {
parent::setNewProperty($name, $property);
}
}
/* Add proxy targets to the new project. */
foreach ($this->proxied->getTargets() as $name => $target) {
$proxy = new AgaviProxyTarget();
$proxy->setName($name);
$proxy->setDescription($target->getDescription());
$proxy->setTarget($target);
parent::addTarget($name, $proxy);
}
parent::setUserProperty('phing.version', $this->proxied->getProperty('phing.version'));
$this->setSystemProperties();
}