#!/usr/bin/env php getMessage(); echo 'Cannot initialize Phar'; exit(1); } __HALT_COMPILER(); ?>  phing.phara:4:{s:7:"version";s:6:"2.15.0";s:5:"state";s:6:"stable";s:9:"builddate";s:8:"20160914";s:7:"authors";a:1:{s:12:"Michiel Rook";a:1:{s:6:"e-mail";s:13:"mrook@php.net";}}}5classes/phing/contrib/DocBlox/Parallel/WorkerPipe.php~ W~ ()2classes/phing/contrib/DocBlox/Parallel/Manager.php$W$'J01classes/phing/contrib/DocBlox/Parallel/Worker.phpW%classes/phing/RuntimeConfigurable.phpWh($classes/phing/listener/XmlLogger.php4W4~)classes/phing/listener/NoBannerLogger.php\ W\ Ile(classes/phing/listener/ProfileLogger.phpW3a3'classes/phing/listener/SilentLogger.php9W9,Ѷ*classes/phing/listener/AnsiColorLogger.phpW*~%classes/phing/listener/JsonLogger.phpW;,classes/phing/listener/TimestampedLogger.php%W%H"*classes/phing/listener/PearLogListener.phpnWn0Ghy'classes/phing/listener/TargetLogger.phpZWZÅ*classes/phing/listener/defaults.propertiesWA۶%classes/phing/listener/MailLogger.phpWО*classes/phing/listener/HtmlColorLogger.phpW%(classes/phing/listener/DefaultLogger.php2)W2)5P}4classes/phing/listener/StreamRequiredBuildLogger.phpMWM)$,classes/phing/tasks/system/ConditionTask.php W +W>+B/classes/phing/tasks/system/AdhocTaskdefTask.phpX WX ̌+classes/phing/tasks/system/TryCatchTask.phpWY&classes/phing/tasks/system/CvsTask.php|;W|; Ί'classes/phing/tasks/system/FailTask.phpYWYC̶+classes/phing/tasks/system/UpToDateTask.php%W%,O$classes/phing/tasks/system/Retry.phpW" a-classes/phing/tasks/system/EchoProperties.php1W1 mzc+classes/phing/tasks/system/BlockForTask.phpW WW CӶ)classes/phing/tasks/system/AttribTask.phpWu -(classes/phing/tasks/system/ApplyTask.php_\W_\)pn+classes/phing/tasks/system/RecorderTask.php!W!:h(classes/phing/tasks/system/TouchTask.phpW,(classes/phing/tasks/system/AdhocTask.phpA WA S'classes/phing/tasks/system/XsltTask.php W ض'classes/phing/tasks/system/CopyTask.php]MW]MmҶ(classes/phing/tasks/system/MkdirTask.php W `w,classes/phing/tasks/system/ReflexiveTask.phpUWU6)classes/phing/tasks/system/DeleteTask.php.W."'classes/phing/tasks/system/WarnTask.phpW Ȁ4classes/phing/tasks/system/condition/OrCondition.phpW^4classes/phing/tasks/system/condition/OsCondition.php W 6classes/phing/tasks/system/condition/HttpCondition.php W Ua7classes/phing/tasks/system/condition/IsSetCondition.phpW؟yAclasses/phing/tasks/system/condition/IsPropertyFalseCondition.phpW M>classes/phing/tasks/system/condition/HasFreeSpaceCondition.php W Zg7classes/phing/tasks/system/condition/IsFileSelected.php W 9classes/phing/tasks/system/condition/IsFalseCondition.phpW']5classes/phing/tasks/system/condition/NotCondition.phpW2%2classes/phing/tasks/system/condition/Condition.phpW5classes/phing/tasks/system/condition/AndCondition.phpW'VAclasses/phing/tasks/system/condition/ReferenceExistsCondition.phpW IY8classes/phing/tasks/system/condition/EqualsCondition.php W X;6classes/phing/tasks/system/condition/ConditionBase.php'W'ͧ|8classes/phing/tasks/system/condition/NestedCondition.php$W$/|}@classes/phing/tasks/system/condition/IsPropertyTrueCondition.phpW5classes/phing/tasks/system/condition/PhingVersion.phpWzw8classes/phing/tasks/system/condition/SocketCondition.phpWoYR2classes/phing/tasks/system/condition/IsFailure.php]W]t5classes/phing/tasks/system/condition/XorCondition.php}W}R@classes/phing/tasks/system/condition/VersionCompareCondition.phpw Ww Ÿö3classes/phing/tasks/system/condition/FilesMatch.phpWʬ:classes/phing/tasks/system/condition/ContainsCondition.php W tT;p8classes/phing/tasks/system/condition/IsTrueCondition.phpW)tA1classes/phing/tasks/system/PropertyPromptTask.php;W;P*classes/phing/tasks/system/PhpEvalTask.phpW lU,/classes/phing/tasks/system/AdhocTypedefTask.php W +classes/phing/tasks/system/LoadFileTask.php W nl)classes/phing/tasks/system/ImportTask.phppWpx(classes/phing/tasks/system/InputTask.phpW~ƶ,classes/phing/tasks/system/RecorderEntry.php&W&3(classes/phing/tasks/system/ChownTask.phpW}(classes/phing/tasks/system/ChmodTask.phpW+(classes/phing/tasks/system/PhingTask.phpzQWzQ,classes/phing/tasks/system/PhingCallTask.phpWP<'classes/phing/tasks/system/EchoTask.phpW*classes/phing/tasks/system/CvsPassTask.phpWQ,classes/phing/tasks/system/AvailableTask.phpjWjt%classes/phing/tasks/system/IfTask.phpW$v+classes/phing/tasks/system/PropertyTask.phpEWEHa+classes/phing/tasks/system/MatchingTask.phpy,Wy,'4'classes/phing/tasks/system/Basename.phpH WH yO.classes/phing/tasks/system/IncludePathTask.phpW )classes/phing/tasks/system/SwitchTask.phpLWLi)classes/phing/tasks/system/TstampTask.phpWY'classes/phing/tasks/system/MoveTask.phpW}*classes/phing/tasks/system/TypedefTask.php`W`*classes/phing/tasks/system/PathConvert.php41W41l.classes/phing/tasks/system/ResolvePathTask.php`W`uxZ'classes/phing/tasks/system/TempFile.phpPWPj'classes/phing/tasks/system/ExecTask.php 7W 7 ƶ3classes/phing/tasks/ext/coverage/CoverageMerger.php(W(mG7classes/phing/tasks/ext/coverage/CoverageMergerTask.php W ^{܍:classes/phing/tasks/ext/coverage/CoverageThresholdTask.php:W:9Qo6classes/phing/tasks/ext/coverage/CoverageSetupTask.phpWݨx>classes/phing/tasks/ext/coverage/CoverageReportTransformer.php8W8+classes/phing/tasks/ext/svn/SvnCopyTask.phpW+/classes/phing/tasks/ext/svn/SvnCheckoutTask.phpW o3classes/phing/tasks/ext/svn/SvnLastRevisionTask.phpk Wk -classes/phing/tasks/ext/svn/SvnExportTask.php}W}x2+classes/phing/tasks/ext/svn/SvnInfoTask.php2W2+!*classes/phing/tasks/ext/svn/SvnLogTask.phpB WB Svݶ-classes/phing/tasks/ext/svn/SvnSwitchTask.php> W> 0A߶-classes/phing/tasks/ext/svn/SvnCommitTask.php` W` Hb-classes/phing/tasks/ext/svn/SvnUpdateTask.phpzWzbͶ+classes/phing/tasks/ext/svn/SvnListTask.phpdWdf+classes/phing/tasks/ext/svn/SvnBaseTask.php%W%%P'classes/phing/tasks/ext/SymlinkTask.phpW^`2classes/phing/tasks/ext/ioncube/IoncubeComment.phpW׶6classes/phing/tasks/ext/ioncube/IoncubeLicenseTask.phpW)co6classes/phing/tasks/ext/ioncube/IoncubeEncoderTask.php<W<p8)classes/phing/tasks/ext/FtpDeployTask.phpg:Wg:-classes/phing/tasks/ext/ReplaceRegexpTask.phpW#tk>classes/phing/tasks/ext/phpmd/PHPMDRendererRemoveFromCache.phpW\}j+classes/phing/tasks/ext/phpmd/PHPMDTask.php})W})RL7classes/phing/tasks/ext/phpmd/PHPMDFormatterElement.phpW6!̴%classes/phing/tasks/ext/ThrowTask.phpWm+classes/phing/tasks/ext/XmlPropertyTask.phpd Wd ͓/classes/phing/tasks/ext/ssh/Ssh2MethodParam.php\W\@- 'classes/phing/tasks/ext/ssh/SshTask.php3 W3 0h'classes/phing/tasks/ext/ssh/ScpTask.phpZ3WZ3;1+9classes/phing/tasks/ext/ssh/Ssh2MethodConnectionParam.php W Ÿ,classes/phing/tasks/ext/PearPackage2Task.phpM+WM+i( 5classes/phing/tasks/ext/phploc/PHPLocXMLFormatter.php3W3*85classes/phing/tasks/ext/phploc/PHPLocCSVFormatter.php;W;R9classes/phing/tasks/ext/phploc/PHPLocFormatterFactory.php W :+6classes/phing/tasks/ext/phploc/PHPLocTextFormatter.phpW&"9classes/phing/tasks/ext/phploc/PHPLocFormatterElement.php W _+E-classes/phing/tasks/ext/phploc/PHPLocTask.php&W&眶:classes/phing/tasks/ext/phploc/AbstractPHPLocFormatter.php W f.classes/phing/tasks/ext/pdo/PDOSQLExecTask.php*KW*KM VO'classes/phing/tasks/ext/pdo/PDOTask.phpWq0classes/phing/tasks/ext/pdo/PDOQuerySplitter.phpW.5classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php W 1ݶ5classes/phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php(W( ~5classes/phing/tasks/ext/pdo/XMLPDOResultFormatter.phpWk=p7classes/phing/tasks/ext/pdo/PlainPDOResultFormatter.php W 27classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.phpXWX~:classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php!W!;2classes/phing/tasks/ext/pdo/PDOResultFormatter.phpWS:)classes/phing/tasks/ext/StopwatchTask.phpWUD(classes/phing/tasks/ext/FileSizeTask.php_ W_ O۶4classes/phing/tasks/ext/creole/CreoleSQLExecTask.phpRJWRJ$+-classes/phing/tasks/ext/creole/CreoleTask.phpHWHֶ/classes/phing/tasks/ext/git/GitCheckoutTask.phpW-classes/phing/tasks/ext/git/GitCommitTask.phpaWa*classes/phing/tasks/ext/git/GitLogTask.phpW_ބ,classes/phing/tasks/ext/git/GitCloneTask.phpW9+classes/phing/tasks/ext/git/GitPullTask.php-'W-'b")classes/phing/tasks/ext/git/GitGcTask.phpmWmX+-classes/phing/tasks/ext/git/GitBranchTask.php W ΂9/classes/phing/tasks/ext/git/GitDescribeTask.phpW&+classes/phing/tasks/ext/git/GitPushTask.phpW;+classes/phing/tasks/ext/git/GitBaseTask.phpW9*classes/phing/tasks/ext/git/GitTagTask.php)W) ,classes/phing/tasks/ext/git/GitMergeTask.phpWֶ,classes/phing/tasks/ext/git/GitFetchTask.phpWI0+classes/phing/tasks/ext/git/GitInitTask.php W jbq'classes/phing/tasks/ext/JslLintTask.php;+W;+0(classes/phing/tasks/ext/ComposerTask.phpW9 (classes/phing/tasks/ext/FileSyncTask.php1?W1?/i5classes/phing/tasks/ext/simpletest/SimpleTestTask.phpWGN@Eclasses/phing/tasks/ext/simpletest/SimpleTestDebugResultFormatter.phpWY-Eclasses/phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.phpn Wn HEAclasses/phing/tasks/ext/simpletest/SimpleTestFormatterElement.php_ W_ tnEclasses/phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.phpWBACclasses/phing/tasks/ext/simpletest/SimpleTestXmlResultFormatter.phpWhPGclasses/phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.phpW9@classes/phing/tasks/ext/simpletest/SimpleTestResultFormatter.phppWp.'classes/phing/tasks/ext/PhpLintTask.phps"Ws"o0classes/phing/tasks/ext/ExportPropertiesTask.phpIWIv(classes/phing/tasks/ext/hg/HgAddTask.phpWw;v+classes/phing/tasks/ext/hg/HgCommitTask.php W y)classes/phing/tasks/ext/hg/HgInitTask.phpW4*classes/phing/tasks/ext/hg/HgCloneTask.php% W% i3)classes/phing/tasks/ext/hg/HgBaseTask.php(W(>S+classes/phing/tasks/ext/hg/HgRevertTask.php W sԻ)classes/phing/tasks/ext/hg/HgPushTask.php W *&(classes/phing/tasks/ext/hg/HgLogTask.phpW!e(classes/phing/tasks/ext/hg/HgTagTask.phpN WN +m+classes/phing/tasks/ext/hg/HgUpdateTask.php^ W^ Oy)classes/phing/tasks/ext/hg/HgPullTask.phpLWL,classes/phing/tasks/ext/hg/HgArchiveTask.phpW45Z3$classes/phing/tasks/ext/HttpTask.php6W6rt(classes/phing/tasks/ext/ManifestTask.php|#W|#k-classes/phing/tasks/ext/apigen/ApiGenTask.php+W+QҶ&classes/phing/tasks/ext/SmartyTask.phpMWM <classes/phing/tasks/ext/liquibase/LiquibaseChangeLogTask.php_W_c d7classes/phing/tasks/ext/liquibase/LiquibaseDiffTask.phpW2✍9classes/phing/tasks/ext/liquibase/LiquibaseUpdateTask.phpuWu>;classes/phing/tasks/ext/liquibase/AbstractLiquibaseTask.php+W+麐6classes/phing/tasks/ext/liquibase/LiquibaseTagTask.phphWhw;classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.phpW\8classes/phing/tasks/ext/liquibase/LiquibaseDbDocTask.phpW73classes/phing/tasks/ext/liquibase/LiquibaseTask.php.W.2#classes/phing/tasks/ext/rSTTask.php_/W_/M6+classes/phing/tasks/ext/PearPackageTask.php9W9eS*classes/phing/tasks/ext/AutoloaderTask.php W a2&#classes/phing/tasks/ext/ZipTask.php*W*oV'classes/phing/tasks/ext/HttpGetTask.phpW0classes/phing/tasks/ext/ZendCodeAnalyzerTask.php W &classes/phing/tasks/ext/JsHintTask.phpZWZ,R8Kclasses/phing/tasks/ext/phpunit/formatter/SummaryPHPUnitResultFormatter.phpW<Jclasses/phing/tasks/ext/phpunit/formatter/Crap4jPHPUnitResultFormatter.phpV WV !ͨzIclasses/phing/tasks/ext/phpunit/formatter/PlainPHPUnitResultFormatter.phpMWMODclasses/phing/tasks/ext/phpunit/formatter/PHPUnitResultFormatter.phpWgfJclasses/phing/tasks/ext/phpunit/formatter/CloverPHPUnitResultFormatter.php^ W^ ̻^Gclasses/phing/tasks/ext/phpunit/formatter/XMLPHPUnitResultFormatter.phpW~/classes/phing/tasks/ext/phpunit/PHPUnitUtil.phpWhm忶5classes/phing/tasks/ext/phpunit/PHPUnitTestRunner.phpN,WN,H4classes/phing/tasks/ext/phpunit/FormatterElement.phpGWGh-classes/phing/tasks/ext/phpunit/BatchTest.php>W>$Ձ5classes/phing/tasks/ext/phpunit/PHPUnitReportTask.php W k7Ƕ/classes/phing/tasks/ext/phpunit/PHPUnitTask.phpGCWGCQж2classes/phing/tasks/ext/property/PathToFileSet.phpWmu .classes/phing/tasks/ext/property/RegexTask.phpWxPǶ?classes/phing/tasks/ext/property/AbstractPropertySetterTask.phptWtxk%classes/phing/tasks/ext/UntarTask.phpW-ζ+classes/phing/tasks/ext/jsmin/JsMinTask.phpW.L-classes/phing/tasks/ext/PackageAsPathTask.phpW{:classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.phpBWBy9classes/phing/tasks/ext/zendguard/ZendGuardEncodeTask.php<W<h$classes/phing/tasks/ext/SassTask.phpzWzlD8*classes/phing/tasks/ext/Service/Amazon.phpu Wu V"_-classes/phing/tasks/ext/Service/Amazon/S3.phpW,7classes/phing/tasks/ext/Service/Amazon/S3/S3GetTask.php W @7classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php+W+Fp(classes/phing/tasks/ext/FileHashTask.phpoWoP6'classes/phing/tasks/ext/VersionTask.phpWZ+classes/phing/tasks/ext/GrowlNotifyTask.phpq<Wq<c+classes/phing/tasks/ext/ExtractBaseTask.phpWpC$classes/phing/tasks/ext/MailTask.phpW4classes/phing/tasks/ext/phar/PharMetadataElement.php?W?O-classes/phing/tasks/ext/phar/PharDataTask.php#W#^ -classes/phing/tasks/ext/phar/PharMetadata.phpWrAF0classes/phing/tasks/ext/phar/PharPackageTask.phpQ.WQ.T8#classes/phing/tasks/ext/TarTask.php!<W!<<classes/phing/tasks/ext/pdepend/PhpDependAnalyzerElement.php^ W^ n:classes/phing/tasks/ext/pdepend/PhpDependLoggerElement.php1 W1 91classes/phing/tasks/ext/pdepend/PhpDependTask.php<W<͙.classes/phing/tasks/ext/SymfonyConsole/Arg.php W } =classes/phing/tasks/ext/SymfonyConsole/SymfonyConsoleTask.phpWtBclasses/phing/tasks/ext/phpcpd/formatter/PHPCPDResultFormatter.phpcWcEclasses/phing/tasks/ext/phpcpd/formatter/PMDPHPCPDResultFormatter.phpW*϶Iclasses/phing/tasks/ext/phpcpd/formatter/DefaultPHPCPDResultFormatter.php W `9classes/phing/tasks/ext/phpcpd/PHPCPDFormatterElement.phpW-'3-classes/phing/tasks/ext/phpcpd/PHPCPDTask.php&W&=}.classes/phing/tasks/ext/inifile/IniFileSet.php9 W9 O>1classes/phing/tasks/ext/inifile/IniFileConfig.phpW w/classes/phing/tasks/ext/inifile/IniFileTask.php$W$ƛ 1classes/phing/tasks/ext/inifile/IniFileRemove.php%W%cAclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtBaseTask.php W Eclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtValidateTask.phpWm#dAclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtPackTask.phpW6D*'classes/phing/tasks/ext/XmlLintTask.phpuWufض%classes/phing/tasks/ext/UnzipTask.php W I[<classes/phing/tasks/ext/phpcs/PhpCodeSnifferTask_Wrapper.phpcWcN>classes/phing/tasks/ext/phpcs/Reports_PhingRemoveFromCache.php W PMG/classes/phing/tasks/ext/pearpackage/Fileset.phpWxzO+classes/phing/tasks/ext/WikiPublishTask.php$)W$)zꣶ'classes/phing/tasks/defaults.propertiesW@l classes/phing/UnknownElement.phpu Wu bѶ(classes/phing/ConfigurationException.php W t[ٶclasses/phing/Diagnostics.phpW classes/phing/TaskContainer.phpW7F.+classes/phing/system/io/WinNTFileSystem.phpWt(classes/phing/system/io/OutputStream.phpW|o&classes/phing/system/io/FileWriter.phpIWI6classes/phing/system/io/FileParserFactoryInterface.phpW]&classes/phing/system/io/FileReader.phpWU*classes/phing/system/io/BufferedReader.phppWp:ܶ/classes/phing/system/io/FileParserInterface.phpW*classes/phing/system/io/UnixFileSystem.php(W(µ<¶-classes/phing/system/io/FileParserFactory.php`W`?3,classes/phing/system/io/FileOutputStream.php W \[.classes/phing/system/io/OutputStreamWriter.php W <"classes/phing/system/io/Writer.phpW )classes/phing/system/io/IniFileParser.php W H 2'classes/phing/system/io/IOException.phpWg>d"classes/phing/system/io/Reader.php W un&(classes/phing/system/io/StringReader.php W P+classes/phing/system/io/FileInputStream.php W (classes/phing/system/io/FilterReader.phpW{$*classes/phing/system/io/YamlFileParser.phpWXz+classes/phing/system/io/Win32FileSystem.phpFWF r)classes/phing/system/io/ConsoleReader.php W e"-classes/phing/system/io/InputStreamReader.phpW9_'classes/phing/system/io/PrintStream.php W ݶ&classes/phing/system/io/FileSystem.phpkWksv %classes/phing/system/io/PhingFile.phpWw)*classes/phing/system/io/BufferedWriter.php W ?n'classes/phing/system/io/InputStream.phpNWNx(2classes/phing/system/lang/NullPointerException.php\W\Yɜ+3classes/phing/system/lang/FileNotFoundException.php_W_ )classes/phing/system/lang/EventObject.phpWF/classes/phing/system/lang/SecurityException.phpYWYg'classes/phing/system/lang/Character.phpW_Ҧ&classes/phing/system/util/Register.phpWR#classes/phing/system/util/Timer.php W nIl(classes/phing/system/util/Properties.php:$W:$ƶ"classes/phing/SubBuildListener.phpk Wk B7classes/phing/Phing.phpWd+*classes/phing/mappers/FirstMatchMapper.phpW3z(classes/phing/mappers/IdentityMapper.phpW֛`'classes/phing/mappers/ChainedMapper.phpW9%classes/phing/mappers/MergeMapper.phpI WI H)classes/phing/mappers/ContainerMapper.phpYWY!{S(classes/phing/mappers/FileNameMapper.php<W<)classes/phing/mappers/CompositeMapper.phpWG'classes/phing/mappers/CutDirsMapper.php5 W5 N(0&classes/phing/mappers/RegexpMapper.php~W~f^#'classes/phing/mappers/FlattenMapper.phpWA'[$classes/phing/mappers/GlobMapper.phpW#classes/phing/lib/Capsule.phpWgDkclasses/phing/Project.phpW>~ȶ classes/phing/BuildException.phpaWa`*classes/phing/Task.phpWsƶ'classes/phing/BuildTimeoutException.phpWqmclasses/phing/BuildLogger.phpb Wb GEc"classes/phing/ProjectComponent.php" W" Z؞classes/phing/TaskAdapter.php W C?Q$classes/phing/input/InputHandler.phpWh䏶2classes/phing/input/MultipleChoiceInputRequest.phpW8N+classes/phing/input/DefaultInputHandler.php W Z4$classes/phing/input/InputRequest.php> W> #3)classes/phing/input/YesNoInputRequest.phpW!classes/phing/BuildEvent.phpW+a*classes/phing/filters/ExpandProperties.php`W`9%classes/phing/filters/PrefixLines.phpGWG&2w%classes/phing/filters/TabToSpaces.phpWU \)classes/phing/filters/StripWhitespace.php W <˶'classes/phing/filters/ReplaceRegexp.php1W1()classes/phing/filters/StripLineBreaks.phpWi$classes/phing/filters/TidyFilter.phpW*classes/phing/filters/BaseFilterReader.phpWlQ$classes/phing/filters/XsltFilter.php,W,xE%classes/phing/filters/IconvFilter.phpYWY$ݶ,classes/phing/filters/LineContainsRegexp.phpMWMe˶$classes/phing/filters/HeadFilter.phpW~^&classes/phing/filters/ConcatFilter.phpMWMz'$classes/phing/filters/TailFilter.phpWԌ/classes/phing/filters/ReplaceTokensWithFile.php/W/'classes/phing/filters/EscapeUnicode.phpWj+classes/phing/filters/StripLineComments.phpWÙ'classes/phing/filters/ReplaceTokens.php(7W(71P)classes/phing/filters/ChainableReader.phpFWFpY[$classes/phing/filters/SortFilter.phpWO%classes/phing/filters/SuffixLines.phpxWxYM(classes/phing/filters/XincludeFilter.phpWx/;/classes/phing/filters/BaseParamFilterReader.phpw Ww F-*classes/phing/filters/StripPhpComments.phpW *classes/phing/filters/TranslateGettext.php&W&~*classes/phing/filters/PhpArrayMapLines.phpW|Q0classes/phing/filters/util/ChainReaderHelper.phpW@ʶ1classes/phing/filters/util/IniFileTokenReader.php;W;&classes/phing/filters/LineContains.php W sT classes/phing/util/LogWriter.phpq Wq 'classes/phing/util/DirectoryScanner.phpjiWji5˶*classes/phing/util/regexp/RegexpEngine.php W m1$classes/phing/util/regexp/Regexp.phpW{d(classes/phing/util/regexp/PregEngine.phpWP?@ classes/phing/util/DataStore.phpW$classes/phing/util/PathTokenizer.php9W9ՠ)classes/phing/util/ExtendedFileStream.phpsWsw纶(classes/phing/util/SourceFileScanner.phpmWmme classes/phing/util/FileUtils.php89W89)classes/phing/util/PearPackageScanner.php!W!>C2#classes/phing/util/StringHelper.php5 W5 Bsclasses/phing/BuildListener.php7 W7 =Ѷclasses/phing/Target.php&-W&-W޶%classes/phing/ExitStatusException.php|W|]V*classes/phing/parser/AbstractSAXParser.phpW]Ŷ(classes/phing/parser/DataTypeHandler.phpW~m,classes/phing/parser/ProjectConfigurator.phpA8WA8^XbŶ$classes/phing/parser/ExpatParser.php5W5|](classes/phing/parser/PhingXMLContext.phpFWFT#,classes/phing/parser/ExpatParseException.php4W4܍1$classes/phing/parser/RootHandler.php W !j!classes/phing/parser/Location.php W 3(classes/phing/parser/AbstractHandler.php; W; !k'classes/phing/parser/ElementHandler.phpFWFLv+classes/phing/parser/CustomChildCreator.php#W#6@&classes/phing/parser/TargetHandler.phpWYes'classes/phing/parser/ProjectHandler.php`W`le %classes/phing/IntrospectionHelper.php_W_& classes/phing/types/Excludes.phpW ͚#classes/phing/types/Commandline.php:W:~)classes/phing/types/ExcludesNameEntry.phpWo)classes/phing/types/PhingFilterReader.phpWҶ classes/phing/types/FileList.phpW-m#classes/phing/types/TokenReader.phpW"H"classes/phing/types/PatternSet.php>W>SY 'classes/phing/types/AbstractFileSet.phpNWNclasses/phing/types/FileSet.phpW$ֶclasses/phing/types/Path.php>W>X !0classes/phing/types/selectors/ExtendSelector.phpWu2classes/phing/types/selectors/MajoritySelector.phpc Wc z~D/classes/phing/types/selectors/SelectorUtils.php W 3&,classes/phing/types/selectors/OrSelector.phpG WG g72classes/phing/types/selectors/ReadableSelector.phpWt0classes/phing/types/selectors/SelectSelector.phpW11classes/phing/types/selectors/PresentSelector.phpW;classes/phing/types/selectors/AbstractSelectorContainer.phpb)Wb)"d2classes/phing/types/selectors/ContainsSelector.phpWU-classes/phing/types/selectors/AndSelector.php W =&.classes/phing/types/selectors/FileSelector.php}W}~p`8classes/phing/types/selectors/ContainsRegexpSelector.phpW8 7classes/phing/types/selectors/BaseSelectorContainer.php W 3classes/phing/types/selectors/SelectorContainer.phpVWV*X5.classes/phing/types/selectors/NoneSelector.php, W, 9P1classes/phing/types/selectors/SelectorScanner.phpWg0classes/phing/types/selectors/DependSelector.phpfWf3classes/phing/types/selectors/DifferentSelector.phpUWU)c2classes/phing/types/selectors/FilenameSelector.phpW4classes/phing/types/selectors/ExtendFileSelector.phpWzҶ.classes/phing/types/selectors/BaseSelector.php^ W^ =".classes/phing/types/selectors/TypeSelector.phpSWSޢ1classes/phing/types/selectors/MappingSelector.phpXWXh.classes/phing/types/selectors/SizeSelector.php$W$/:ȶ4classes/phing/types/selectors/BaseExtendSelector.php+ W+ C!h-classes/phing/types/selectors/NotSelector.phpXWX2classes/phing/types/selectors/WritableSelector.phpWr/classes/phing/types/selectors/DepthSelector.phpW(.classes/phing/types/selectors/DateSelector.phpWOg classes/phing/types/DataType.phpW*classes/phing/types/PearPackageFileSet.phpWP_v#classes/phing/types/FilterChain.php!W! 'classes/phing/types/defaults.properties!W!M #classes/phing/types/TokenSource.php2W2Nd(#classes/phing/types/Description.phpWBض)classes/phing/types/RegularExpression.phpgWge4!classes/phing/types/Parameter.php? W? o%classes/phing/types/PropertyValue.phpWHclasses/phing/types/DirSet.phpW ¶'classes/phing/types/IterableFileSet.phpW'classes/phing/types/Parameterizable.php?W?%!classes/phing/types/Reference.phpVWV}classes/phing/types/Mapper.phpC$WC$ietc/phpunit-frames.xslgWgetc/phpunit-noframes.xsl>W>DJetc/str.replace.function.xslWM  etc/phing-grammar.rng * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Class that represents a named pipe for a Worker. * * This class manages the named pipe for a worker and is able to push and pull * specific data to facilitate IPC (interprocess communication). * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_WorkerPipe { /** @var DocBlox_Parallel_Worker worker class that is associated */ protected $worker; /** @var string Path to the pipe */ protected $path; /** * Initializes the named pipe. * * @param DocBlox_Parallel_Worker $worker Associated worker. */ public function __construct(DocBlox_Parallel_Worker $worker) { $this->worker = $worker; $this->path = tempnam(sys_get_temp_dir(), 'dpm_'); posix_mkfifo($this->path, 0750); } /** * If the named pipe was not cleaned up, do so now. */ public function __destruct() { if (file_exists($this->path)) { $this->release(); } } /** * Pull the worker data into the named pipe. * * @return void */ public function pull() { $this->writePipeContents(); } /** * Push the worker data back onto the worker and release the pipe. * * @return void */ public function push() { list($result, $error, $return_code) = $this->readPipeContents(); $this->release(); $this->worker->setResult($result); $this->worker->setError($error); $this->worker->setReturnCode($return_code); } /** * Convenience method to show relation to readPipeContents. * * @return void */ protected function writePipeContents() { // push the gathered data onto a name pipe $pipe = fopen($this->path, 'w'); fwrite( $pipe, serialize( array( $this->worker->getResult(), $this->worker->getError(), $this->worker->getReturnCode() ) ) ); fclose($pipe); } /** * Returns the unserialized contents of the pipe. * * @return array */ protected function readPipeContents() { $pipe = @fopen($this->path, 'r+'); if (! $pipe) { return array( '', 'Worker died unexpectedly', 255 ); } $result = unserialize(fread($pipe, filesize($this->path))); fclose($pipe); return $result; } /** * Releases the pipe. * * @return void */ protected function release() { @unlink($this->path); } } * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Manager class for Parallel processes. * * This class will manage the workers and make sure all processes are executed * in parallel and not too many at the same time. * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_Manager extends ArrayObject { /** @var int The maximum number of processes to run simultaneously */ protected $process_limit = 2; /** @var boolean Tracks whether this manager is currently executing */ protected $is_running = false; /** * Tries to autodetect the optimal number of process by counting the number * of processors. * * @param array $input Input for the array object. * @param int $flags flags for the array object. * @param string $iterator_class Iterator class for this array object. */ public function __construct( $input = array(), $flags = 0, $iterator_class = "ArrayIterator" ) { parent::__construct($input, $flags, $iterator_class); if (is_readable('/proc/cpuinfo')) { $processors = 0; exec("cat /proc/cpuinfo | grep processor | wc -l", $processors); $this->setProcessLimit(reset($processors)); } } /** * Adds a worker to the queue. * * This method will prepare a worker to be executed in parallel once the * execute method is invoked. * A fluent interface is provided so that you can chain multiple workers * in one call. * * Example: * * $cb1 = function () { var_dump('a'); sleep(1); }; * $cb2 = function () { var_dump('b'); sleep(1); }; * * $mgr = new DocBlox_Parallel_Manager(); * $mgr->setProcessLimit(2) * ->addWorker(new DocBlox_Parallel_Worker($cb1)) * ->addWorker(new DocBlox_Parallel_Worker($cb2)) * ->execute(); * * @param int $index The key for this worker. * @param DocBlox_Parallel_Worker $newval The worker to add onto the queue. * * @see DocBlox_Parallel_Manager::execute() * * @throws RuntimeException if this method is invoked while the * manager is busy executing tasks. * @throws InvalidArgumentException if the provided element is not of type * DocBlox_Parallel_Worker. * * @return void */ public function offsetSet($index, $newval) { if (!$newval instanceof DocBlox_Parallel_Worker) { throw new InvalidArgumentException( 'Provided element must be of type DocBlox_Parallel_Worker' ); } if ($this->isRunning()) { throw new RuntimeException( 'Workers may not be added during execution of the manager' ); } parent::offsetSet($index, $newval); } /** * Convenience method to make the addition of workers explicit and allow a * fluent interface. * * @param DocBlox_Parallel_Worker $worker The worker to add onto the queue. * * @return self */ public function addWorker(DocBlox_Parallel_Worker $worker) { $this[] = $worker; return $this; } /** * Sets how many processes at most to execute at the same time. * * A fluent interface is provided so that you can chain multiple workers * in one call. * * @param int $process_limit The limit, minimum of 1 * * @see DocBlox_Parallel_Manager::addWorker() for an example * * @return self */ public function setProcessLimit($process_limit) { if ($process_limit < 1) { throw new InvalidArgumentException( 'Number of simultaneous processes may not be less than 1' ); } $this->process_limit = $process_limit; return $this; } /** * Returns the current limit on the amount of processes that can be * executed at the same time. * * @return int */ public function getProcessLimit() { return $this->process_limit; } /** * Returns whether the manager is executing the workers. * * @return boolean */ public function isRunning() { return $this->is_running; } /** * Executes each worker. * * This method loops through the list of workers and tries to fork as * many times as the ProcessLimit dictates at the same time. * * @return void */ public function execute() { /** @var int[] $processes */ $processes = $this->startExecution(); /** @var DocBlox_Parallel_Worker $worker */ foreach ($this as $worker) { // if requirements are not met, execute workers in series. if (!$this->checkRequirements()) { $worker->execute(); continue; } $this->forkAndRun($worker, $processes); } $this->stopExecution($processes); } /** * Notifies manager that execution has started, checks requirements and * returns array for child processes. * * If forking is not available because library requirements are not met * than the list of workers is processed in series and a E_USER_NOTICE is * triggered. * * @return int[] */ protected function startExecution() { $this->is_running = true; // throw a E_USER_NOTICE if the requirements are not met. if (!$this->checkRequirements()) { trigger_error( 'The PCNTL extension is not available, running workers in series ' . 'instead of parallel', E_USER_NOTICE ); } return array(); } /** * Waits for all processes to have finished and notifies the manager that * execution has stopped. * * @param int[] &$processes List of running processes. * * @return void */ protected function stopExecution(array &$processes) { // starting of processes has ended but some processes might still be // running wait for them to finish while (!empty($processes)) { pcntl_waitpid(array_shift($processes), $status); } /** @var DocBlox_Parallel_Worker $worker */ foreach ($this as $worker) { $worker->pipe->push(); } $this->is_running = false; } /** * Forks the current process and calls the Worker's execute method OR * handles the parent process' execution. * * This is the really tricky part of the forking mechanism. Here we invoke * {@link http://www.php.net/manual/en/function.pcntl-fork.php pcntl_fork} * and either execute the forked process or deal with the parent's process * based on in which process we are. * * To fully understand what is going on here it is recommended to read the * PHP manual page on * {@link http://www.php.net/manual/en/function.pcntl-fork.php pcntl_fork} * and associated articles. * * If there are more workers than may be ran simultaneously then this method * will wait until a slot becomes available and then starts the next worker. * * @param DocBlox_Parallel_Worker $worker The worker to process. * @param int[] &$processes The list of running processes. * * @throws RuntimeException if we are unable to fork. * * @return void */ protected function forkAndRun( DocBlox_Parallel_Worker $worker, array &$processes ) { $worker->pipe = new DocBlox_Parallel_WorkerPipe($worker); // fork the process and register the PID $pid = pcntl_fork(); switch ($pid) { case -1: throw new RuntimeException('Unable to establish a fork'); case 0: // Child process $worker->execute(); $worker->pipe->pull(); // Kill -9 this process to prevent closing of shared file handlers. // Not doing this causes, for example, MySQL connections to be cleaned. posix_kill(getmypid(), SIGKILL); default: // Parent process // Keep track if the worker children $processes[] = $pid; if (count($processes) >= $this->getProcessLimit()) { pcntl_waitpid(array_shift($processes), $status); } break; } } /** * Returns true when all requirements are met. * * @return bool */ protected function checkRequirements() { return (bool) (extension_loaded('pcntl')); } } * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Class that represents the execution of a single task within a parallelized * frame. * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_Worker { /** @var callback the task to execute for this worker */ protected $task = null; /** @var mixed[] A list of argument to pass to the task */ protected $arguments = array(); /** @var int The return code to tell the parent process how it went */ protected $return_code = -1; /** @var mixed The result of the given task */ protected $result = ''; /** @var string The error message, if an error occurred */ protected $error = ''; /** * Creates the worker and sets the task to execute optionally including * the arguments that need to be passed to the task. * * @param callback $task The task to invoke upon execution. * @param mixed[] $arguments The arguments to provide to the task. */ public function __construct($task, array $arguments = array()) { $this->setTask($task); $this->arguments = $arguments; } /** * Returns the list of arguments as provided in the constructor. * * @see DocBlox_Parallel_Worker::__construct() * * @return mixed[] */ public function getArguments() { return $this->arguments; } /** * Returns the task as provided in the constructor. * * @see DocBlox_Parallel_Worker::__construct() * * @return callback */ public function getTask() { return $this->task; } /** * Returns the available return code. * * This method may return -1 if no return code is available yet. * * @return int */ public function getReturnCode() { return $this->return_code; } /** * Sets the return code for this worker. * * Recommended is to use the same codes as are used with * {@link http://www.gnu.org/software/bash/manual/html_node/Exit-Status.html * exit codes}. * * In short: 0 means that the task succeeded and a any other positive value * indicates an error condition. * * @param int $return_code Recommended to be a positive number * * @throw InvalidArgumentException if the code is not a number or negative * * @return void */ public function setReturnCode($return_code) { if (!is_numeric($return_code) || ($return_code < 0)) { throw new InvalidArgumentException( 'Expected the return code to be a positive number' ); } $this->return_code = $return_code; } /** * Returns the error message associated with the return code. * * @return string */ public function getError() { return $this->error; } /** * Sets the error message. * * @param string $error The error message. * * @return void */ public function setError($error) { $this->error = $error; } /** * Returns the result for this task run. * * @return null|mixed */ public function getResult() { return $this->result; } /** * Sets the result for this task run. * * @param mixed $result The value that is returned by the task; can be anything. * * @return void */ public function setResult($result) { $this->result = $result; } /** * Invokes the task with the given arguments and processes the output. * * @return void. */ public function execute() { $this->setReturnCode(0); try { $this->setResult( call_user_func_array($this->getTask(), $this->getArguments()) ); } catch (Exception $e) { $this->setError($e->getMessage()); $this->setReturnCode($e->getCode()); } } /** * Sets the task for this worker and validates whether it is callable. * * @param callback $task The task to execute when the execute method * is invoked. * * @throws InvalidArgumentException if the given argument is not a callback. * * @see DocBlox_Parallel_Worker::__construct() * @see DocBlox_Parallel_Worker::execute() * * @return void */ protected function setTask($task) { if (!is_callable($task)) { throw new InvalidArgumentException( 'Worker task is not a callable object' ); } $this->task = $task; } } . */ /** * Wrapper class that holds the attributes of a Task (or elements * nested below that level) and takes care of configuring that element * at runtime. * * SMART-UP INLINE DOCS * * @author Andreas Aderhold * @author Hans Lellelid * @version $Id: 465efa4e9b1232a9ede67d3a3adadbe1fbafb7e2 $ * @package phing */ class RuntimeConfigurable { private $elementTag = null; /** @var array $children */ private $children = array(); /** @var object|Task $wrappedObject */ private $wrappedObject = null; /** @var array $attributes */ private $attributes = array(); /** @var string $characters */ private $characters = ""; /** @var bool $proxyConfigured */ private $proxyConfigured = false; /** * @param Task|object $proxy * @param mixed $elementTag The element to wrap. */ public function __construct($proxy, $elementTag) { $this->wrappedObject = $proxy; $this->elementTag = $elementTag; if ($proxy instanceof Task) { $proxy->setRuntimeConfigurableWrapper($this); } } /** * @return object|Task */ public function getProxy() { return $this->wrappedObject; } /** * @param object|Task $proxy * * @return void */ public function setProxy($proxy) { $this->wrappedObject = $proxy; $this->proxyConfigured = false; } /** * Set's the attributes for the wrapped element. * * @param array $attributes * * @return void */ public function setAttributes($attributes) { $this->attributes = $attributes; } /** * Returns the AttributeList of the wrapped element. * * @return array */ public function getAttributes() { return $this->attributes; } /** * Adds child elements to the wrapped element. * * @param RuntimeConfigurable $child * * @return void */ public function addChild(RuntimeConfigurable $child) { $this->children[] = $child; } /** * Returns the child with index * * @param int $index * * @return RuntimeConfigurable */ public function getChild($index) { return $this->children[(int) $index]; } /** * Add characters from #PCDATA areas to the wrapped element. * * @param string $data * * @return void */ public function addText($data) { $this->characters .= (string) $data; } public function getElementTag() { return $this->elementTag; } /** * Configure the wrapped element and all children. * * @param Project $project * * @return void * * @throws BuildException * @throws Exception */ public function maybeConfigure(Project $project) { if ($this->proxyConfigured) { return; } $id = null; // DataType configured in ProjectConfigurator // if ( is_a($this->wrappedObject, "DataType") ) // return; if ($this->attributes || (isset($this->characters) && $this->characters != '')) { ProjectConfigurator::configure($this->wrappedObject, $this->attributes, $project); if (isset($this->attributes["id"])) { $id = $this->attributes["id"]; } if (isset($this->characters) && $this->characters != '') { ProjectConfigurator::addText($project, $this->wrappedObject, (string) $this->characters); } if ($id !== null) { $project->addReference($id, $this->wrappedObject); } } /*if ( is_array($this->children) && !empty($this->children) ) { // Configure all child of this object ... foreach ($this->children as $child) { $child->maybeConfigure($project); ProjectConfigurator::storeChild($project, $this->wrappedObject, $child->wrappedObject, strtolower($child->getElementTag())); } }*/ $this->proxyConfigured = true; } } . */ require_once 'phing/BuildLogger.php'; require_once 'phing/listener/DefaultLogger.php'; require_once 'phing/system/util/Timer.php'; /** * Generates a file in the current directory with * an XML description of what happened during a build. * The default filename is "log.xml", but this can be overridden * with the property XmlLogger.file. * * @author Michiel Rook * @version $Id: 534a60eca6b0c4803103b490663a64d85b052e5a $ * @package phing.listener */ class XmlLogger implements BuildLogger { /** XML element name for a build. */ const BUILD_TAG = "build"; /** XML element name for a target. */ const TARGET_TAG = "target"; /** XML element name for a task. */ const TASK_TAG = "task"; /** XML element name for a message. */ const MESSAGE_TAG = "message"; /** XML attribute name for a name. */ const NAME_ATTR = "name"; /** XML attribute name for a time. */ const TIME_ATTR = "time"; /** XML attribute name for a message priority. */ const PRIORITY_ATTR = "priority"; /** XML attribute name for a file location. */ const LOCATION_ATTR = "location"; /** XML attribute name for an error description. */ const ERROR_ATTR = "error"; /** XML element name for a stack trace. */ const STACKTRACE_TAG = "stacktrace"; /** * @var DOMDocument The XML document created by this logger. */ private $doc; /** * @var int Start time for entire build. */ private $buildTimerStart = 0; /** * @var DOMElement Top-level (root) build element */ private $buildElement; /** * @var array DOMElement[] The parent of the element being processed. */ private $elementStack = array(); /** * @var array int[] Array of millisecond times for the various elements being processed. */ private $timesStack = array(); /** * @var int */ private $msgOutputLevel = Project::MSG_DEBUG; /** * @var OutputStream Stream to use for standard output. */ private $out; /** * @var OutputStream Stream to use for error output. */ private $err; /** * @var string Name of filename to create. */ private $outFilename; /** * Constructs a new BuildListener that logs build events to an XML file. */ public function __construct() { $this->doc = new DOMDocument("1.0", "UTF-8"); $this->doc->formatOutput = true; } /** * Fired when the build starts, this builds the top-level element for the * document and remembers the time of the start of the build. * * @param BuildEvent Ignored. */ public function buildStarted(BuildEvent $event) { $this->buildTimerStart = Phing::currentTimeMillis(); $this->buildElement = $this->doc->createElement(XmlLogger::BUILD_TAG); array_push($this->elementStack, $this->buildElement); array_push($this->timesStack, $this->buildTimerStart); } /** * 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 null. * @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); } /** * Fired when a target starts building, remembers the current time and the name of the target. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function targetStarted(BuildEvent $event) { $target = $event->getTarget(); $targetElement = $this->doc->createElement(XmlLogger::TARGET_TAG); $targetElement->setAttribute(XmlLogger::NAME_ATTR, $target->getName()); array_push($this->timesStack, Phing::currentTimeMillis()); array_push($this->elementStack, $targetElement); } /** * Fired when a target finishes building, this adds the time taken * to the appropriate target element in the log. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function targetFinished(BuildEvent $event) { $targetTimerStart = array_pop($this->timesStack); $targetElement = array_pop($this->elementStack); $elapsedTime = Phing::currentTimeMillis() - $targetTimerStart; $targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); $parentElement = $this->elementStack[count($this->elementStack) - 1]; $parentElement->appendChild($targetElement); } /** * Fired when a task starts building, remembers the current time and the name of the task. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function taskStarted(BuildEvent $event) { $task = $event->getTask(); $taskElement = $this->doc->createElement(XmlLogger::TASK_TAG); $taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName()); $taskElement->setAttribute(XmlLogger::LOCATION_ATTR, $task->getLocation()->toString()); array_push($this->timesStack, Phing::currentTimeMillis()); array_push($this->elementStack, $taskElement); } /** * Fired when a task finishes building, this adds the time taken * to the appropriate task element in the log. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function taskFinished(BuildEvent $event) { $taskTimerStart = array_pop($this->timesStack); $taskElement = array_pop($this->elementStack); $elapsedTime = Phing::currentTimeMillis() - $taskTimerStart; $taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); $parentElement = $this->elementStack[count($this->elementStack) - 1]; $parentElement->appendChild($taskElement); } /** * Fired when a message is logged, this adds a message element to the * most appropriate parent element (task, target or build) and records * the priority and text of the message. * * @param BuildEvent An event with any relevant extra information. * Will not be null. */ public function messageLogged(BuildEvent $event) { $priority = $event->getPriority(); if ($priority > $this->msgOutputLevel) { return; } $messageElement = $this->doc->createElement(XmlLogger::MESSAGE_TAG); switch ($priority) { case Project::MSG_ERR: $name = "error"; break; case Project::MSG_WARN: $name = "warn"; break; case Project::MSG_INFO: $name = "info"; break; default: $name = "debug"; break; } $messageElement->setAttribute(XmlLogger::PRIORITY_ATTR, $name); if (function_exists('mb_convert_encoding')) { $messageConverted = mb_convert_encoding($event->getMessage(), 'UTF-8'); } else { $messageConverted = utf8_encode($event->getMessage()); } $messageText = $this->doc->createCDATASection($messageConverted); $messageElement->appendChild($messageText); if (!empty($this->elementStack)) { $this->elementStack[count($this->elementStack) - 1]->appendChild($messageElement); } } /** * Set the msgOutputLevel this logger is to respond to. * * Only messages with a message level lower than or equal to the given * level are output to the log. * *

