Changeset 143
- Timestamp:
- 02/05/07 14:57:57 (2 years ago)
- Files:
-
- trunk/bin/phing.bat (modified) (1 diff)
- trunk/classes/phing/Phing.php (modified) (6 diffs)
- trunk/classes/phing/listener/DefaultLogger.php (modified) (3 diffs)
- trunk/classes/phing/listener/PearLogger.php (modified) (5 diffs)
- trunk/classes/phing/listener/XmlLogger.php (modified) (6 diffs)
- trunk/classes/phing/parser/ProjectConfigurator.php (modified) (2 diffs)
- trunk/classes/phing/parser/TaskHandler.php (modified) (2 diffs)
- trunk/classes/phing/tasks/defaults.properties (modified) (1 diff)
- trunk/classes/phing/tasks/ext/PDOSQLExecTask.php (copied) (copied from branches/2.2/classes/phing/tasks/ext/PDOSQLExecTask.php)
- trunk/classes/phing/tasks/ext/PDOTask.php (copied) (copied from branches/2.2/classes/phing/tasks/ext/PDOTask.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bin/phing.bat
r123 r143 51 51 52 52 :set_classpath 53 set PHP_CLASSPATH= "%PHING_HOME%\classes"53 set PHP_CLASSPATH=%PHING_HOME%\classes 54 54 goto init 55 55 trunk/classes/phing/Phing.php
r123 r143 63 63 /** The default build file name */ 64 64 const DEFAULT_BUILD_FILENAME = "build.xml"; 65 65 66 66 /** Our current message output status. Follows PROJECT_MSG_XXX */ 67 67 private static $msgOutputLevel = PROJECT_MSG_INFO; … … 223 223 } elseif ($arg == "-logfile") { 224 224 try { // try to set logfile 225 // TODO - This is slated to be overhauled for 2.3.0 226 // see: http://phing.info/trac/ticket/65 225 227 if (!isset($args[$i+1])) { 226 228 print("You must specify a log file when using the -logfile argument\n"); … … 228 230 } else { 229 231 $logFile = new PhingFile($args[++$i]); 230 $this->loggerClassname = 'phing.listener.PearLogger'; 231 $this->setDefinedProperty('pear.log.name', $logFile->getAbsolutePath()); 232 $this->setDefinedProperty('phing.listener.logfile', $logFile->getAbsolutePath()); 232 233 } 233 234 } catch (IOException $ioe) { … … 249 250 $this->listeners[] = $args[++$i]; 250 251 } 251 252 252 } elseif (StringHelper::startsWith("-D", $arg)) { 253 253 $name = substr($arg, 2); … … 472 472 473 473 /** 474 * Bind any default build listeners to this project. 475 * Currently this means adding the logger. 474 * Bind any registered build listeners to this project. 475 * 476 * This means adding the logger and any build listeners that were specified 477 * with -listener arg. 478 * 476 479 * @param Project $project 477 480 * @return void … … 480 483 // Add the default listener 481 484 $project->addBuildListener($this->createLogger()); 485 486 foreach($this->listeners as $listenerClassname) { 487 try { 488 $clz = Phing::import($listenerClassname); 489 $listener = new $clz(); 490 $project->addBuildListener($listener); 491 } catch (Exception $e) { 492 $msg = "Unable to instantiate specified listener " 493 . "class " . $listenerClassname . " : " 494 . $e->getMessage(); 495 throw new BuildException($msg); 496 } 497 } 482 498 } 483 499 trunk/classes/phing/listener/DefaultLogger.php
r123 r143 30 30 * 31 31 * @author Andreas Aderhold <andi@binarycloud.com> 32 * @copyright ©2001,2002 THYRELL. All rights reserved32 * @copyright ᅵ 2001,2002 THYRELL. All rights reserved 33 33 * @version $Revision: 1.11 $ $Date$ 34 34 * @see BuildEvent … … 131 131 } 132 132 } 133 print($this->lSep . "Total time: " . $this->_formatTime(Phing::currentTimeMillis() - $this->startTime) . $this->lSep);133 print($this->lSep . "Total time: " .self::formatTime(Phing::currentTimeMillis() - $this->startTime) . $this->lSep); 134 134 } 135 135 … … 207 207 * @access private 208 208 */ 209 function _formatTime($micros) {209 public static function formatTime($micros) { 210 210 $seconds = $micros; 211 211 $minutes = $seconds / 60; trunk/classes/phing/listener/PearLogger.php
r123 r143 56 56 * @var int 57 57 */ 58 protected $msgOutputLevel = PROJECT_MSG_ ERR;58 protected $msgOutputLevel = PROJECT_MSG_DEBUG; 59 59 60 60 /** … … 85 85 protected function configureLogging() { 86 86 87 $logfile = Phing::getDefinedProperty('phing.listener.logfile'); 88 87 89 $type = Phing::getDefinedProperty('pear.log.type'); 88 90 $name = Phing::getDefinedProperty('pear.log.name'); … … 91 93 92 94 if ($type === null) $type = 'file'; 93 if ($name === null) $name = 'phing.log'; 95 96 if ($name === null) { 97 if ($logfile === null) { 98 $name = 'phing.log'; 99 } else { 100 $name = $logfile; 101 } 102 } 94 103 if ($ident === null) $ident = 'phing'; 95 104 if ($conf === null) $conf = array(); … … 165 174 $msg = "Build failed. [reason: " . $error->getMessage() ."]"; 166 175 } 167 $this->logger()->log($msg . " Total time: " . $this->_formatTime(Phing::currentTimeMillis() - $this->startTime));176 $this->logger()->log($msg . " Total time: " . DefaultLogger::formatTime(Phing::currentTimeMillis() - $this->startTime)); 168 177 } 169 178 … … 226 235 } 227 236 } 228 229 /**230 * Formats a time micro integer to human readable format.231 *232 * @param integer The time stamp233 * @access private234 */235 function _formatTime($micros) {236 $seconds = $micros;237 $minutes = $seconds / 60;238 if ($minutes > 1) {239 return sprintf("%1.0f minute%s %0.2f second%s",240 $minutes, ($minutes === 1 ? " " : "s "),241 $seconds - floor($seconds/60) * 60, ($seconds%60 === 1 ? "" : "s"));242 } else {243 return sprintf("%0.4f second%s", $seconds, ($seconds%60 === 1 ? "" : "s"));244 }245 }246 237 } trunk/classes/phing/listener/XmlLogger.php
r123 r143 67 67 68 68 /** 69 * @var string Name of filename to create. 70 */ 71 private $outFilename; 72 73 /** 69 74 * Constructs a new BuildListener that logs build events to an XML file. 70 75 */ … … 77 82 $this->targetTimer = new Timer(); 78 83 $this->taskTimer = new Timer(); 84 85 86 87 88 $outFilename = Phing::getDefinedProperty('phing.listener.logfile'); 89 if ($outFilename === null) { 90 $outFilename = Phing::getDefinedProperty("XmlLogger.file"); 91 if ($outFilename === null) { 92 $outFilename = "log.xml"; 93 } 94 } 95 96 $this->outFilename = $outFilename; 97 79 98 } 80 99 … … 104 123 $elapsedTime = Phing::currentTimeMillis() - $this->buildTimerStart; 105 124 106 $this->buildElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger:: _formatTime($elapsedTime));125 $this->buildElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); 107 126 108 127 if ($event->getException() != null) … … 116 135 } 117 136 118 $outFilename = $event->getProject()->getProperty("XmlLogger.file"); 119 120 if ($outFilename == "") 121 { 122 $outFilename = "log.xml"; 123 } 124 $writer = new FileWriter($outFilename); 137 $writer = new FileWriter($this->outFilename); 125 138 126 139 $writer->write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 157 170 $elapsedTime = Phing::currentTimeMillis() - $this->targetTimerStart; 158 171 159 $this->targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger:: _formatTime($elapsedTime));172 $this->targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); 160 173 161 174 $this->buildElement->appendChild($this->targetElement); … … 190 203 191 204 $elapsedTime = Phing::currentTimeMillis() - $this->taskTimerStart; 192 $this->taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger:: _formatTime($elapsedTime));205 $this->taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); 193 206 194 207 $this->targetElement->appendChild($this->taskElement); trunk/classes/phing/parser/ProjectConfigurator.php
r123 r143 33 33 * 34 34 * @author Andreas Aderhold <andi@binarycloud.com> 35 * @copyright ©2001,2002 THYRELL. All rights reserved35 * @copyright ᅵ 2001,2002 THYRELL. All rights reserved 36 36 * @version $Revision: 1.17 $ $Date$ 37 37 * @access public … … 239 239 * @param array the element's attributes 240 240 */ 241 function configureId(&$target, $attr) {241 public function configureId($target, $attr) { 242 242 if (isset($attr['id']) && $attr['id'] !== null) { 243 243 $this->project->addReference($attr['id'], $target); trunk/classes/phing/parser/TaskHandler.php
r123 r143 30 30 * 31 31 * @author Andreas Aderhold <andi@binarycloud.com> 32 * @copyright ©2001,2002 THYRELL. All rights reserved32 * @copyright ᅵ 2001,2002 THYRELL. All rights reserved 33 33 * @version $Revision: 1.10 $ 34 34 * @package phing.parser … … 150 150 // should be used in task exceptions to provide details 151 151 $this->task->setLocation($this->parser->getLocation()); 152 $configurator->configureId($t ask, $attrs);152 $configurator->configureId($this->task, $attrs); 153 153 154 154 if ($this->container) { trunk/classes/phing/tasks/defaults.properties
r140 r143 45 45 46 46 sql=phing.tasks.ext.CreoleSQLExecTask 47 pdo=phing.tasks.ext.PDOSQLExecTask 47 48 package-as-path=phing.tasks.ext.PackageAsPathTask 48 49 smarty=phing.tasks.ext.SmartyTask
