Is there any way to get a return value from a phing ad-hoc task?
For example, I'm trying to get the version number from a JSON string in a file as follows:
<target name="get-app-version">
<adhoc-task name="appversion" ><![CDATA[
class AppversionTask extends Task {
private $version;
public function getVersion() {
return $this->version;
}
function main() {
$manifest = file_get_contents("manifest.json");
$manifest_json = json_decode($manifest);
$version = $manifest_json->version;
$this->log("App version: " . $version);
$this->version = $version;
}
}
]]></adhoc-task>
<appversion output="version" />
<echo message="${version}" />
</target>
I can only find documentation on setting values, but not getting values. However, the adhoc typdef task seems to show a get syntax, so I'm wondering if there is some way to do this.