Ticket #461: r773t461.patch
| File r773t461.patch, 3.5 KB (added by simple.square@…, 2 years ago) |
|---|
-
classes/phing/Phing.php
536 536 $this->targets[] = $project->getDefaultTarget(); 537 537 } 538 538 539 // make sure that minimum required phing version is satisfied 540 try { 541 $this->comparePhingVersion($project->getPhingVersion()); 542 } catch(Exception $exc) { 543 $project->fireBuildFinished($exc); 544 restore_error_handler(); 545 self::unsetCurrentProject(); 546 throw $exc; 547 } 548 539 549 // execute targets if help param was not given 540 550 if (!$this->projectHelp) { 541 551 … … 570 580 self::unsetCurrentProject(); 571 581 } 572 582 583 private function comparePhingVersion($version) { 584 $current = strtolower(self::getPhingVersion()); 585 $current = trim(str_replace('phing', '', $current)); 586 587 // make sure that version checks are not applied to trunk 588 if('dev' === $current) { 589 return 1; 590 } 591 592 if(-1 == version_compare($current, $version)) { 593 throw new BuildException( 594 sprintf('Incompatible Phing version (%s). Version "%s" required.', $current, $version)); 595 } 596 } 597 573 598 /** 574 599 * Bind any registered build listeners to this project. 575 600 * -
classes/phing/Project.php
98 98 /** project description */ 99 99 private $description; 100 100 101 /** require phing version */ 102 private $phingVersion; 103 101 104 /** a FileUtils object */ 102 105 private $fileUtils; 103 106 … … 440 443 return $this->description; 441 444 } 442 445 446 /** Set the minimum required phing version **/ 447 function setPhingVersion($version) { 448 $version = str_replace('phing', '', strtolower($version)); 449 $this->phingVersion = (string)trim($version); 450 } 451 452 /** Get the minimum required phing version **/ 453 function getPhingVersion() { 454 if($this->phingVersion === null) { 455 $this->setPhingVersion(Phing::getPhingVersion()); 456 } 457 return $this->phingVersion; 458 } 459 443 460 /** Set basedir object from xml*/ 444 461 function setBasedir($dir) { 445 462 if ($dir instanceof PhingFile) { -
classes/phing/parser/ProjectHandler.php
69 69 $id = null; 70 70 $desc = null; 71 71 $baseDir = null; 72 $ver = null; 72 73 73 74 // some shorthands 74 75 $project = $this->configurator->project; … … 85 86 $baseDir = $value; 86 87 } elseif ($key === "description") { 87 88 $desc = $value; 89 } elseif ($key === "phingVersion") { 90 $ver = $value; 88 91 } else { 89 92 throw new ExpatParseException("Unexpected attribute '$key'"); 90 93 } … … 118 121 $project->setDescription($desc); 119 122 } 120 123 124 if($ver !== null) { 125 $project->setPhingVersion($ver); 126 } 127 121 128 if ($project->getProperty("project.basedir") !== null) { 122 129 $project->setBasedir($project->getProperty("project.basedir")); 123 130 } else {