Constants for the message levels are in Project.php. The order of * the levels, from least to most verbose, is: * *

    *
  • Project::MSG_ERR
  • *
  • Project::MSG_WARN
  • *
  • Project::MSG_INFO
  • *
  • Project::MSG_VERBOSE
  • *
  • Project::MSG_DEBUG
  • *
* * The default message level for DefaultLogger is Project::MSG_ERR. * * @param int $level The logging level for the logger. * @see BuildLogger#setMessageOutputLevel() */ public function setMessageOutputLevel($level) { $this->msgOutputLevel = (int) $level; } /** * Sets the output stream. * @param OutputStream $output * @see BuildLogger#setOutputStream() */ public function setOutputStream(OutputStream $output) { $this->out = $output; } /** * Sets the error stream. * @param OutputStream $err * @see BuildLogger#setErrorStream() */ public function setErrorStream(OutputStream $err) { $this->err = $err; } /** * Sets this logger to produce emacs (and other editor) friendly output. * * @param bool $emacsMode true if output is to be unadorned so that emacs and other editors * can parse files names, etc. */ public function setEmacsMode($emacsMode) { } /** * @return DOMDocument */ public function getDoc() { return $this->doc; } /** * @return int */ public function getBuildTimerStart() { return $this->buildTimerStart; } /** * @return DOMElement */ public function getBuildElement() { return $this->buildElement; } public function setBuildElement($elem) { $this->buildElement = $elem; } /** * @return array */ public function getElementStack() { return $this->elementStack; } /** * @return array */ public function getTimesStack() { return $this->timesStack; } /** * @return int */ public function getMsgOutputLevel() { return $this->msgOutputLevel; } /** * @return OutputStream */ public function getOut() { return $this->out; } /** * @return OutputStream */ public function getErr() { return $this->err; } /** * @return string */ public function getOutFilename() { return $this->outFilename; } } . */ require_once 'phing/listener/DefaultLogger.php'; /** * Extends DefaultLogger to strip out empty targets. * * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: fde85729a4da71d69341a94fb05cbaa1f7c40d5b $ * @package phing.listener */ class NoBannerLogger extends DefaultLogger { private $targetName = null; /** * @param BuildEvent $event */ public function targetStarted(BuildEvent $event) { $target = $event->getTarget(); $this->targetName = $target->getName(); } /** * @param BuildEvent $event */ public function targetFinished(BuildEvent $event) { $this->targetName = null; } /** * @param BuildEvent $event */ public 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); } } . */ include_once 'phing/listener/DefaultLogger.php'; include_once 'phing/BuildEvent.php'; /** * This is a special logger that is designed to profile builds. * * @author Siad Ardroumli * @package phing.listener */ class ProfileLogger extends DefaultLogger { private $profileData = array(); protected static $dateFormat = DATE_RFC2822; /** * Logs a message to say that the target has started. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function targetStarted(BuildEvent $event) { if (@date_default_timezone_get() === 'UTC') { date_default_timezone_set('Europe/Berlin'); } $now = Phing::currentTimeMillis(); $name = "Target " . $event->getTarget()->getName(); $this->logStart($event, $now, $name); $this->profileData[] = $now; } /** * Logs a message to say that the target has finished. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function targetFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = "Target " . $event->getTarget()->getName(); $this->logFinish($event, $start, $name); } /** * Logs a message to say that the task has started. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function taskStarted(BuildEvent $event) { $name = $event->getTask()->getTaskName(); $now = Phing::currentTimeMillis(); $this->logStart($event, $now, $name); $this->profileData[] = $now; } /** * Logs a message to say that the task has finished. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function taskFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = $event->getTask()->getTaskName(); $this->logFinish($event, $start, $name); } private function logFinish(BuildEvent $event, $start, $name) { $msg = null; if ($start != null) { $diff = self::formatTime(Phing::currentTimeMillis() - $start); $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (" . $diff . ")"; } else { $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (unknown duration, start not detected)"; } $this->printMessage($msg, $this->out, $event->getPriority()); } private function logStart(BuildEvent $event, $start, $name) { $msg = Phing::getProperty("line.separator") . $name . ": started " . date(self::$dateFormat, $start); $this->printMessage($msg, $this->out, $event->getPriority()); } } . */ include_once 'phing/listener/DefaultLogger.php'; /** * A logger which logs nothing but build failure and what task might output. * * @author Siad Ardroumli * @package phing.listener */ class SilentLogger extends DefaultLogger { public function buildStarted(BuildEvent $event) { // log nothing } public function buildFinished(BuildEvent $event) { if ($event->getException() != null) { parent::buildFinished($event); } } public function targetStarted(BuildEvent $event) { // log nothing } public function targetFinished(BuildEvent $event) { // log nothing } public function taskStarted(BuildEvent $event) { // log nothing } public function taskFinished(BuildEvent $event) { // log nothing } } . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; /** * Uses ANSI Color Code Sequences to colorize messages * sent to the console. * * If used with the -logfile option, the output file * will contain all the necessary escape codes to * display the text in colorized mode when displayed * in the console using applications like cat, more, * etc. * * This is designed to work on terminals that support ANSI * color codes. It works on XTerm, ETerm, Mindterm, etc. * It also works on Win9x (with ANSI.SYS loaded.) * * NOTE: * It doesn't work on WinNT's COMMAND.COM even with * ANSI.SYS loaded. * * The default colors used for differentiating * the message levels can be changed by editing the * phing/listener/defaults.properties file. * * This file contains 5 key/value pairs: * AnsiColorLogger.ERROR_COLOR=2;31 * AnsiColorLogger.WARNING_COLOR=2;35 * AnsiColorLogger.INFO_COLOR=2;36 * AnsiColorLogger.VERBOSE_COLOR=2;32 * AnsiColorLogger.DEBUG_COLOR=2;34 * * Another option is to pass a system variable named * ant.logger.defaults, with value set to the path of * the file that contains user defined Ansi Color * Codes, to the java command using -D option. * * To change these colors use the following chart: * * ANSI COLOR LOGGER CONFIGURATION * * Format for AnsiColorLogger.*= * Attribute;Foreground;Background * * Attribute is one of the following: * 0 -> Reset All Attributes (return to normal mode) * 1 -> Bright (Usually turns on BOLD) * 2 -> Dim * 3 -> Underline * 5 -> link * 7 -> Reverse * 8 -> Hidden * * Foreground is one of the following: * 30 -> Black * 31 -> Red * 32 -> Green * 33 -> Yellow * 34 -> Blue * 35 -> Magenta * 36 -> Cyan * 37 -> White * * Background is one of the following: * 40 -> Black * 41 -> Red * 42 -> Green * 43 -> Yellow * 44 -> Blue * 45 -> Magenta * 46 -> Cyan * 47 -> White * * @author Hans Lellelid (Phing) * @author Magesh Umasankar (Ant) * @package phing.listener * @version $Id: eccc8da05ad1fbe73d38da7fca7ecb4816beabd0 $ */ class AnsiColorLogger extends DefaultLogger { const ATTR_NORMAL = 0; const ATTR_BRIGHT = 1; const ATTR_DIM = 2; const ATTR_UNDERLINE = 3; const ATTR_BLINK = 5; const ATTR_REVERSE = 7; const ATTR_HIDDEN = 8; const FG_BLACK = 30; const FG_RED = 31; const FG_GREEN = 32; const FG_YELLOW = 33; const FG_BLUE = 34; const FG_MAGENTA = 35; const FG_CYAN = 36; const FG_WHITE = 37; const BG_BLACK = 40; const BG_RED = 41; const BG_GREEN = 42; const BG_YELLOW = 44; const BG_BLUE = 44; const BG_MAGENTA = 45; const BG_CYAN = 46; const BG_WHITE = 47; const PREFIX = "\x1b["; const SUFFIX = "m"; const SEPARATOR = ';'; const END_COLOR = "\x1b[0m"; // self::PREFIX . self::SUFFIX; private $errColor; private $warnColor; private $infoColor; private $verboseColor; private $debugColor; private $colorsSet = false; /** * Construct new AnsiColorLogger * Perform initializations that cannot be done in var declarations. */ public function __construct() { parent::__construct(); $this->errColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_RED . self::SUFFIX; $this->warnColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_MAGENTA . self::SUFFIX; $this->infoColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_CYAN . self::SUFFIX; $this->verboseColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_GREEN . self::SUFFIX; $this->debugColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_BLUE . self::SUFFIX; } /** * Set the colors to use from a property file specified by the * special ant property ant.logger.defaults */ final private function setColors() { $userColorFile = Phing::getProperty("phing.logger.defaults"); $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties")); $in = null; try { $prop = new Properties(); if ($userColorFile !== null) { $prop->load($userColorFile); } else { $prop->load($systemColorFile); } $err = $prop->getProperty("AnsiColorLogger.ERROR_COLOR"); $warn = $prop->getProperty("AnsiColorLogger.WARNING_COLOR"); $info = $prop->getProperty("AnsiColorLogger.INFO_COLOR"); $verbose = $prop->getProperty("AnsiColorLogger.VERBOSE_COLOR"); $debug = $prop->getProperty("AnsiColorLogger.DEBUG_COLOR"); if ($err !== null) { $this->errColor = self::PREFIX . $err . self::SUFFIX; } if ($warn !== null) { $this->warnColor = self::PREFIX . $warn . self::SUFFIX; } if ($info !== null) { $this->infoColor = self::PREFIX . $info . self::SUFFIX; } if ($verbose !== null) { $this->verboseColor = self::PREFIX . $verbose . self::SUFFIX; } if ($debug !== null) { $this->debugColor = self::PREFIX . $debug . self::SUFFIX; } } catch (IOException $ioe) { //Ignore exception - we will use the defaults. } } /** * @see DefaultLogger#printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { if (!$this->colorsSet) { $this->setColors(); $this->colorsSet = true; } switch ($priority) { case Project::MSG_ERR: $message = $this->errColor . $message . self::END_COLOR; break; case Project::MSG_WARN: $message = $this->warnColor . $message . self::END_COLOR; break; case Project::MSG_INFO: $message = $this->infoColor . $message . self::END_COLOR; break; case Project::MSG_VERBOSE: $message = $this->verboseColor . $message . self::END_COLOR; break; case Project::MSG_DEBUG: $message = $this->debugColor . $message . self::END_COLOR; break; } $stream->write($message . PHP_EOL); } } } . */ require_once 'phing/listener/XmlLogger.php'; /** * Generates a file in the current directory with * an JSON description of what happened during a build. * The default filename is "log.json", but this can be overridden * with the property JsonLogger.file. * * @author Siad Ardroumli * @package phing.listener */ class JsonLogger extends XmlLogger { /** * 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 null. * @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()); } private function xml2js(SimpleXMLElement $xmlnode, $isRoot = true) { $jsnode = array(); if (!$isRoot) { if (count($xmlnode->attributes()) > 0){ $jsnode["@attribute"] = array(); foreach($xmlnode->attributes() as $key => $value) $jsnode["@attribute"][$key] = (string)$value; } $textcontent = trim((string) $xmlnode); if (count($textcontent) > 0) $jsnode['_'] = $textcontent; foreach ($xmlnode->children() as $childxmlnode) { $childname = $childxmlnode->getName(); if (!array_key_exists($childname, $jsnode)) $jsnode[$childname] = array(); array_push($jsnode[$childname], $this->xml2js($childxmlnode, false)); } return $jsnode; } else { $nodename = $xmlnode->getName(); $jsnode[$nodename] = array(); array_push($jsnode[$nodename], $this->xml2js($xmlnode, false)); return json_encode($jsnode, JSON_PRETTY_PRINT); } } } . */ include_once 'phing/listener/DefaultLogger.php'; /** * Like a normal logger, except with timed outputs. * * @author Siad Ardroumli * @package phing.listener */ class TimestampedLogger extends DefaultLogger { /** * what appears between the old message and the new */ public static $SPACER = ' - at '; /** * This is an override point: the message that indicates whether a build failed. * Subclasses can change/enhance the message. * * @return string The classic "BUILD FAILED" plus a timestamp */ protected function getBuildFailedMessage() { return parent::getBuildFailedMessage() . self::$SPACER . date('n/d/Y h:m a'); } /** * This is an override point: the message that indicates that a build succeeded. * Subclasses can change/enhance the message. * * @return string The classic "BUILD SUCCESSFUL" plus a timestamp */ protected function getBuildSuccessfulMessage() { return parent::getBuildSuccessfulMessage() . self::$SPACER . date('n/d/Y h:m a'); } } . */ require_once 'phing/BuildListener.php'; /** * Writes build messages to PEAR Log. * * By default it will log to file in current directory w/ name 'phing.log'. You can customize * this behavior by setting properties: * - pear.log.type * - pear.log.name * - pear.log.ident (note that this class changes ident to project name) * - pear.log.conf (note that array values are currently unsupported in Phing property files) * * * phing -f build.xml -logger phing.listener.PearLogger -Dpear.log.type=file -Dpear.log.name=/path/to/log.log * * * @author Hans Lellelid * @version $Id: 63dcb060d3671bbf7d28433c4871c89c0119c5c1 $ * @see BuildEvent * @package phing.listener */ class PearLogListener implements BuildListener { /** * Size of the left column in output. The default char width is 12. * @var int */ const LEFT_COLUMN_SIZE = 12; /** * Time that the build started * @var int */ protected $startTime; /** * Maps Phing Project::MSG_* constants to PEAR_LOG_* constants. * @var array */ protected static $levelMap = array( Project::MSG_DEBUG => PEAR_LOG_DEBUG, Project::MSG_INFO => PEAR_LOG_INFO, Project::MSG_VERBOSE => PEAR_LOG_NOTICE, Project::MSG_WARN => PEAR_LOG_WARNING, Project::MSG_ERR => PEAR_LOG_ERR ); /** * Whether logging has been configured. * @var boolean */ protected $logConfigured = false; /** * @var Log PEAR Log object. */ protected $logger; /** * Configure the logger. */ protected function configureLogging() { $type = Phing::getDefinedProperty('pear.log.type'); $name = Phing::getDefinedProperty('pear.log.name'); $ident = Phing::getDefinedProperty('pear.log.ident'); $conf = Phing::getDefinedProperty('pear.log.conf'); if ($type === null) { $type = 'file'; } if ($name === null) { $name = 'phing.log'; } if ($ident === null) { $ident = 'phing'; } if ($conf === null) { $conf = array(); } include_once 'Log.php'; if (!class_exists('Log')) { throw new BuildException("Cannot find PEAR Log class for use by PearLogger."); } $this->logger = Log::singleton($type, $name, $ident, $conf, self::$levelMap[$this->msgOutputLevel]); } /** * Get the configured PEAR logger to use. * This method just ensures that logging has been configured and returns the configured logger. * @return Log */ protected function logger() { if (!$this->logConfigured) { $this->configureLogging(); } return $this->logger; } /** * 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")); } /** * Logs whether the build succeeded or failed, and any errors that * occurred during the build. Also outputs the total build-time. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function buildFinished(BuildEvent $event) { $error = $event->getException(); if ($error === null) { $msg = "Finished successful build."; } else { $msg = "Build failed. [reason: " . $error->getMessage() . "]"; } $this->logger()->log( $msg . " Total time: " . DefaultLogger::formatTime(Phing::currentTimeMillis() - $this->startTime) ); } /** * Logs the current target name * * @param BuildEvent The BuildEvent * @see BuildEvent::getTarget() */ public function targetStarted(BuildEvent $event) { } /** * Fired when a target has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function targetFinished(BuildEvent $event) { } /** * Fired when a task is started. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getTask() */ public function taskStarted(BuildEvent $event) { } /** * Fired when a task has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function taskFinished(BuildEvent $event) { } /** * Logs a message to the configured PEAR logger. * * @param BuildEvent The BuildEvent * @see BuildEvent::getMessage() */ public function messageLogged(BuildEvent $event) { if ($event->getPriority() <= $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(); $this->logger()->log($msg, self::$levelMap[$event->getPriority()]); } } } . */ require_once 'phing/listener/AnsiColorLogger.php'; /** * Extends AnsiColorLogger to display times for each target * * @author Patrick McAndrew * @copyright 2013. All rights reserved * @version $Id: e5ae611d970cd766f7f23fe5a70c6483e66aceb5 $ * @package phing.listener */ class TargetLogger extends AnsiColorLogger { private $targetName = null; private $targetStartTime; /** * @param BuildEvent $event */ public function targetStarted(BuildEvent $event) { parent::targetStarted($event); $target = $event->getTarget(); $this->targetName = $target->getName(); $this->targetStartTime = Phing::currentTimeMillis(); } /** * @param BuildEvent $event */ public 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; } } #################################################### # # ANSI COLOR LOGGER CONFIGURATION # # Format for AnsiColorLogger.*= # Attribute;Foreground;Background # # Attribute is one of the following: # 0 -> Reset All Attributes (return to normal mode) # 1 -> Bright (Usually turns on BOLD) # 2 -> Dim # 3 -> Underline # 5 -> link # 7 -> Reverse # 8 -> Hidden # # Foreground is one of the following: # 30 -> Black # 31 -> Red # 32 -> Green # 33 -> Yellow # 34 -> Blue # 35 -> Magenta # 36 -> Cyan # 37 -> White # # Background is one of the following: # 40 -> Black # 41 -> Red # 42 -> Green # 43 -> Yellow # 44 -> Blue # 45 -> Magenta # 46 -> Cyan # 47 -> White # #################################################### AnsiColorLogger.ERROR_COLOR=01;31 AnsiColorLogger.WARNING_COLOR=01;35 AnsiColorLogger.INFO_COLOR=00;36 AnsiColorLogger.VERBOSE_COLOR=00;32 AnsiColorLogger.DEBUG_COLOR=01;34 . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; include_once 'phing/util/StringHelper.php'; /** * Uses PEAR Mail package to send the build log to one or * more recipients. * * @author Michiel Rook * @package phing.listener * @version $Id: 63733db47089bd288aa4d5aacaa47de012b20eb4 $ */ class MailLogger extends DefaultLogger { private $mailMessage = ''; private $from = 'phing@phing.info'; private $tolist; /** * Construct new MailLogger */ public function __construct() { parent::__construct(); @require_once 'Mail.php'; if (!class_exists('Mail')) { throw new BuildException('Need the PEAR Mail package to send logs'); } $tolist = Phing::getDefinedProperty('phing.log.mail.recipients'); if (!empty($tolist)) { $this->tolist = $tolist; } } /** * @see DefaultLogger::printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { $this->mailMessage .= $message . "\n"; } } /** * Sends the mail * * @see DefaultLogger#buildFinished * @param BuildEvent $event */ public function buildFinished(BuildEvent $event) { parent::buildFinished($event); $project = $event->getProject(); $properties = $project->getProperties(); $filename = $properties['phing.log.mail.properties.file']; // overlay specified properties file (if any), which overrides project // settings $fileProperties = new Properties(); $file = new PhingFile($filename); try { $fileProperties->load($file); } catch (IOException $ioe) { // ignore because properties file is not required } foreach ($fileProperties as $key => $value) { $properties['key'] = $project->replaceProperties($value); } $success = $event->getException() === null; $prefix = $success ? 'success' : 'failure'; try { $notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on')); if (!$notify) { return; } if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) { $defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject'); } else { $defaultSubject = ($success) ? 'Build Success' : 'Build Failure'; } $hdrs = array(); $hdrs['From'] = $this->getValue($properties, 'from', $this->from); $hdrs['Reply-To'] = $this->getValue($properties, 'replyto', ''); $hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', ''); $hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', ''); $hdrs['Body'] = $this->getValue($properties, $prefix . '.body', ''); $hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject); $tolist = $this->getValue($properties, $prefix . '.to', $this->tolist); } catch (BadMethodCallException $e) { $project->log($e->getMessage(), Project::MSG_WARN); } if (empty($tolist)) { return; } $mail = Mail::factory('mail'); $mail->send($tolist, $hdrs, $this->mailMessage); } /** * @param array $properties * @param string $name * @param mixed $defaultValue * * @return mixed * * @throws BadMethodCallException */ private function getValue(array $properties, $name, $defaultValue) { $propertyName = 'phing.log.mail.' . $name; $value = $properties[$propertyName]; if ($value === null) { $value = $defaultValue; } if ($value === null) { throw new BadMethodCallException('Missing required parameter: ' . $propertyName); } return $value; } } . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; /** * Uses CSS class that must be defined in the HTML page * where the Phing output is displayed. * * If used with the -logfile option, the output * will contain the text wrapped in html elements * with those css classes. * * The default classes used for differentiating * the message levels can be changed by editing the * phing/listener/defaults.properties file. * * This file can contain 5 key/value pairs: * HtmlColorLogger.ERROR_CLASS=_your_css_class_name_ * HtmlColorLogger.WARNING_CLASS=_your_css_class_name_ * HtmlColorLogger.INFO_CLASS=_your_css_class_name_ * HtmlColorLogger.VERBOSE_CLASS=_your_css_class_name_ * HtmlColorLogger.DEBUG_CLASS=_your_css_class_name_ * * This stems from the Ansi Color Logger done by Hans Lellelid: * * @author Anton Stöckl (Phing HTML Color Logger) * @author Hans Lellelid (Phing Ansi Color Logger) * @author Magesh Umasankar (Ant) * @package phing.listener * @version $Id: 5288eb0042a1c3bf2b1d34ed509a6c46adce87fd $ */ class HtmlColorLogger extends DefaultLogger { const CLASS_ERR = 'phing_err'; const CLASS_VERBOSE = 'phing_verbose'; const CLASS_DEBUG = 'phing_debug'; const CLASS_WARN = 'phing_warn'; const CLASS_INFO = 'phing_info'; const PREFIX = ''; const END_COLOR = ''; private $errColor; private $warnColor; private $infoColor; private $verboseColor; private $debugColor; private $colorsSet = false; /** * Construct new HtmlColorLogger * Perform initializations that cannot be done in var declarations. */ public function __construct() { parent::__construct(); $this->errColor = self::PREFIX . self::CLASS_ERR . self::SUFFIX; $this->warnColor = self::PREFIX . self::CLASS_WARN . self::SUFFIX; $this->infoColor = self::PREFIX . self::CLASS_INFO . self::SUFFIX; $this->verboseColor = self::PREFIX . self::CLASS_VERBOSE . self::SUFFIX; $this->debugColor = self::PREFIX . self::CLASS_DEBUG . self::SUFFIX; } /** * Set the colors to use from a property file specified in the * special phing property file "phing/listener/defaults.properties". */ final private function setColors() { $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties")); try { $prop = new Properties(); $prop->load($systemColorFile); $err = $prop->getProperty("HtmlColorLogger.ERROR_CLASS"); $warn = $prop->getProperty("HtmlColorLogger.WARNING_CLASS"); $info = $prop->getProperty("HtmlColorLogger.INFO_CLASS"); $verbose = $prop->getProperty("HtmlColorLogger.VERBOSE_CLASS"); $debug = $prop->getProperty("HtmlColorLogger.DEBUG_CLASS"); if ($err !== null) { $this->errColor = self::PREFIX . $err . self::SUFFIX; } if ($warn !== null) { $this->warnColor = self::PREFIX . $warn . self::SUFFIX; } if ($info !== null) { $this->infoColor = self::PREFIX . $info . self::SUFFIX; } if ($verbose !== null) { $this->verboseColor = self::PREFIX . $verbose . self::SUFFIX; } if ($debug !== null) { $this->debugColor = self::PREFIX . $debug . self::SUFFIX; } } catch (IOException $ioe) { //Ignore exception - we will use the defaults. } } /** * @see DefaultLogger#printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { if (!$this->colorsSet) { $this->setColors(); $this->colorsSet = true; } $search = array('<', '>'); $replace = array('<', '>'); $message = str_replace($search, $replace, $message); $search = array("\t", "\n", "\r"); $replace = array('   ', '
', ''); $message = str_replace($search, $replace, $message); if (preg_match('@^( +)([^ ].+)@', $message, $matches)) { $len = strlen($matches[1]); $space = ' '; for ($i = 1; $i < $len; $i++) { $space .= ' '; } $message = $space . $matches[2]; } switch ($priority) { case Project::MSG_ERR: $message = $this->errColor . $message . self::END_COLOR; break; case Project::MSG_WARN: $message = $this->warnColor . $message . self::END_COLOR; break; case Project::MSG_INFO: $message = $this->infoColor . $message . self::END_COLOR; break; case Project::MSG_VERBOSE: $message = $this->verboseColor . $message . self::END_COLOR; break; case Project::MSG_DEBUG: $message = $this->debugColor . $message . self::END_COLOR; break; } $stream->write($message . '
'); } } } . */ require_once 'phing/listener/StreamRequiredBuildLogger.php'; include_once 'phing/BuildEvent.php'; /** * Writes a build event to the console. * * Currently, it only writes which targets are being executed, and * any messages that get logged. * * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: e553741b911b85b7c9754254076dc019dcf41261 $ * @see BuildEvent * @package phing.listener */ class DefaultLogger implements StreamRequiredBuildLogger { /** * Size of the left column in output. The default char width is 12. * @var int */ const LEFT_COLUMN_SIZE = 12; /** * The message output level that should be used. The default is * Project::MSG_VERBOSE. * @var int */ protected $msgOutputLevel = Project::MSG_ERR; /** * Time that the build started * @var int */ protected $startTime; /** * @var OutputStream Stream to use for standard output. */ protected $out; /** * @var OutputStream Stream to use for error output. */ protected $err; protected $emacsMode = false; /** * Construct a new default logger. */ public function __construct() { } /** * Set the msgOutputLevel this logger is to respond to. * * Only messages with a message level lower than or equal to the given * level are output to the log. * *

