9 require_once
'phing/Task.php';
73 if ($this->composer ===
null) {
78 if (!empty($this->file) && file_exists($this->file)) {
82 if (!empty($this->dir)) {
84 foreach ($found as
$file) {
85 $files[] = $this->dir . DIRECTORY_SEPARATOR .
$file;
89 foreach ($files as
$file) {
91 $cmd = $this->composer .
' validate ' .
$file;
92 $cmd = escapeshellcmd($cmd);
94 if ($this->passthru) {
96 passthru($cmd, $retval);
98 throw new BuildException(
'invalid composer.json');
103 exec($cmd, $out, $retval);
105 $err = join(
"\n", $out);
106 throw new BuildException($err);
123 $ds =
new DirectoryScanner();
124 $ds->setBasedir($this->dir);
125 $ds->setIncludes(array(
'**/composer.json'));
127 return $ds->getIncludedFiles();
136 $basedir = $this->project->getBasedir();
137 $php = $this->project->getProperty(
'php.interpreter');
139 if (file_exists($basedir .
'/composer.phar')) {
140 $this->composer =
"$php $basedir/composer.phar";
143 exec(
'which composer', $out);
145 throw new BuildException(
146 'Could not determine composer location.'
149 $this->composer = $out[0];