Hi, I've notice a really strange behavior in the task PhingTask with the dir property.
I've a build.properties with only one property inside :
propel.generator.home = Libraries\propel-1.2.0RC1\generator
And in my build file I try to call an other build like this :
<phing phingfile="build.xml" inheritAll="true" dir="${propel.generator.home}" target="creole">
<property name="project" value="bookstore"/>
<property name="project.dir" value="${propel.generator.home}/projects/bookstore"/>
</phing>
When I run my build I get this error statment :
[phing] Error reading project file [wrapped: Cannot fopen C:\MyProject\Libraries\propel-1.2.0RC1\generator\Libraries\prope
l-1.2.0RC1\generator\build.xml. failed to open stream: No such file or directory]
As you can see the propel.generator.home property have been duplicated twice in the final search path.
I've browse the source and found that the mistake is located in the PhingTask.php file, line 218. Here is the code :
if ($this->dir !== null) {
$this->newProject->setBasedir($this->dir);
if ($savedDir !== null) { // has been set explicitly
$this->newProject->setInheritedProperty("project.basedir", $this->dir->getAbsolutePath());
}
} else {
$this->dir = $this->getProject()->getBaseDir();
}
After some tests I've seen that the $this->dir value is correct before the $this->newProject->setBaseDir call but wrong right after. I've checked the setBasedir of the project class, but I don't understand the side effect that cause this problem.
Temporary I've solved this by changing the code in the like this :
if ($this->dir !== null) {
$this->newProject->setBasedir($this->dir);
// [DK] Correction of a strange bug. I don't understand what's going on, but the dir is changed by the setBasedir call.
$this->dir = $this->newProject->getBasedir();
if ($savedDir !== null) { // has been set explicitly
$this->newProject->setInheritedProperty("project.basedir", $this->dir->getAbsolutePath());
}
} else {
$this->dir = $this->getProject()->getBaseDir();
}
Hope this will help you guys and thanks again for this great product that is phing !