本文整理汇总了PHP中BuildEvent类的典型用法代码示例。如果您正苦于以下问题:PHP BuildEvent类的具体用法?PHP BuildEvent怎么用?PHP BuildEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuildEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: targetFinished
function targetFinished(BuildEvent $event)
{
$msg .= PHP_EOL . "Target time: " . self::formatTime(Phing::currentTimeMillis() - $this->targetStartTime) . PHP_EOL;
$event->setMessage($msg, Project::MSG_INFO);
$this->messageLogged($event);
$this->targetName = null;
}
示例2: messageLogged
function messageLogged(BuildEvent $event)
{
if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim($event->getMessage() === "")) {
return;
}
if ($this->targetName !== null) {
print $this->lSep . "Target: " . $this->targetName . $this->lSep;
$this->targetName = null;
}
parent::messageLogged($event);
}
示例3: messageLogged
/**
* Fired whenever a message is logged.
*
* @param BuildEvent The BuildEvent
* @see BuildEvent::getMessage()
*/
public function messageLogged(BuildEvent $event)
{
if ($event->getPriority() == Project::MSG_ERR) {
if (preg_match('/XLST transformation/', $event->getMessage())) {
// not really an error
return;
}
$msg = '';
if ($event->getTask() !== null) {
$msg = sprintf('[%s] ', $event->getTask()->getTaskName());
}
$msg .= $event->getMessage();
self::$errors[] = $msg;
}
}
示例4: 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);
}
示例5: 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());
}
示例6: messageLogged
/**
* Fired whenever a message is logged.
*
* @see BuildEvent#getMessage()
* @see BuildEvent#getPriority()
*/
public function messageLogged(BuildEvent $event)
{
$this->parent->logBuffer[] = $event->getMessage();
}
示例7: messageLogged
/**
* Print any echo messages to the stdout.
*
* @param object The BuildEvent
* @access public
* @see BuildEvent::getMessage()
*/
function messageLogged(BuildEvent $event)
{
if ($event->getPriority() <= $this->msgOutputLevel) {
$msg = "";
if ($event->getTask() !== null) {
$name = $event->getTask();
$name = $name->getTaskName();
if ($name == 'echo') {
$msg = "[{$name}] ";
$msg .= $event->getMessage();
$this->printMessage($msg, $event->getPriority());
}
}
}
}
示例8: buildFinished
public function buildFinished(BuildEvent $event)
{
if ($event->getException() != null) {
parent::buildFinished($event);
}
}
示例9: getDefaultBuildEvent
protected function getDefaultBuildEvent()
{
return BuildEvent::createDefault();
}
示例10: messageLogged
/**
* Print a message to the stdout.
*
* @param object The BuildEvent
* @access public
* @see BuildEvent::getMessage()
*/
public function messageLogged(BuildEvent $event)
{
$priority = $event->getPriority();
if ($priority <= $this->msgOutputLevel) {
$msg = "";
if ($event->getTask() !== null) {
$name = $event->getTask();
$name = $name->getTaskName();
$msg = str_pad("[{$name}] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT);
}
$msg .= $event->getMessage();
if ($priority != Project::MSG_ERR) {
$this->printMessage($msg, $this->out, $priority);
} else {
$this->printMessage($msg, $this->err, $priority);
}
}
}
示例11: subBuildFinished
/**
* Cleans recorder registry, if this is the subbuild the task has
* been created in.
* @param BuildEvent $event ignored.
*/
public function subBuildFinished(BuildEvent $event)
{
if ($event->getProject() == $this->getProject()) {
$this->cleanup();
}
}
示例12: parseBuildEvent
/**
* Parse a new BuildEvent from a SimpleXMLElement.
*
* @param $log_event (Object) SimpleXMLElement node to be "parsed".
* @return (object) Resultant BuildEvent object.
*/
private static function parseBuildEvent(&$log_event)
{
if (!$log_event instanceof SimpleXMLElement) {
throw new Exception('Received invalid log_event');
}
$uniqueId = (int) $log_event->uniqueId;
$startDate = strtotime(clean_text($log_event->startDate));
$authorName = clean_text($log_event->authorName);
$authorEmail = clean_text($log_event->authorEmail);
if (!empty($log_event->releaseType)) {
$releaseType = BuildRepositoryPlugin::parseReleaseType(clean_text($log_event->releaseType));
} else {
$releaseType = RT_UNSTABLE;
}
$event = new BuildEvent($uniqueId, $startDate, $authorName, $authorEmail, $releaseType);
if (!empty($log_event->releaseNotes)) {
$event->setReleaseNotesUri(clean_text($log_event->releaseNotes));
}
if (!empty($log_event->changeLog)) {
$event->setReleaseChangeLogUri(clean_text($log_event->changeLog));
}
return $event;
}
示例13: populateReleases
/**
* Produce a indexable directory of BuildEvents from the Packages
* collection, grouping them according to the version number of the
* 'Doomsday' packages those events produced.
*
* The version number (string) is used as key to each record.
*
* @param matrix (Array) will be populated with new records.
* @return (Mixed) FALSE if no packages were added to the matrix
* otherwise the number of added packages (integer).
*/
private function populateReleases(&$releases)
{
if (!is_array($releases)) {
throw new Exception('populateReleases: Invalid matrix argument, array expected.');
}
if (!isset($this->packages)) {
return FALSE;
}
// Running total of the number of events we add to the matrix.
$numEventsAdded = (int) 0;
foreach ($this->packages as &$pack) {
// We are only interested in the 'Doomsday' packages.
if ($pack->title() !== 'Doomsday') {
continue;
}
// Have we encountered this version before?.
$versionText = "{$pack->version()}";
$key = array_casekey_exists($versionText, $releases);
if ($key === false) {
// Not yet construct a new record and associate it
// in the release list using the version number as the key.
$key = ucwords($versionText);
$releases[$key] = $this->newReleaseInfo($key);
$releaseInfo =& $releases[$key];
} else {
$releaseInfo =& $releases[$versionText];
}
$build = NULL;
// Is this package a product of the autobuilder?
if ($pack instanceof iBuilderProduct) {
// Yes; we have "real" BuildEvent we can link with this.
$buildUniqueId = $pack->buildUniqueId();
$build = $this->buildByUniqueId($buildUniqueId);
} else {
// No - this must be a symbolic package.
// We'll instantiate a symbolic BuildEvent for this.
$build = new BuildEvent(0, $pack->hasReleaseDate() ? $pack->releaseDate() : strtotime('Jan 8, 2005'), 'skyjake', 'jaakko.keranen@iki.fi', RT_STABLE);
if ($pack->hasReleaseNotesUri()) {
$build->setReleaseNotesUri($pack->releaseNotesUri());
}
if ($pack->hasReleaseChangeLogUri()) {
$build->setReleaseChangeLogUri($pack->releaseChangeLogUri());
}
$build->addPackage($pack);
}
if (!$build instanceof BuildEvent) {
continue;
}
// Odd...
// Is a build event already present for this release version?
$latestBuild = isset($releaseInfo['latestBuild']) ? $releaseInfo['latestBuild'] : NULL;
if ($latestBuild instanceof BuildEvent) {
// Is this a newer build?
if ($build->uniqueId() > $latestBuild->uniqueId()) {
$releaseInfo['latestBuild'] = $build;
}
} else {
$releaseInfo['latestBuild'] = $build;
}
// Promote the status of the release due to this package?
$releaseTypeId = $build->releaseTypeId();
if ($releaseTypeId > $releaseInfo['releaseTypeId']) {
$releaseInfo['releaseTypeId'] = $releaseTypeId;
}
}
return $numEventsAdded;
}
示例14: buildFinished
/**
* Logs the end of a build.
*
* @param BuildEvent An event containing the data to be logged.
*
* @see DefaultLogger::buildFinished()
*
* @author Noah Fontes <noah.fontes@bitextender.com>
* @since 1.0.0
*/
public function buildFinished(BuildEvent $event)
{
$exception = $event->getException();
if ($exception !== null) {
$this->printMessage(str_pad('[error] ', DefaultLogger::LEFT_COLUMN_SIZE, ' ', STR_PAD_LEFT) . $exception->getMessage(), $this->out, $event->getPriority());
}
}
示例15: targetFinished
/**
* Logs the end of a target.
*
* The event is only logged if the target is not an instance of
* <code>AgaviProxyTarget</code>.
*
* @param BuildEvent An event containing the data to be logged.
*
* @see AgaviProxyTarget
* @see DefaultLogger::targetStarted()
*
* @author Noah Fontes <noah.fontes@bitextender.com>
* @since 1.0.0
*/
public function targetFinished(BuildEvent $event)
{
if (!$event->getTarget() instanceof AgaviProxyTarget) {
parent::targetFinished($event);
}
}