Subversion Repositories DevTools

Rev

Rev 1974 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<project name="load-using-macrodef"
         xmlns:ivy="antlib:fr.jayasoft.ivy.ant">

        <!--    C O P Y R I G H T   N O T I C E
                        This material is confidential to ERG and may not be disclosed in whole
                        or in part to any third party nor used in any manner whatsoever other
                        than for the purposes expressly consented to by ERG in writing.

                        This material is also copyright and may not be reproduced, stored in a
                        retrieval system or transmitted in any form or by any means in whole or
                        in part without the express written consent of ERG.
        -->


        <!-- 
          - REPLACE_ANT_USING will get replaced with the release version of ant-using on release. 
          -->
        <property name="ant-using-version" value="REPLACE_ANT_USING"/>


        <fail message="An existing ANT using macro has been declared with a different version" status="2">
                <condition>
                        <and>
                                <isset  property="using.ant-using.version"/>
                                <not><equals arg1="${using.ant-using.version}" arg2="${ant-using-version}"/></not>
                        </and>
                </condition>
        </fail>

        <property name="using.ant-using.version" value="${ant-using-version}"/>
        
        <fail message="The mandatory environment variable GBE_DPKG is missing" status="1">
                <condition>
                        <and>
                                <not><isset property="env.GBE_DPKG"/></not>
                        </and>
                </condition>
        </fail>

        <dirname property="dirname.load-using-macrodef" file="${ant.file.load-using-macrodef}"/>
        <property name="using.ant-using.basedir" location="${dirname.load-using-macrodef}"/>
    
        <taskdef resource="net/sf/antcontrib/antlib.xml">
                 <classpath>
                     <pathelement location="${dirname.load-using-macrodef}/jar/ant-contrib.jar"/>
                 </classpath>
        </taskdef>
    
        <path id="ivy.lib.path">
                <fileset dir="${dirname.load-using-macrodef}/jar" includes="ivy*.jar"/>
        </path>
        
        <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
                        uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>

        <available property="ivy.xml.exists" filepath="${basedir}" file="ivy.xml"/>
        <available property="ivy-template.xml.exists" filepath="${basedir}" file="ivy-template.xml"/>
        <if>
                <or>
                        <isset property="ivy.xml.exists"/>
                        <isset property="ivy-template.xml.exists"/>
                </or>
                <then>
                        <if>
                                <!-- if we are building using the auto build tool, or we are not, and GBE_DPKG_CACHE isn't set,
                                        then use ${basedir}/build/.ivy/cache as the ivy cache.
                                        else use the GBE_DPKG_CACHE location.
                                -->
                                <or>
                                        <and>
                                                <isset property="env.GBE_ABT"/>
                                                <not><equals arg1="${env.GBE_ABT}" arg2=""/></not>
                                        </and>
                                        <not>
                        <and>
                            <isset property="env.GBE_DPKG_CACHE"/>
                            <length string="${env.GBE_DPKG_CACHE}" trim="true" when="greater" length="0"/>
                        </and>
                    </not>
                                </or>
                                <then>
                                        <property name="ivy.cache.home" value="${basedir}/build/.ivy/cache"/>
                                </then>
                                <else>
                                        <property name="ivy.cache.home" value="${env.GBE_DPKG_CACHE}/.ivy/cache"/>
                                </else>
                        </if>
                        
                        <echo taskname="ivy:cache">${ivy.cache.home}</echo>
                        
                        <ivy:configure file="${dirname.load-using-macrodef}/ivyconf.xml" />
                </then>
        </if>
        
        <!-- 
          - Do we have an environment variable for GBE_DPKG_CACHE?
          - If so, use it as the build location.
          - If not, look for a properties file : ant-build-properties (if one exists)
          - If the properties are not found, default to ${basedir}/build/.dpkg/cache
          -->
        <if>
        <and>
                <isset property="env.GBE_DPKG_CACHE"/>
            <length string="${env.GBE_DPKG_CACHE}" trim="true" when="greater" length="0"/>
        </and>
                <then>
                        <property name="build.repository" value="${env.GBE_DPKG_CACHE}"/>
                        <echo taskname="ant-using">Using environment variable 'GBE_DPKG_CACHE' as build.repository from : ${build.repository}</echo>
                </then>
                <else>
                        <available property="ant-build-properties_available" filepath="${user.home}" file="ant-build-properties"/>
                        <if>
                                <isset property="ant-build-properties_available"/>
                                <then>
                                        <property file="${user.home}/ant-build-properties"/>
                                        <echo taskname="ant-using">Using 'ant-build-properties' file for build.repository as : ${build.repository}</echo>
                                </then>
                                <else>
                                        <property name="build.repository" value="${basedir}/build/.dpkg/cache"/>
                                </else>
                        </if>
                </else>
        </if>


        <!-- 
          - Pick up ant-using-macro.xml from same directory as this file was imported. 
          -->
        <import file="${dirname.load-using-macrodef}/ant-using-macro.xml" optional="false"/>
    <import file="${dirname.load-using-macrodef}/ant-clean.xml" optional="false"/>
    <import file="${dirname.load-using-macrodef}/ant-manifest.xml" optional="false"/>
    <import file="${dirname.load-using-macrodef}/ant-release.xml" optional="false"/>
    <import file="${dirname.load-using-macrodef}/ant-javadoc.xml" optional="false"/>
    <import file="${dirname.load-using-macrodef}/ant-jants.xml" optional="false"/>
        <import file="${dirname.load-using-macrodef}/ant-ivy.xml" optional="false"/>
        
        <!-- 
          - Import the auto.xml file (if it exists), and if it does not then import the depends.xml.
          - The name of the depends.xml it will look for (in this order) is ${ant.project.name}-depends.xml or
          - ${ant.project.name}depends.xml.
          -->
        <available property="auto.xml.exists" filepath="${basedir}" file="auto.xml"/>
        <if>
            <isset property="auto.xml.exists"/>
                <then>
                        <import file="${basedir}/auto.xml" optional="true"/>
                </then>
                <else>
                        <available property="depends.xml.exists" filepath="${basedir}" file="${ant.project.name}-depends.xml"/>
                        <if>
                                <isset property="depends.xml.exists"/>
                                <then>
                                        <import file="${basedir}/${ant.project.name}-depends.xml" optional="true"/>
                                </then>
                                <else>
                                        <import file="${basedir}/${ant.project.name}depends.xml" optional="true"/>
                                </else>
                        </if>
                </else>
        </if>

</project>