diff options
Diffstat (limited to 'build/build.xml')
-rw-r--r-- | build/build.xml | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/build/build.xml b/build/build.xml index 02518ac441..5b4cf8b496 100644 --- a/build/build.xml +++ b/build/build.xml @@ -169,26 +169,42 @@ command="git archive ${revision} | tar -xf - -C ../${dir}" checkreturn="true" /> - <!-- - If composer.phar exists in this version of the tree, also export - it into ${dir}, install dependencies, then delete it again. - --> + <!-- Install composer dependencies, if there are any. --> <exec dir="." - command="git ls-tree ${revision} composer.phar" + command='php -r "\$j = json_decode(file_get_contents("composer.json")); echo isset(\$j->require);"' checkreturn="true" - outputProperty='composer-ls-tree-output' /> + outputProperty='composer-has-dependencies' /> <if> - <not><equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /></not> + <equals arg1="${composer-has-dependencies}" arg2="1" trim="true" /> <then> + <!-- We have non-dev composer dependencies --> <exec dir="." - command="git archive ${revision} composer.phar | tar -xf - -C ${dir}" - checkreturn="true" /> - <exec dir="${dir}" - command="php composer.phar install" + command="git ls-tree ${revision} composer.phar" checkreturn="true" - passthru="true" /> - <delete file="${dir}/composer.phar" /> + outputProperty='composer-ls-tree-output' /> + <if> + <equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /> + <then> + <fail message="There are composer dependencies, but composer.phar is missing." /> + </then> + <else> + <!-- Export the phar, install dependencies, delete phar. --> + <exec dir="." + command="git archive ${revision} composer.phar | tar -xf - -C ${dir}" + checkreturn="true" /> + <exec dir="${dir}" + command="php composer.phar install" + checkreturn="true" + passthru="true" /> + <delete file="${dir}/composer.phar" /> + </else> + </if> </then> + <else> + <!-- We do not have composer dependencies, do not ship composer files --> + <delete file="${dir}/composer.json" /> + <delete file="${dir}/composer.lock" /> + </else> </if> <delete file="${dir}/config.php" /> |