diff --git a/build.xml b/build.xml index 655c9de901..64d9f5b630 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,9 @@ + + + + @@ -31,13 +35,16 @@ - + + + + @@ -58,11 +65,11 @@ - - + + - - + + diff --git a/phing/tasks/mantisbt/ExtractMantisBTVersion.php b/phing/tasks/mantisbt/ExtractMantisBTVersion.php new file mode 100644 index 0000000000..3b59b3fe99 --- /dev/null +++ b/phing/tasks/mantisbt/ExtractMantisBTVersion.php @@ -0,0 +1,54 @@ +. +require_once('phing/Task.php'); + +/** + * The ExtractMantisBTVersion is a custom task which extracts the MantisBT version + * as defined by the constants file. + * + * @author Robert Munteanu + */ +class ExtractMantisBTVersion extends Task { + + private $file; + + public function setFile(PhingFile $file) { + + $this->file = $file; + } + + public function main() { + + if ( ! isset ( $this->file ) ) { + throw new BuildException("Missing 'file' attribute."); + } + + $contents = file($this->file->getPath()); + + foreach ( $contents as $line ) { + if ( strstr($line, 'MANTIS_VERSION')) { + eval($line); + break; + } + } + + if ( !constant('MANTIS_VERSION' ) ) + throw new BuildException('No constant named MANTIS_VERSION found in ' . $this->file->getPath()); + + $this->project->setProperty('mantisbtversion', MANTIS_VERSION); + } +} +?> \ No newline at end of file