Constants for the message levels are in Project.php. The order of * the levels, from least to most verbose, is: * *

    *
  • Project::MSG_ERR
  • *
  • Project::MSG_WARN
  • *
  • Project::MSG_INFO
  • *
  • Project::MSG_VERBOSE
  • *
  • Project::MSG_DEBUG
  • *
* * The default message level for DefaultLogger is Project::MSG_ERR. * * @param int $level The logging level for the logger. * @see BuildLogger#setMessageOutputLevel() */ public function setMessageOutputLevel($level) { $this->msgOutputLevel = (int) $level; } /** * Sets the output stream. * @param OutputStream $output * @see BuildLogger#setOutputStream() */ public function setOutputStream(OutputStream $output) { $this->out = $output; } /** * Sets the error stream. * @param OutputStream $err * @see BuildLogger#setErrorStream() */ public function setErrorStream(OutputStream $err) { $this->err = $err; } /** * Sets this logger to produce emacs (and other editor) friendly output. * * @param bool $emacsMode true if output is to be unadorned so that * emacs and other editors can parse files names, etc. */ public function setEmacsMode($emacsMode) { $this->emacsMode = $emacsMode; } /** * Sets the start-time when the build started. Used for calculating * the build-time. * * @param BuildEvent $event * @internal param The $object BuildEvent */ public function buildStarted(BuildEvent $event) { $this->startTime = Phing::currentTimeMillis(); if ($this->msgOutputLevel >= Project::MSG_INFO) { $this->printMessage( "Buildfile: " . $event->getProject()->getProperty("phing.file"), $this->out, Project::MSG_INFO ); } } /** * Prints whether the build succeeded or failed, and any errors that * occurred during the build. Also outputs the total build-time. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getException() */ public function buildFinished(BuildEvent $event) { $error = $event->getException(); if ($error === null) { $msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL; } else { $msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL; self::throwableMessage($msg, $error, Project::MSG_VERBOSE <= $this->msgOutputLevel); } $msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL; if ($error === null) { $this->printMessage($msg, $this->out, Project::MSG_VERBOSE); } else { $this->printMessage($msg, $this->err, Project::MSG_ERR); } } public static function throwableMessage(&$msg, $error, $verbose) { while ($error instanceof BuildException) { $cause = $error->getCause(); if ($cause === null) { break; } $msg1 = (string) $error; $msg2 = (string) $cause; if (StringHelper::endsWith($msg2, $msg1)) { $msg .= StringHelper::substring($msg1, 0, strlen($msg1) - strlen($msg2)); $error = $cause; } else { break; } } if ($verbose || !($error instanceof BuildException)) { $msg .= (string) $error; } else { $msg .= $error->getMessage() . PHP_EOL; } } /** * Get the message to return when a build failed. * @return string The classic "BUILD FAILED" */ protected function getBuildFailedMessage() { return "BUILD FAILED"; } /** * Get the message to return when a build succeeded. * @return string The classic "BUILD FINISHED" */ protected function getBuildSuccessfulMessage() { return "BUILD FINISHED"; } /** * Prints the current target name * * @param BuildEvent $event * @internal param The $object BuildEvent * @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()); } } /** * Fired when a target has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getException() */ public function targetFinished(BuildEvent $event) { } /** * Fired when a task is started. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getTask() */ public function taskStarted(BuildEvent $event) { } /** * Fired when a task has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event The BuildEvent * @see BuildEvent::getException() */ public function taskFinished(BuildEvent $event) { } /** * Print a message to the stdout. * * @param BuildEvent $event * @see BuildEvent::getMessage() */ public function messageLogged(BuildEvent $event) { $priority = $event->getPriority(); if ($priority <= $this->msgOutputLevel) { $msg = ""; if ($event->getTask() !== null && !$this->emacsMode) { $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); } } } /** * Formats a time micro integer to human readable format. * * @param integer The time stamp * @return string */ public static function formatTime($micros) { $seconds = $micros; $minutes = $seconds / 60; if ($minutes > 1) { return sprintf( "%1.0f minute%s %0.2f second%s", $minutes, ($minutes === 1 ? " " : "s "), $seconds - floor($seconds / 60) * 60, ($seconds % 60 === 1 ? "" : "s") ); } else { return sprintf("%0.4f second%s", $seconds, ($seconds % 60 === 1 ? "" : "s")); } } /** * Prints a message to console. * * @param string $message The message to print. * Should not be null. * @param OutputStream|resource $stream The stream to use for message printing. * @param int $priority The priority of the message. * (Ignored in this implementation.) * @throws IOException * @return void */ protected function printMessage($message, OutputStream $stream, $priority) { $stream->write($message . PHP_EOL); } } . */ require_once 'phing/BuildLogger.php'; /** * Interface for build loggers that require that out/err streams be set in order to function. * * This is just an empty sub-interface to BuildLogger, but is used by Phing to throw * graceful errors when classes like phing.listener.DefaultLogger are being used as * -listener. * * @author Hans Lellelid * @version $Id: e02403f7640929e2b0650bcaf270709fe6281b3c $ * @see BuildEvent * @see Project::addBuildListener() * @package phing */ interface StreamRequiredBuildLogger extends BuildLogger { } . */ require_once 'phing/tasks/system/condition/ConditionBase.php'; /** * task as a generalization of * *

