view ivy-ant.xml @ 129:bef2bfc61f6e

CM-133: fix bamboo plan parsing. enable showEnv to display sytem properties and env variables in -info mode
author smith@nwoca.org
date Wed, 05 Jun 2013 02:29:48 +0100
parents 86fdadd7468a
children 7a36ea2cb81a
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<project name="ivy-ant"  basedir="." 
         xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
         xmlns:ssdt="http://www.ssdt-ohio.org/ant/common">
    
    <property   name="ssdt.ivy.jar.src"         value="http://ivy.ssdt.nwoca.org/repository/ivy/ivy.jar"/>
    <property   name="ssdt.ivy.settings.src"    value="${ssdt.devel.kit.src}/ssdt.default.ivy.settings.xml"/>

    <ssdt:fetch         dest="${user.home.ant.lib}/ivy.jar"
                        src="${ssdt.ivy.jar.src}"/>

    <dirname property="ivy.home" file="${ant.file.ivy-ant}"/>
    <property name="ivy-ant.location" location="${ant.file.ivy-ant}"/>
    <dirname property="ivy-ant.base" file="${ivy-ant.location}"/>

    <property name="ivy.default.ivy.user.dir" 
              value="${user.home}/.ivy2"/>   
    <property name="ivy.default.cache.dir"
              value="${ivy.default.ivy.user.dir}/cache"/>
    <property name="ivy.local.default.root"
              value="${ivy.default.ivy.user.dir}/local"/>

    <ssdt:fetch dest="${ssdt.devel.kit}/ssdt.default.ivy.settings.xml"
                src="${ssdt.ivy.settings.src}"/>

    <target name="ivy-report" depends="init">
        <mkdir dir="${build.dir}/ivy"/>
        <ivy:resolve log="quiet" file="ivy.xml"/>
        <ivy:report todir="${build.dir}/ivy" conf="runtime" graph="false" dot="true" xml="true"/>
        <ivy:artifactreport tofile="${build.dir}/ivy/artifact-report.xml" />
    </target>

    <target name="ivy-info" depends="init">
        <ivy:info file="ivy.xml" property="ivy.project"/>
        <echoproperties prefix="ivy.project"/>
    </target>

    <target name="ivy-clean-all" description="cleans ssdt caches and local builds" depends="init">
        <delete failonerror="false" includeemptydirs="true" dir="${ivy.default.ivy.user.dir}"/>
    </target>

    <target name="ivy-clean" description="cleans ssdt caches and local builds" depends="init">
        <delete failonerror="false" includeemptydirs="true">
            <fileset dir="${ivy.default.ivy.user.dir}/cache">
                <include name="*ssdt*.*"/>                
            </fileset>
        </delete>
        <delete dir="${ivy.default.ivy.user.dir}/cache/org.ssdt_ohio"  failonerror="false"/>
        <delete dir="${ivy.default.ivy.user.dir}/cache/org.nwoca.ssdt"  failonerror="false"/>
        <delete dir="${ivy.default.ivy.user.dir}/ssdt-cache"  failonerror="false"/>
        <delete dir="${ivy.default.ivy.user.dir}/snapshot-cache"  failonerror="false"/>
        <delete dir="${ivy.default.ivy.user.dir}/local" failonerror="false"/>
    </target>

    <target name="-ivy-retrieve-custom" depends="-ivy-define-classpaths,-ivy-retrieve-web-jars">
    </target>

    <target name="-ivy-copy-webjars" if="build.web.dir">
        <ivy:resolve  log="quiet" file="ivy.xml"/>
        <ivy:retrieve pattern="${basedir}/${build.web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" type="jar" conf="runtime"/>
    </target>

    <target name="-ivy-retrieve-web-jars" if="build.web.dir">
        <ivy:retrieve pattern="${basedir}/${build.web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" type="jar" conf="runtime"/>
    </target>

    <target name="-ivy-define-classpaths">
        <!-- Custom SSDT retrieve target to replaced IvyBean's default -ivy-retrieve.
            Builds a separate classpath for javac, javac.test, run, run.test, etc based
            on the ivy configurations similer to how NetBeans would build them.
            Uses "ivy:cachepath" instead of "ivy:retrieve". Although is is contrary
            to "best practice" it avoids transfering all jars to build directory and
            avoids problem with 'clean'.  NetBeans and ant don't care where the files
            are on disk and the builds are dependent on Ivy anyway. But the "runtime" jars
            are still placed in dist/libs based on the correct run.classpath built by this
            target.
        -->
        <ivy:settings  file="ivysettings.xml"/>
        <ivy:resolve file="ivy.xml" />
        <ivy:artifactproperty conf="*"
                              name="ivydeps.[organisation]-[module]"
                              value="[revision]"/>

        <ivy:cachepath pathid="ivy.javac.classpath.id" conf="compile" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.javac.classpath">
            <path refid="ivy.javac.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>
        <property name="old.javac.classpath" value="${javac.classpath}"/>
        <var name="javac.classpath" unset="true"/>
        <if>
            <equals arg1="${old.javac.classpath}" arg2=""/>
            <then>
                <property name="javac.classpath" value="${ivy.javac.classpath}"/>
            </then>
            <else>
                <property name="javac.classpath" value="${old.javac.classpath}${path.separator}${ivy.javac.classpath}"/>
            </else>
        </if>
        <echo level="debug" message="$${javac.classpath} : ${javac.classpath}"/>

        <ivy:cachepath pathid="ivy.javac.test.classpath.id" conf="compile,compile-test" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.javac.test.classpath">
            <path refid="ivy.javac.test.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>
        <property name="old.javac.test.classpath" value="${javac.test.classpath}"/>
        <var name="javac.test.classpath" unset="true"/>
        <if>
            <equals arg1="${old.javac.test.classpath}" arg2=""/>
            <then>
                <property name="javac.test.classpath" value="${ivy.javac.test.classpath}"/>
            </then>
            <else>
                <property name="javac.test.classpath" value="${old.javac.test.classpath}${path.separator}${ivy.javac.test.classpath}"/>
            </else>
        </if>
        <echo level="debug" message="$${javac.test.classpath} : ${javac.test.classpath}"/>

        <ivy:cachepath pathid="ivy.run.classpath.id" conf="compile,runtime" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.run.classpath">
            <path refid="ivy.run.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>
        <property name="old.run.classpath" value="${run.classpath}"/>
        <var name="run.classpath" unset="true"/>
        <if>
            <equals arg1="${old.run.classpath}" arg2="$${run.classpath}"/>
            <then>
                <property name="run.classpath" value="${ivy.run.classpath}"/>
            </then>
            <else>
                <property name="run.classpath" value="${old.run.classpath}${path.separator}${ivy.run.classpath}"/>
            </else>
        </if>
        <echo level="debug" message="$${run.classpath} : ${run.classpath}"/>


        <ivy:cachepath pathid="ivy.run.test.classpath.id" conf="compile,compile-test,runtime,runtime-test" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.run.test.classpath">
            <path refid="ivy.run.test.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>

        <property name="old.run.test.classpath" value="${run.test.classpath}"/>
        <var name="run.test.classpath" unset="true"/>
        <if>
            <equals arg1="${old.run.test.classpath}" arg2="$${run.test.classpath}"/>
            <then>
                <property name="run.test.classpath" value="${ivy.run.test.classpath}"/>
            </then>
            <else>
                <property name="run.test.classpath" value="${old.run.test.classpath}${path.separator}${ivy.run.test.classpath}"/>
            </else>
        </if>
        <if>
            <isset property="coverage.run.with.cobertura"/>
            <then>
                <property name="precoverage.run.test.classpath" value="${run.test.classpath}"/>
                <var name="run.test.classpath" unset="true"/>
                <property name="run.test.classpath" value="${cobertura.instrumented.classes}${path.separator}${precoverage.run.test.classpath}${path.separator}${cobertura.classpath.path}"/>
            </then>
        </if>
        <if>
            <isset property="coverage.run.with.clover"/>
            <then>
                <property name="preclover.run.test.classpath" value="${run.test.classpath}"/>
                <var name="run.test.classpath" unset="true"/>
                <property name="run.test.classpath" value="${preclover.run.test.classpath}${path.separator}${clover.jar.file}"/>
            </then>
        </if>

        <echo level="debug" message="$${run.test.classpath} : ${run.test.classpath}"/>

        <ivy:cachepath pathid="ivy.debug.classpath.id" conf="compile,runtime" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.debug.classpath">
            <path refid="ivy.debug.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>
        <property name="old.debug.classpath" value="${debug.classpath}"/>
        <var name="debug.classpath" unset="true"/>
        <if>
            <equals arg1="${old.debug.classpath}" arg2="$${debug.classpath}"/>
            <then>
                <property name="debug.classpath" value="${ivy.debug.classpath}"/>
            </then>
            <else>
                <property name="debug.classpath" value="${old.debug.classpath}${path.separator}${ivy.debug.classpath}"/>
            </else>
        </if>
        <echo level="debug" message="$${debug.classpath} : ${debug.classpath}"/>

        <ivy:cachepath pathid="ivy.debug.test.classpath.id" conf="compile,compile-test,runtime,runtime-test" type="jar"/>
        <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.debug.test.classpath">
            <path refid="ivy.debug.test.classpath.id"/>
            <!--map from="${basedir}${file.separator}" to=""/-->
        </pathconvert>
        <property name="old.debug.test.classpath" value="${debug.test.classpath}"/>
        <var name="debug.test.classpath" unset="true"/>
        <if>
            <equals arg1="${old.debug.test.classpath}" arg2="$${debug.test.classpath}"/>
            <then>
                <property name="debug.test.classpath" value="${ivy.debug.test.classpath}"/>
            </then>
            <else>
                <property name="debug.test.classpath" value="${old.debug.test.classpath}${path.separator}${ivy.debug.test.classpath}"/>
            </else>
        </if>
        <echo level="debug" message="$${debug.test.classpath} : ${debug.test.classpath}"/>
    </target>


    <target name="-ivy-javaagent" description="Retrieves load time weaver java agent">
        <property name="java.agent.org" value="org.springframework"/>
        <property name="java.agent.module" value="org.springframework.instrument"/>
        <property name="java.agent.revision" value="3.0.1.RELEASE-A"/>
        <ivy:resolve resolveId="javaagentid"
                     organisation="${java.agent.org}"
                     module="${java.agent.module}"
                     revision="${java.agent.revision}"
                     type="jar"
                     inline="true"
                     keep="true"
                     log="quiet"/>
        <ivy:retrieve
            resolveid="javaagentid"
            pattern="${basedir}/${build.dir}/${lib.dir}/java-agent.[ext]"
            type="jar"
            log="quiet"/>
        <property name="java.agent.jar"
                  value="build/jar/java-agent.jar"/>
    </target>

    <target name="artifactoryPublish" depends="init">
        <ivy:settings/>
        <ivy:resolve file="ivy.xml"/>
        <ivy:publish forcedeliver="true" overwrite="true" resolver="ssdt-snapshots-local">
             <artifacts pattern="${basedir}/${dist.dir}/[artifact].[ext]"/>
        </ivy:publish>
    </target>

</project>