appserver-io/webserver

View on GitHub
build.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="appserver-io/webserver" default="composer-init" basedir=".">
    
    <!-- initialize ENV variable -->
    <property environment="env" />
    
    <!-- initialize file based properties -->
    <property file="${basedir}/build.properties"/>
    <property file="${basedir}/build.default.properties"/>
    <property file="${basedir}/build.${os.family}.properties"/>
    
    <!-- initialize the library specific properties -->
    <property name="codepool" value="vendor"/>
    
    <!-- initialize the directory where we can find the real build files -->
    <property name="vendor.dir" value ="${basedir}/${codepool}" />
    <property name="build.dir" value="${vendor.dir}/appserver-io/build" />
    
    <!-- ==================================================================== -->
    <!-- Import the common build configuration file                           -->
    <!-- ==================================================================== -->
    <import file="${build.dir}/common.xml" optional="true"/>

    <!-- ==================================================================== -->
    <!-- Checks if composer has installed it's dependencies                   -->
    <!-- ==================================================================== -->
    <target name="is-composer-installed">
        <condition property="composer.present">
            <available file="${build.dir}" type="dir"/>
        </condition>
    </target>
    
    <!-- ==================================================================== -->
    <!-- Installs all dependencies defined in composer.json                   -->
    <!-- ==================================================================== -->
    <target name="composer-install" depends="is-composer-installed" unless="composer.present" description="Installs all dependencies defined in composer.json">
        <exec dir="${basedir}" executable="composer">
            <arg line="--no-interaction --dev install"/>
        </exec>
    </target>

    <!-- ==================================================================== -->
    <!-- Updates composer dependencies defined in composer.json               -->
    <!-- ==================================================================== -->
    <target name="composer-update" depends="is-composer-installed" if="composer.present" description="Updates composer dependencies defined in composer.json">
        <exec dir="${basedir}" executable="composer">
            <arg line="--no-interaction --dev update"/>
        </exec>
    </target>

    <!-- ===================================================================== -->
    <!-- Checks if the build- and deployment stub has already been initialized -->
    <!-- ===================================================================== -->
    <target name="composer-init">
        <antcall target="composer-install"/>
        <antcall target="composer-update"/>
    </target>

</project>