Reputation: 10294
Background
I started with this open ended question https://stackoverflow.com/questions/36602830/list-differences-between-two-directories-from-point-of-view-of-one-directory-by
Then tried this to solve it using phing's native utilities, but got stuck - How to return a value from a phing target?
Now I am trying to write a custom Phing task, as per https://www.phing.info/docs/guide/trunk/ch06s06.html. I tried echoing the list of files in this, with an intention to somehow collect the same in a property when the task is called from the build xml -
<addedfiles message="Hello World" outputProperty="output"/>
But I found that an outputProperty
attribute is not supported in the call from the build xml file.
Any pointers on how to do this, or to the other two questions would help a lot.
Upvotes: 1
Views: 224
Reputation: 1759
You can improve your solution doing this
private $outputProperty;
public function setOutputProperty($str)
{
$this->outputProperty = $str;
}
and then, when you catch the output
$this->getProject()->setNewProperty($this->outputProperty, "hello world");
Upvotes: 0
Reputation: 10294
Oh it is simple. We can set a property within the custom task class like this -
$this->getProject()->setNewProperty('output', "hello world");
and it can be accessed in the build xml, after the task call, like this -
<addedfiles message="Hello World" />
<echo>See ${output}</echo>
Upvotes: 0