本文整理汇总了PHP中BuildEvent::getProject方法的典型用法代码示例。如果您正苦于以下问题:PHP BuildEvent::getProject方法的具体用法?PHP BuildEvent::getProject怎么用?PHP BuildEvent::getProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuildEvent
的用法示例。
在下文中一共展示了BuildEvent::getProject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: messageLogged
function messageLogged(BuildEvent $event)
{
if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim($event->getMessage() === "")) {
return;
}
if ($this->targetName !== null) {
$msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $this->targetName . ':' . PHP_EOL;
$this->printMessage($msg, $this->out, $event->getPriority());
$this->targetName = null;
}
parent::messageLogged($event);
}
示例2: buildFinished
/**
* Fired when the build finishes, this adds the time taken and any
* error stacktrace to the build element and writes the document to disk.
*
* @param BuildEvent $event An event with any relevant extra information.
* Will not be <code>null</code>.
* @throws BuildException
*/
public function buildFinished(BuildEvent $event)
{
$elapsedTime = Phing::currentTimeMillis() - $this->getBuildTimerStart();
$this->getBuildElement()->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
if ($event->getException() != null) {
$this->getBuildElement()->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage());
$errText = $this->getDoc()->createCDATASection($event->getException()->getTraceAsString());
$stacktrace = $this->getDoc()->createElement(XmlLogger::STACKTRACE_TAG);
$stacktrace->appendChild($errText);
$this->getBuildElement()->appendChild($stacktrace);
}
$this->getDoc()->appendChild($this->getBuildElement());
$outFilename = $event->getProject()->getProperty("JsonLogger.file");
if ($outFilename == null) {
$outFilename = "log.json";
}
try {
$stream = $this->getOut();
if ($stream === null) {
$stream = new FileOutputStream($outFilename);
}
$writer = new OutputStreamWriter($stream);
$writer->write($this->xml2js(simplexml_import_dom($this->getDoc())));
$writer->close();
} catch (IOException $exc) {
try {
$stream->close();
// in case there is a stream open still ...
} catch (Exception $x) {
}
throw new BuildException("Unable to write log file.", $exc);
}
// cleanup:remove the buildElement
$this->setBuildElement(null);
array_pop($this->getElementStack());
array_pop($this->getTimesStack());
}
示例3: buildStarted
/**
* Sets the start-time when the build started. Used for calculating
* the build-time.
*
* @param BuildEvent The BuildEvent
*/
public function buildStarted(BuildEvent $event)
{
$this->startTime = Phing::currentTimeMillis();
$this->logger()->setIdent($event->getProject()->getName());
$this->logger()->info("Starting build with buildfile: " . $event->getProject()->getProperty("phing.file"));
}
示例4: targetStarted
/**
* Prints the current target name
*
* @param object The BuildEvent
* @access public
* @see BuildEvent::getTarget()
*/
public function targetStarted(BuildEvent $event)
{
if (Project::MSG_INFO <= $this->msgOutputLevel) {
$msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ':' . PHP_EOL;
$this->printMessage($msg, $this->out, $event->getPriority());
}
}
示例5: subBuildFinished
/**
* Cleans up any resources held by this recorder entry at the end
* of a subbuild if it has been created for the subbuild's project
* instance.
*
* @param BuildEvent $event the buildFinished event
*/
public function subBuildFinished(BuildEvent $event)
{
if ($event->getProject() == $this->project) {
$this->cleanup();
}
}
示例6: buildFinished
/**
* Fired when the build finishes, this adds the time taken and any
* error stacktrace to the build element and writes the document to disk.
*
* @param BuildEvent $event An event with any relevant extra information.
* Will not be <code>null</code>.
* @throws BuildException
*/
public function buildFinished(BuildEvent $event)
{
$elapsedTime = Phing::currentTimeMillis() - $this->buildTimerStart;
$this->buildElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));
if ($event->getException() != null) {
$this->buildElement->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage());
$errText = $this->doc->createCDATASection($event->getException()->getTraceAsString());
$stacktrace = $this->doc->createElement(XmlLogger::STACKTRACE_TAG);
$stacktrace->appendChild($errText);
$this->buildElement->appendChild($stacktrace);
}
$this->doc->appendChild($this->buildElement);
$outFilename = $event->getProject()->getProperty("XmlLogger.file");
if ($outFilename == null) {
$outFilename = "log.xml";
}
try {
$stream = $this->out;
if ($stream === null) {
$stream = new FileOutputStream($outFilename);
}
// Yes, we could just stream->write() but this will eventually be the better
// way to do this (when we need to worry about charset conversions.
$writer = new OutputStreamWriter($stream);
$writer->write($this->doc->saveXML());
$writer->close();
} catch (IOException $exc) {
try {
$stream->close();
// in case there is a stream open still ...
} catch (Exception $x) {
}
throw new BuildException("Unable to write log file.", $exc);
}
// cleanup:remove the buildElement
$this->buildElement = null;
array_pop($this->elementStack);
array_pop($this->timesStack);
}
示例7: targetStarted
/**
* Prints the current target name
*
* @param BuildEvent $event
* @see BuildEvent::getTarget()
*/
public function targetStarted(BuildEvent $event)
{
if (Project::MSG_INFO <= $this->msgOutputLevel && $event->getTarget()->getName() != '') {
$showLongTargets = $event->getProject()->getProperty("phing.showlongtargets");
$msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ($showLongTargets ? ' [' . $event->getTarget()->getDescription() . ']' : '') . ':' . PHP_EOL;
$this->printMessage($msg, $this->out, $event->getPriority());
}
}
示例8: targetStarted
/**
* Prints the current target name
*
* @param object The BuildEvent
* @access public
* @see BuildEvent::getTarget()
*/
function targetStarted(BuildEvent $event)
{
if (PROJECT_MSG_INFO <= $this->msgOutputLevel) {
print $this->lSep . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ':' . $this->lSep;
}
}
示例9: buildFinished
/**
* Fired when the build finishes, this adds the time taken and any
* error stacktrace to the build element and writes the document to disk.
*
* @param BuildEvent An event with any relevant extra information.
* Will not be <code>null</code>.
*/
function buildFinished(BuildEvent $event)
{
$this->buildTimer->stop();
$elapsedTime = Phing::currentTimeMillis() - $this->buildTimerStart;
$this->buildElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::_formatTime($elapsedTime));
if ($event->getException() != null) {
$this->buildElement->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->toString());
$errText = $this->doc->createCDATASection($event->getException()->getTraceAsString());
$stacktrace = $this->doc->createElement(XmlLogger::STACKTRACE_TAG);
$stacktrace->appendChild($errText);
$this->buildElement->appendChild($stacktrace);
}
$outFilename = $event->getProject()->getProperty("XmlLogger.file");
if ($outFilename == "") {
$outFilename = "log.xml";
}
$writer = new FileWriter($outFilename);
$writer->write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
$writer->write($this->doc->saveXML($this->buildElement));
$writer->close();
}
示例10: messageLogged
/**
* Handles the Phing message logged event.
*
* @param BuildEvent The Phing build event.
*
* @author Noah Fontes <noah.fontes@bitextender.com>
* @since 1.0.0
*/
public function messageLogged(BuildEvent $phingEvent)
{
$event = new AgaviPhingMessageEvent();
$event->setSource($phingEvent->getSource());
$event->setMessage($phingEvent->getMessage());
$event->setPriority($phingEvent->getPriority());
$event->setProject($phingEvent->getProject());
foreach ($this->messageListeners as $listener) {
$listener->messageReported($event);
}
}