This task supports boolean logic as well as pluggable conditions * to decide, whether a property should be set.

* *

This task does not extend Task to take advantage of * ConditionBase.

* * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: 4778e42a996baf0141a3c1b2de65f5e8fec17fef $ * @package phing.tasks.system */ class ConditionTask extends ConditionBase { /** @var string $property */ private $property; /** @var string $value */ private $value = "true"; /** * The name of the property to set. Required. * @param string $p * @return void */ public function setProperty($p) { $this->property = $p; } /** * The value for the property to set. Defaults to "true". * @param string $v * @return void */ public function setValue($v) { $this->value = $v; } /** * See whether our nested condition holds and set the property. * @throws BuildException * @return void */ public function main() { if ($this->countConditions() > 1) { throw new BuildException("You must not nest more than one condition into "); } if ($this->countConditions() < 1) { throw new BuildException("You must nest a condition into "); } $cs = $this->getIterator(); if ($cs->current()->evaluate()) { $this->project->setProperty($this->property, $this->value); } } } . */ require_once 'phing/Task.php'; require_once 'phing/Diagnostics.php'; require_once 'phing/system/io/PrintStream.php'; require_once 'phing/Phing.php'; /** * This is a task that hands off work to the Diagnostics module. * It lets you run diagnostics in an IDE. * * @author Siad Ardroumli * @package phing.tasks.system */ class DiagnosticsTask extends Task { /** * Execute the task. * This delegates to the Diagnostics class. * @throws BuildException on error. */ public function main() { Diagnostics::doReport(new PrintStream(Phing::getOutputStream())); } } . */ require_once 'phing/Task.php'; require_once 'phing/system/io/FileSystem.php'; include_once 'phing/mappers/FileNameMapper.php'; include_once 'phing/tasks/system/PhingTask.php'; /** * task * * Task definition for the foreach task. This task takes a list with * delimited values, and executes a target with set param. * * Usage: * * * Attributes: * list --> The list of values to process, with the delimiter character, * indicated by the "delimiter" attribute, separating each value. * target --> The target to call for each token, passing the token as the * parameter with the name indicated by the "param" attribute. * param --> The name of the parameter to pass the tokens in as to the * target. * delimiter --> The delimiter string that separates the values in the "list" * parameter. The default is ",". * * @author Jason Hines * @author Hans Lellelid * @version $Id: 46bd390ab29b8784b4a07b2a91afcba295b7d334 $ * @package phing.tasks.system */ class ForeachTask extends Task { /** Delimter-separated list of values to process. */ private $list; /** Name of parameter to pass to callee */ private $param; /** Name of absolute path parameter to pass to callee */ private $absparam; /** Delimiter that separates items in $list */ private $delimiter = ','; /** * PhingCallTask that will be invoked w/ calleeTarget. * @var PhingCallTask */ private $callee; /** Array of filesets */ private $filesets = array(); /** Instance of mapper **/ private $mapperElement; /** * Array of filelists * @var array */ private $filelists = array(); /** * Target to execute. * @var string */ private $calleeTarget; /** * Total number of files processed * @var integer */ private $total_files = 0; /** * Total number of directories processed * @var integer */ private $total_dirs = 0; public function init() { $this->callee = $this->project->createTask("phingcall"); $this->callee->setOwningTarget($this->getOwningTarget()); $this->callee->setTaskName($this->getTaskName()); $this->callee->setLocation($this->getLocation()); $this->callee->init(); } /** * This method does the work. * @throws BuildException * @return void */ public function main() { if ($this->list === null && count($this->filesets) == 0 && count($this->filelists) == 0) { throw new BuildException("Need either list, nested fileset or nested filelist to iterate through"); } if ($this->param === null) { throw new BuildException("You must supply a property name to set on each iteration in param"); } if ($this->calleeTarget === null) { throw new BuildException("You must supply a target to perform"); } $callee = $this->callee; $callee->setTarget($this->calleeTarget); $callee->setInheritAll(true); $callee->setInheritRefs(true); $mapper = null; if ($this->mapperElement !== null) { $mapper = $this->mapperElement->getImplementation(); } if (trim($this->list)) { $arr = explode($this->delimiter, $this->list); $total_entries = 0; foreach ($arr as $value) { $value = trim($value); $premapped = ''; if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); $callee->main(); $total_entries++; } } // filelists foreach ($this->filelists as $fl) { $srcFiles = $fl->getFiles($this->project); $this->process($callee, $fl->getDir($this->project), $srcFiles, array()); } // filesets foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($this->project); $srcFiles = $ds->getIncludedFiles(); $srcDirs = $ds->getIncludedDirectories(); $this->process($callee, $fs->getDir($this->project), $srcFiles, $srcDirs); } if ($this->list === null) { $this->log( "Processed {$this->total_dirs} directories and {$this->total_files} files", Project::MSG_VERBOSE ); } else { $this->log( "Processed $total_entries entr" . ($total_entries > 1 ? 'ies' : 'y') . " in list", Project::MSG_VERBOSE ); } } /** * Processes a list of files & directories * * @param Task $callee * @param PhingFile $fromDir * @param array $srcFiles * @param array $srcDirs */ protected function process(Task $callee, PhingFile $fromDir, $srcFiles, $srcDirs) { $mapper = null; if ($this->mapperElement !== null) { $mapper = $this->mapperElement->getImplementation(); } $filecount = count($srcFiles); $this->total_files += $filecount; for ($j = 0; $j < $filecount; $j++) { $value = $srcFiles[$j]; $premapped = ""; if ($this->absparam) { $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->absparam); $prop->setValue($fromDir . FileSystem::getFileSystem()->getSeparator() . $value); } if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } if ($this->param) { $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); } $callee->main(); } $dircount = count($srcDirs); $this->total_dirs += $dircount; for ($j = 0; $j < $dircount; $j++) { $value = $srcDirs[$j]; $premapped = ""; if ($this->absparam) { $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->absparam); $prop->setValue($fromDir . FileSystem::getFileSystem()->getSeparator() . $value); } if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } if ($this->param) { $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); } $callee->main(); } } /** * @param $list */ public function setList($list) { $this->list = (string) $list; } /** * @param $target */ public function setTarget($target) { $this->calleeTarget = (string) $target; } /** * @param $param */ public function setParam($param) { $this->param = (string) $param; } /** * @param $absparam */ public function setAbsparam($absparam) { $this->absparam = (string) $absparam; } /** * @param $delimiter */ public function setDelimiter($delimiter) { $this->delimiter = (string) $delimiter; } /** * Nested adder, adds a set of files (nested fileset attribute). * * @param FileSet $fs * @return void */ public function addFileSet(FileSet $fs) { $this->filesets[] = $fs; } /** * Nested creator, creates one Mapper for this task * * @return object The created Mapper type object * @throws BuildException */ public function createMapper() { if ($this->mapperElement !== null) { throw new BuildException("Cannot define more than one mapper", $this->location); } $this->mapperElement = new Mapper($this->project); return $this->mapperElement; } /** * @return Property */ public function createProperty() { return $this->callee->createProperty(); } /** * Supports embedded element. * @return FileList */ public function createFileList() { $num = array_push($this->filelists, new FileList()); return $this->filelists[$num - 1]; } } . */ require_once 'phing/tasks/system/AdhocTask.php'; /** * A class for creating adhoc tasks in build file. * * * bar = $bar; * } * * function main() { * $this->log("In FooTest: " . $this->bar); * } * } * * ]]> * * * * * @author Hans Lellelid * @version $Id: c0cdcd2c07fd4b81ac8f1b7cbc50a4031b3d5ddd $ * @package phing.tasks.system */ class AdhocTaskdefTask extends AdhocTask { /** * The tag that refers to this task. */ private $name; /** * Set the tag that will represent this adhoc task/type. * @param string $name */ public function setName($name) { $this->name = $name; } /** Main entry point */ public function main() { if ($this->name === null) { throw new BuildException("The name attribute is required for adhoc task definition.", $this->location); } $taskdefs = $this->getProject()->getTaskDefinitions(); if (!isset($taskdefs[$this->name])) { $this->execute(); $classes = $this->getNewClasses(); if (count($classes) < 1) { throw new BuildException("You must define at least one class for AdhocTaskdefTask."); } $classname = array_pop($classes); // instantiate it to make sure it is an instance of Task $t = new $classname(); if (!($t instanceof Task)) { throw new BuildException("The adhoc class you defined must be an instance of phing.Task", $this->location); } $this->log("Task " . $this->name . " will be handled by class " . $classname, Project::MSG_VERBOSE); $this->project->addTaskDefinition($this->name, $classname); } } } . */ include_once 'phing/Task.php'; /** * A wrapper task that lets you run tasks(s) when another set * of tasks fails. * * Inspired by {@link http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html} * * @author Michiel Rook * @version $Id: 2059a94a0c48659f29e244115f17cae9e0b4b65b $ * @package phing.tasks.system */ class TryCatchTask extends Task { protected $propertyName = ""; protected $referenceName = ''; protected $tryContainer = null; protected $catchContainer = null; protected $finallyContainer = null; /** * Main method * * @throws BuildException * @return void */ public function main() { $exc = null; if (empty($this->tryContainer)) { throw new BuildException('A nested element is required'); } try { $this->tryContainer->perform(); } catch (BuildException $e) { if (!empty($this->propertyName)) { $this->project->setProperty($this->propertyName, $e->getMessage()); } if (!empty($this->referenceName)) { $this->project->addReference($this->referenceName, $e); } if (!empty($this->catchContainer)) { $this->catchContainer->perform(); } else { $exc = $e; } } if (!empty($this->finallyContainer)) { $this->finallyContainer->perform(); } if (!empty($exc)) { throw $exc; } } /** * Sets the name of the property that will * contain the exception message. * * @param string $property */ public function setProperty($property) { $this->propertyName = (string) $property; } /** * Sets the name of the reference that will * contain the exception. * * @param Exception $reference * * @return void */ public function setReference($reference) { $this->referenceName = $reference; } /** * Add nested element * * @param SequentialTask $container */ public function addTry(SequentialTask $container) { $this->tryContainer = $container; } /** * Add nested element * * @param SequentialTask $container */ public function addCatch(SequentialTask $container) { $this->catchContainer = $container; } /** * Add nested element * * @param SequentialTask $container */ public function addFinally(SequentialTask $container) { $this->finallyContainer = $container; } } . */ require_once 'phing/Task.php'; include_once 'phing/tasks/system/ExecTask.php'; include_once 'phing/types/Commandline.php'; /** * Task for performing CVS operations. * * NOTE: This implementation has been moved here from Cvs.java with * the addition of some accessors for extensibility. Another task * can extend this with some customized output processing. * * @author Hans Lellelid (Phing) * @author costin@dnt.ro (Ant) * @author stefano@apache.org (Ant) * @author Wolfgang Werner (Ant) * @author Kevin Ross (Ant) * @version $Id: c8232b68045eec9d40b1bda18c4b758c6cfbd80f $ * @package phing.tasks.system */ class CvsTask extends Task { /** * Default compression level to use, if compression is enabled via * setCompression( true ). */ const DEFAULT_COMPRESSION_LEVEL = 3; private $cmd; /** * List of Commandline children * @var array Commandline[] */ private $commandlines = array(); /** * the CVSROOT variable. */ private $cvsRoot; /** * the CVS_RSH variable. */ private $cvsRsh; /** * the package/module to check out. */ private $cvsModule; /** * the default command. */ private static $default_command = "checkout"; /** * the CVS command to execute. */ private $command = null; /** * suppress information messages. */ private $quiet = false; /** * compression level to use. */ private $compression = 0; /** * report only, don't change any files. */ private $noexec = false; /** * CVS port */ private $port = 0; /** * CVS password file * @var File */ private $passFile = null; /** * the directory where the checked out files should be placed. * @var File */ private $dest; private $error; private $output; /** * If true it will stop the build if cvs exits with error. * Default is false. (Iulian) * @var boolean */ private $failOnError = false; public function init() { $this->cmd = new Commandline(); } /** * Sets up the environment for toExecute and then runs it. * @param Commandline $toExecute * @throws BuildException */ protected function runCommand(Commandline $toExecute) { // We are putting variables into the script's environment // and not removing them (!) This should be fine, but is // worth remembering and testing. if ($this->port > 0) { putenv("CVS_CLIENT_PORT=" . $this->port); } // Need a better cross platform integration with , so // use the same filename. if ($this->passFile === null) { $defaultPassFile = new PhingFile(Phing::getProperty("cygwin.user.home", Phing::getProperty("user.home")) . DIRECTORY_SEPARATOR . ".cvspass"); if ($defaultPassFile->exists()) { $this->setPassfile($defaultPassFile); } } if ($this->passFile !== null) { if ($this->passFile->isFile() && $this->passFile->canRead()) { putenv("CVS_PASSFILE=" . $this->passFile->__toString()); $this->log("Using cvs passfile: " . $this->passFile->__toString(), Project::MSG_INFO); } elseif (!$this->passFile->canRead()) { $this->log( "cvs passfile: " . $this->passFile->__toString() . " ignored as it is not readable", Project::MSG_WARN ); } else { $this->log( "cvs passfile: " . $this->passFile->__toString() . " ignored as it is not a file", Project::MSG_WARN ); } } if ($this->cvsRsh !== null) { putenv("CVS_RSH=" . $this->cvsRsh); } // Use the ExecTask to handle execution of the command $exe = new ExecTask($this->project); $exe->setProject($this->project); //exe.setAntRun(project); if ($this->dest === null) { $this->dest = $this->project->getBaseDir(); } if (!$this->dest->exists()) { $this->dest->mkdirs(); } if ($this->output !== null) { $exe->setOutput($this->output); } if ($this->error !== null) { $exe->setError($this->error); } $exe->setDir($this->dest); if (is_object($toExecute)) { $toExecuteStr = $toExecute->__toString(); // unfortunately no more automagic for initial 5.0.0 release :( } $exe->setCommand($toExecuteStr); try { $actualCommandLine = $toExecuteStr; // we converted to string above $this->log($actualCommandLine, Project::MSG_INFO); $retCode = $exe->main(); $this->log("retCode=" . $retCode, Project::MSG_DEBUG); /*Throw an exception if cvs exited with error. (Iulian)*/ if ($this->failOnError && $retCode !== 0) { throw new BuildException("cvs exited with error code " . $retCode . PHP_EOL . "Command line was [" . $toExecute->describeCommand() . "]", $this->getLocation()); } } catch (IOException $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } catch (BuildException $e) { if ($this->failOnError) { throw $e; } else { $t = $e->getCause(); if ($t === null) { $t = $e; } $this->log("Caught exception: " . $t, Project::MSG_WARN); } } catch (Exception $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } } /** * * @throws Exception * @return void */ public function main() { $savedCommand = $this->getCommand(); if ($this->getCommand() === null && empty($this->commandlines)) { // re-implement legacy behaviour: $this->setCommand(self::$default_command); } $c = $this->getCommand(); $cloned = null; if ($c !== null) { $cloned = $this->cmd->__copy(); $cloned->createArgument(true)->setLine($c); $this->addConfiguredCommandline($cloned, true); } try { for ($i = 0, $vecsize = count($this->commandlines); $i < $vecsize; $i++) { $this->runCommand($this->commandlines[$i]); } // finally { if ($cloned !== null) { $this->removeCommandline($cloned); } $this->setCommand($savedCommand); } catch (Exception $e) { // finally { if ($cloned !== null) { $this->removeCommandline($cloned); } $this->setCommand($savedCommand); throw $e; } } /** * The CVSROOT variable. * * @param string $root */ public function setCvsRoot($root) { // Check if not real cvsroot => set it to null if ($root !== null) { if (trim($root) == "") { $root = null; } } $this->cvsRoot = $root; } public function getCvsRoot() { return $this->cvsRoot; } /** * The CVS_RSH variable. * * @param rsh */ public function setCvsRsh($rsh) { // Check if not real cvsrsh => set it to null if ($rsh !== null) { if (trim($rsh) == "") { $rsh = null; } } $this->cvsRsh = $rsh; } public function getCvsRsh() { return $this->cvsRsh; } /** * Port used by CVS to communicate with the server. * * @param int $port */ public function setPort($port) { $this->port = $port; } /** * @return int */ public function getPort() { return $this->port; } /** * Password file to read passwords from. * * @param PhingFile $passFile * @internal param $passFile */ public function setPassfile(PhingFile $passFile) { $this->passFile = $passFile; } /** * @return File */ public function getPassFile() { return $this->passFile; } /** * The directory where the checked out files should be placed. * * @param PhingFile $dest */ public function setDest(PhingFile $dest) { $this->dest = $dest; } /** * @return File */ public function getDest() { return $this->dest; } /** * The package/module to operate upon. * * @param $m * @internal param string $p */ public function setModule($m) { $this->cvsModule = $m; } public function getModule() { return $this->cvsModule; } /** * The tag of the package/module to operate upon. * @param string $p */ public function setTag($p) { // Check if not real tag => set it to null if ($p !== null && trim($p) !== "") { $this->appendCommandArgument("-r"); $this->appendCommandArgument($p); } } /** * This needs to be public to allow configuration * of commands externally. * @param $arg */ public function appendCommandArgument($arg) { $this->cmd->createArgument()->setValue($arg); } /** * Use the most recent revision no later than the given date. * @param p */ public function setDate($p) { if ($p !== null && trim($p) !== "") { $this->appendCommandArgument("-D"); $this->appendCommandArgument($p); } } /** * The CVS command to execute. * @param string $c */ public function setCommand($c) { $this->command = $c; } /** * @return null */ public function getCommand() { return $this->command; } /** * If true, suppress informational messages. * @param boolean $q */ public function setQuiet($q) { $this->quiet = $q; } /** * If true, report only and don't change any files. * * @param boolean $ne */ public function setNoexec($ne) { $this->noexec = (boolean) $ne; } /** * Stop the build process if the command exits with * a return code other than 0. * Defaults to false. * @param boolean $failOnError */ public function setFailOnError($failOnError) { $this->failOnError = (boolean) $failOnError; } /** * Configure a commandline element for things like cvsRoot, quiet, etc. * @param $c * @return string */ protected function configureCommandline($c) { if ($c === null) { return; } $c->setExecutable("cvs"); if ($this->cvsModule !== null) { $c->createArgument()->setLine($this->cvsModule); } if ($this->compression > 0 && $this->compression < 10) { $c->createArgument(true)->setValue("-z" . $this->compression); } if ($this->quiet) { $c->createArgument(true)->setValue("-q"); } if ($this->noexec) { $c->createArgument(true)->setValue("-n"); } if ($this->cvsRoot !== null) { $c->createArgument(true)->setLine("-d" . $this->cvsRoot); } } /** * @param Commandline $c * @return bool */ protected function removeCommandline(Commandline $c) { $idx = array_search($c, $this->commandlines, true); if ($idx === false) { return false; } $this->commandlines = array_splice($this->commandlines, $idx, 1); return true; } /** * Configures and adds the given Commandline. * @param Commandline $c * @param bool|If $insertAtStart * @internal param If $insertAtStart true, c is */ public function addConfiguredCommandline(Commandline $c, $insertAtStart = false) { if ($c === null) { return; } $this->configureCommandline($c); if ($insertAtStart) { array_unshift($this->commandlines, $c); } else { array_push($this->commandlines, $c); } } /** * If set to a value 1-9 it adds -zN to the cvs command line, else * it disables compression. * @param int $level */ public function setCompressionLevel($level) { $this->compression = $level; } /** * If true, this is the same as compressionlevel="3". * * @param boolean $usecomp If true, turns on compression using default * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL. */ public function setCompression($usecomp) { $this->setCompressionLevel( $usecomp ? self::DEFAULT_COMPRESSION_LEVEL : 0 ); } /** * File to which output should be written. * @param PhingFile $f * @internal param PhingFile $output */ public function setOutput(PhingFile $f) { $this->output = $f; } /** * File to which error output should be written. * @param PhingFile $f * @internal param PhingFile $output */ public function setError(PhingFile $f) { $this->error = $f; } } . */ require_once 'phing/Task.php'; require_once 'phing/ExitStatusException.php'; require_once 'phing/tasks/system/condition/NestedCondition.php'; /** * Exits the active build, giving an additional message * if available. * * @author Hans Lellelid (Phing) * @author Nico Seessle (Ant) * * @package phing.tasks.system */ class FailTask extends Task { /** * @var string $message */ protected $message; /** * @var string */ protected $ifCondition; /** * @var string */ protected $unlessCondition; /** * @var NestedCondition */ protected $nestedCondition; /** * @var integer */ protected $status; /** * A message giving further information on why the build exited. * * @param string $value message to output * * @return void */ public function setMsg($value) { $this->setMessage($value); } /** * A message giving further information on why the build exited. * * @param string $value message to output * * @return void */ public function setMessage($value) { $this->message = $value; } /** * Only fail if a property of the given name exists in the current project. * * @param string $c property name * * @return void */ public function setIf($c) { $this->ifCondition = $c; } /** * Only fail if a property of the given name does not * exist in the current project. * * @param string $c property name * * @return void */ public function setUnless($c) { $this->unlessCondition = $c; } /** * Set the status code to associate with the thrown Exception. * @param int $int the int status */ public function setStatus($int) { $this->status = (int) $int; } /** * {@inheritdoc} * * @return void * * @throws BuildException */ public function main() { $fail = $this->nestedConditionPresent() ? $this->testNestedCondition() : $this->testIfCondition() && $this->testUnlessCondition(); if ($fail) { $text = null; if ($this->message !== null && strlen(trim($this->message)) > 0) { $text = trim($this->message); } else { if ($this->ifCondition !== null && $this->ifCondition !== "" && $this->testIfCondition()) { $text = "if=" . $this->ifCondition; } if ($this->unlessCondition !== null && $this->unlessCondition !== "" && $this->testUnlessCondition()) { if ($text === null) { $text = ""; } else { $text .= " and "; } $text .= "unless=" . $this->unlessCondition; } if ($this->nestedConditionPresent()) { $text = "condition satisfied"; } else { if ($text === null) { $text = "No message"; } } } $this->log("failing due to " . $text, Project::MSG_DEBUG); if ($this->status === null) { throw new BuildException($text); } throw new ExitStatusException($text, $this->status); } } /** * Add a condition element. * @return NestedCondition * @throws BuildException */ public function createCondition() { if ($this->nestedCondition !== null) { throw new BuildException("Only one nested condition is allowed."); } $this->nestedCondition = new NestedCondition(); return $this->nestedCondition; } /** * Set a multiline message. * * @param string $msg * * @return void */ public function addText($msg) { if ($this->message === null) { $this->message = ""; } $this->message .= $this->project->replaceProperties($msg); } /** * @return boolean */ protected function testIfCondition() { if ($this->ifCondition === null || $this->ifCondition === "") { return true; } return $this->project->getProperty($this->ifCondition) !== null; } /** * @return boolean */ protected function testUnlessCondition() { if ($this->unlessCondition === null || $this->unlessCondition === "") { return true; } return $this->project->getProperty($this->unlessCondition) === null; } /** * test the nested condition * @return bool true if there is none, or it evaluates to true * @throws BuildException */ private function testNestedCondition() { $result = $this->nestedConditionPresent(); if ($result && $this->ifCondition !== null || $this->unlessCondition !== null) { throw new BuildException("Nested conditions not permitted in conjunction with if/unless attributes"); } return $result && $this->nestedCondition->evaluate(); } /** * test whether there is a nested condition. * @return boolean */ private function nestedConditionPresent() { return (bool) $this->nestedCondition; } } . */ require_once 'phing/Task.php'; include_once 'phing/tasks/system/condition/Condition.php'; include_once 'phing/tasks/system/PropertyTask.php'; include_once 'phing/util/DirectoryScanner.php'; include_once 'phing/util/SourceFileScanner.php'; include_once 'phing/mappers/MergeMapper.php'; /** * Sets the given property if the specified target has a timestamp * greater than all of the source files. * * @author Hans Lellelid (Phing) * @author William Ferguson (Ant) * @author Hiroaki Nakamura (Ant) * @author Stefan Bodewig (Ant) * @version $Id: bf8189887471df0dbee59309b40045fb20db6f8c $ * @package phing.tasks.system */ class UpToDateTask extends Task implements Condition { private $_property; private $_value; private $_sourceFile; private $_targetFile; private $sourceFileSets = array(); private $_filelists = array(); protected $mapperElement = null; /** * The property to set if the target file is more up-to-date than * (each of) the source file(s). * * @param string $property the name of the property to set if Target is up-to-date. */ public function setProperty($property) { $this->_property = $property; } /** * Get property name * @return string property the name of the property to set if Target is up-to-date. */ public function getProperty() { return $this->_property; } /** * The value to set the named property to if the target file is more * up-to-date than (each of) the source file(s). Defaults to 'true'. * * @param the $value * @internal param the $value value to set the property to if Target is up-to-date */ public function setValue($value) { $this->_value = $value; } /** * Returns the value, or "true" if a specific value wasn't provided. */ private function getValue() { return ($this->_value !== null) ? $this->_value : "true"; } /** * The file which must be more up-to-date than (each of) the source file(s) * if the property is to be set. * * @param the $file * @internal param the $file file we are checking against. */ public function setTargetFile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->_targetFile = $file; } /** * The file that must be older than the target file * if the property is to be set. * * @param the $file * @internal param the $file file we are checking against the target file. */ public function setSrcfile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->_sourceFile = $file; } /** * Nested element. * * @deprecated Deprecated since Phing 2.4.0 */ public function createSrcfiles() { $fs = new FileSet(); $this->sourceFileSets[] = $fs; return $fs; } /** * Nested element. * @param FileSet $fs */ public function addFileset(FileSet $fs) { $this->sourceFileSets[] = $fs; } /** * Supports embedded element. * @return FileList */ public function createFileList() { $num = array_push($this->_filelists, new FileList()); return $this->_filelists[$num - 1]; } /** * Defines the FileNameMapper to use (nested mapper element). */ public function createMapper() { if ($this->mapperElement !== null) { throw new BuildException("Cannot define more than one mapper", $this->location); } $this->mapperElement = new Mapper($this->getProject()); return $this->mapperElement; } /** * Evaluate (all) target and source file(s) to * see if the target(s) is/are up-to-date. * @throws BuildException * @return boolean */ public function evaluate() { if (count($this->sourceFileSets) == 0 && count($this->_filelists) == 0 && $this->_sourceFile === null) { throw new BuildException("At least one srcfile or a nested " . " or element must be set."); } if ((count($this->sourceFileSets) > 0 || count($this->_filelists) > 0) && $this->_sourceFile !== null) { throw new BuildException("Cannot specify both the srcfile " . "attribute and a nested " . "or element."); } if ($this->_targetFile === null && $this->mapperElement === null) { throw new BuildException("The targetfile attribute or a nested " . "mapper element must be set."); } // if the target file is not there, then it can't be up-to-date if ($this->_targetFile !== null && !$this->_targetFile->exists()) { return false; } // if the source file isn't there, throw an exception if ($this->_sourceFile !== null && !$this->_sourceFile->exists()) { throw new BuildException($this->_sourceFile->getAbsolutePath() . " not found."); } $upToDate = true; for ($i = 0, $size = count($this->sourceFileSets); $i < $size && $upToDate; $i++) { $fs = $this->sourceFileSets[$i]; $ds = $fs->getDirectoryScanner($this->project); $upToDate = $upToDate && $this->scanDir( $fs->getDir($this->project), $ds->getIncludedFiles() ); } for ($i = 0, $size = count($this->_filelists); $i < $size && $upToDate; $i++) { $fl = $this->_filelists[$i]; $srcFiles = $fl->getFiles($this->project); $upToDate = $upToDate && $this->scanDir( $fl->getDir($this->project), $srcFiles ); } if ($this->_sourceFile !== null) { if ($this->mapperElement === null) { $upToDate = $upToDate && ($this->_targetFile->lastModified() >= $this->_sourceFile->lastModified()); } else { $sfs = new SourceFileScanner($this); $upToDate = $upToDate && count( $sfs->restrict( $this->_sourceFile->getAbsolutePath(), null, null, $this->mapperElement->getImplementation() ) ) === 0; } } return $upToDate; } /** * Sets property to true if target file(s) have a more recent timestamp * than (each of) the corresponding source file(s). * @throws BuildException */ public function main() { if ($this->_property === null) { throw new BuildException("property attribute is required.", $this->location); } $upToDate = $this->evaluate(); if ($upToDate) { $property = $this->project->createTask('property'); $property->setName($this->getProperty()); $property->setValue($this->getValue()); $property->setOverride(true); $property->main(); // execute if ($this->mapperElement === null) { $this->log( "File \"" . $this->_targetFile->getAbsolutePath() . "\" is up-to-date.", Project::MSG_VERBOSE ); } else { $this->log( "All target files are up-to-date.", Project::MSG_VERBOSE ); } } } /** * @param PhingFile $srcDir * @param $files * @return bool */ protected function scanDir(PhingFile $srcDir, $files) { $sfs = new SourceFileScanner($this); $mapper = null; $dir = $srcDir; if ($this->mapperElement === null) { $mm = new MergeMapper(); $mm->setTo($this->_targetFile->getAbsolutePath()); $mapper = $mm; $dir = null; } else { $mapper = $this->mapperElement->getImplementation(); } return (count($sfs->restrict($files, $srcDir, $dir, $mapper)) === 0); } } . */ require_once 'phing/BuildException.php'; require_once 'phing/Project.php'; require_once 'phing/Task.php'; require_once 'phing/TaskContainer.php'; /** * Retries the nested task a set number of times. * * @author Siad Ardroumli * @package phing.tasks.system */ class Retry extends Task implements TaskContainer { /** * Task to execute n times. * * @var Task $nestedTask */ private $nestedTask; /** * Set retry count to 1 by default. * * @var int $retryCount */ private $retryCount = 1; /** * The time to wait between retries in seconds, default to 0. * * @var int $retryDelay */ private $retryDelay = 0; /** * Set the task. * * @param Task $t the task to retry. * * @throws BuildException */ public function addTask(Task $t) { if ($this->nestedTask !== null) { throw new BuildException( 'The retry task container accepts a single nested task' . ' (which may be a sequential task container)' ); } $this->nestedTask = $t; } /** * Set the number of times to retry the task. * * @param int $n the number to use. */ public function setRetryCount($n) { $this->retryCount = $n; } /** * Set the delay between retries (in seconds). * * @param int $retryDelay the time between retries. * * @throws BuildException */ public function setRetryDelay($retryDelay) { if ($retryDelay < 0) { throw new BuildException( 'retryDelay must be a non-negative number' ); } $this->retryDelay = $retryDelay; } /** * Perform the work. * * @throws BuildException if there is an error. */ public function main() { $errorMessages = ''; for ($i = 0; $i <= $this->retryCount; $i++) { try { $this->nestedTask->perform(); break; } catch (Exception $e) { $errorMessages .= $e->getMessage(); if ($i >= $this->retryCount) { $taskName = $this->nestedTask->getTaskName(); $exceptionMessage = <<retryCount}] attempts; giving up Error messages: $errorMessages EXCEPTION_MESSAGE; throw new BuildException( $exceptionMessage, $this->getLocation() ); } if ($this->retryDelay > 0) { $msg = sprintf( 'Attempt [%s]: error occurred; retrying after %s s...', $i, $this->retryDelay); } else { $msg = sprintf( 'Attempt [%s]: error occurred; retrying...', $i ); } $this->log($msg, Project::MSG_INFO); $errorMessages .= PHP_EOL; if ($this->retryDelay > 0) { sleep($this->retryDelay); } } } } } . */ /** * Displays all the current properties in the build. The output can be sent to * a file if desired. * * Attribute "destfile" defines a file to send the properties to. This can be * processed as a standard property file later. * * Attribute "prefix" defines a prefix which is used to filter the properties * only those properties starting with this prefix will be echoed. * * By default, the "failonerror" attribute is enabled. If an error occurs while * writing the properties to a file, and this attribute is enabled, then a * BuildException will be thrown. If disabled, then IO errors will be reported * as a log statement, but no error will be thrown. * * Examples:
 *  <echoproperties  />
 * 
Report the current properties to the log. * *
 *  <echoproperties destfile="my.properties" />
 * 
Report the current properties to the file "my.properties", and will * fail the build if the file could not be created or written to. * *
 *  <echoproperties destfile="my.properties" failonerror="false"
 *      prefix="phing" />
 * 
Report all properties beginning with 'phing' to the file * "my.properties", and will log a message if the file could not be created or * written to, but will still allow the build to continue. * * @author Siad Ardroumli * @package phing.tasks.system */ class EchoProperties extends Task { /** * the properties element. */ private static $PROPERTIES = "properties"; /** * the property element. */ private static $PROPERTY = "property"; /** * name attribute for property, testcase and testsuite elements. */ private static $ATTR_NAME = "name"; /** * value attribute for property elements. */ private static $ATTR_VALUE = "value"; /** * the input file. * @var PhingFile */ private $inFile = null; /** * File object pointing to the output file. If this is null, then * we output to the project log, not to a file. * @var PhingFile */ private $destfile = null; /** * If this is true, then errors generated during file output will become * build errors, and if false, then such errors will be logged, but not * thrown. * @var boolean */ private $failonerror = true; /** @var string $format */ private $format = "text"; /** @var string $prefix */ private $prefix = ''; /** @var string $regex */ private $regex = ''; /** * Sets the input file. * * @param string|PhingFile $file the input file */ public function setSrcfile($file) { if (is_string($file)) { $this->inFile = new PhingFile($file); } else { $this->inFile = $file; } } /** * Set a file to store the property output. If this is never specified, * then the output will be sent to the Phing log. * * @param string|PhingFile $destfile file to store the property output */ public function setDestfile($destfile) { if (is_string($destfile)) { $this->destfile = new PhingFile($destfile); } else { $this->destfile = $destfile; } } /** * If true, the task will fail if an error occurs writing the properties * file, otherwise errors are just logged. * * @param failonerror true if IO exceptions are reported as build * exceptions, or false if IO exceptions are ignored. */ public function setFailOnError($failonerror) { $this->failonerror = $failonerror; } /** * If the prefix is set, then only properties which start with this * prefix string will be recorded. If regex is not set and if this * is never set, or it is set to an empty string or null, * then all properties will be recorded.

* * For example, if the attribute is set as: *

<echoproperties  prefix="phing." />
* then the property "phing.home" will be recorded, but "phing-example" * will not. * * @param string $prefix The new prefix value */ public function setPrefix($prefix) { if ($prefix != null && strlen($prefix) != 0) { $this->prefix = $prefix; } } /** * If the regex is set, then only properties whose names match it * will be recorded. If prefix is not set and if this is never set, * or it is set to an empty string or null, then all * properties will be recorded.

* * For example, if the attribute is set as: *

<echoproperties  prefix=".*phing.*" />
* then the properties "phing.home" and "user.phing" will be recorded, * but "phing-example" will not. * * @param string $regex The new regex value */ public function setRegex($regex) { if ($regex != null && strlen($regex) != 0) { $this->regex = $regex; } } /** * Set the output format - xml or text. * @param string $ea an enumerated FormatAttribute value */ public function setFormat($ea) { $this->format = $ea; } /** * Run the task. * * @throws BuildException trouble, probably file IO */ public function main() { if ($this->prefix != null && $this->regex != null) { throw new BuildException("Please specify either prefix or regex, but not both", $this->getLocation()); } //copy the properties file $allProps = array(); /* load properties from file if specified, otherwise use Phing's properties */ if ($this->inFile == null) { // add phing properties $allProps = $this->getProject()->getProperties(); } elseif ($this->inFile != null) { if ($this->inFile->exists() && $this->inFile->isDirectory()) { $message = "srcfile is a directory!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } if ($this->inFile->exists() && !$this->inFile->canRead()) { $message = "Can not read from the specified srcfile!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } try { $props = new Properties(); $props->load(new PhingFile($this->inFile)); $allProps = $props->getProperties(); } catch (IOException $ioe) { $message = "Could not read file " . $this->inFile->getAbsolutePath(); $this->failOnErrorAction($ioe, $message, Project::MSG_WARN); return; } } $os = null; try { if ($this->destfile == null) { $os = Phing::getOutputStream(); $this->saveProperties($allProps, $os); $this->log($os, Project::MSG_INFO); } else { if ($this->destfile->exists() && $this->destfile->isDirectory()) { $message = "destfile is a directory!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } if ($this->destfile->exists() && !$this->destfile->canWrite()) { $message = "Can not write to the specified destfile!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } $os = new FileOutputStream($this->destfile); $this->saveProperties($allProps, $os); } } catch (IOException $ioe) { $this->failOnErrorAction($ioe); } } /** * @param Exception $exception * @param string $message * @param int $level * @throws BuildException */ private function failOnErrorAction(Exception $exception = null, $message = '', $level = Project::MSG_INFO) { if ($this->failonerror) { throw new BuildException( $exception !== null ? $exception : $message, $this->getLocation() ); } else { $this->log( $exception !== null && $message === '' ? $exception->getMessage() : $message, $level ); } } /** * Send the key/value pairs in the hashtable to the given output stream. * Only those properties matching the prefix constraint will be * sent to the output stream. * The output stream will be closed when this method returns. * * @param array $allProps propfile to save * @param OutputStream $os output stream * @throws IOException on output errors * @throws BuildException on other errors */ protected function saveProperties($allProps, $os) { ksort($allProps); $props = new Properties(); if ($this->regex !== '') { $a = new ArrayIterator($allProps); $i = new RegexIterator($a, $this->regex, RegexIterator::MATCH, RegexIterator::USE_KEY); $allProps = iterator_to_array($i); } if ($this->prefix !== '') { $a = new ArrayIterator($allProps); $i = new RegexIterator( $a, '~^' . preg_quote($this->prefix, '~') . '.*~', RegexIterator::MATCH, RegexIterator::USE_KEY ); $allProps = iterator_to_array($i); } foreach ($allProps as $name => $value) { $props->setProperty($name, $value); } if ($this->format === "text") { $this->textSaveProperties($props, $os, "Phing properties"); } elseif ($this->format === "xml") { $this->xmlSaveProperties($props, $os); } } /** * Output the properties as xml output. * @param Properties $props the properties to save * @param OutputStream $os the output stream to write to (Note this gets closed) * @throws BuildException */ protected function xmlSaveProperties(Properties $props, OutputStream $os) { $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $rootElement = $doc->createElement(self::$PROPERTIES); $properties = $props->getProperties(); ksort($properties); foreach ($properties as $key => $value) { $propElement = $doc->createElement(self::$PROPERTY); $propElement->setAttribute(self::$ATTR_NAME, $key); $propElement->setAttribute(self::$ATTR_VALUE, $value); $rootElement->appendChild($propElement); } try { $doc->appendChild($rootElement); $os->write($doc->saveXML()); } catch (IOException $ioe) { throw new BuildException("Unable to write XML file", $ioe); } } /** * @param Properties $props the properties to record * @param OutputStream $os record the properties to this output stream * @param string $header prepend this header to the property output * @throws BuildException on an I/O error during a write. */ protected function textSaveProperties(Properties $props, OutputStream $os, $header) { try { $props->storeOutputStream($os, $header); } catch (IOException $ioe) { throw new BuildException($ioe, $this->getLocation()); } } } . */ require_once 'phing/Task.php'; require_once 'phing/BuildTimeoutException.php'; require_once 'phing/tasks/system/WaitForTask.php'; /** * Based on Apache Ant Block For: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @author Siad Ardroumli * @package phing.tasks.system */ class BlockForTask extends WaitForTask { /** * Text to include in a message */ private $text; public function __construct($taskName = 'blockfor') { parent::__construct($taskName); } /** * If the wait fails, a BuildException is thrown. All the superclasses actions are called first. * @throws BuildTimeoutException on timeout, using the text in {@link #text} * */ protected function processTimeout() { parent::processTimeout(); throw new BuildTimeoutException($this->text); } /** * Set the error text; all properties are expanded in the message. * * @param string $message the text to use in a failure message */ public function addText($message) { $this->text = $this->getProject()->replaceProperties($message); } } . */ include_once 'phing/tasks/system/ApplyTask.php'; include_once 'phing/Phing.php'; include_once 'phing/Project.php'; include_once 'phing/BuildException.php'; include_once 'phing/system/io/PhingFile.php'; include_once 'phing/util/StringHelper.php'; /** * Changes the attributes of a file or all files inside specified directories. * Right now it has effect only under Windows. Each of the 4 possible * permissions has its own attribute, matching the arguments for the `attrib` * command. * * Example: * ``` *