ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Invoking a target for multiple build-files?
Date Tue, 13 Jan 2004 22:45:12 GMT
I'm just going show you an alternate Ant 1.6 version of your script #1:

<project name="myproject" default="debug">
    <path id="subdirs">
        <pathelement location="core" />
        <pathelement location="servers" />
        <pathelement location="plugins" />
    </path>

    <target name="clean">
      <subant target="clean" buildpathref="subdirs" inheritRefs="true" />
    </target>

    <target name="debug">
      <subant target="debug" buildpathref="subdirs" inheritRefs="true" />
    </target>

    <target name="jar">
      <subant target="jar" buildpathref="subdirs" inheritRefs="true" />
    </target>

    <target name="unit_test">
      <subant target="unit_test" buildpathref="subdirs" inheritRefs="true"
/>
    </target>
</project>

You could even use a <macrodef> to make it look even simpler,
and not use <subant> but your 3 <ant>s ;-) --DD

> -----Original Message-----
> From: Greg Irvine [mailto:greg.irvine@thalesatm.com]
> If anyone has any helpful improvements on my suggestions, feel free to
> bonk me on the head with them.  :)
> <!-- SCRIPT 1 -->
> <project name="myproject" default="build_all">
>     <!-- set a default value for chosenTarget used by build_all -->
>     <property name="chosenTarget" value="debug"/>
> 
>     <target name="clean">
>         <antcall target="build_all" >
>             <param name="chosenTarget" value="clean"/>
>         </antcall>
>     </target>
> 
>     <target name="debug">
>         <antcall target="build_all" >
>             <param name="chosenTarget" value="debug"/>
>         </antcall>
>     </target>
> 
>     <target name="jar">
>         <antcall target="build_all" >
>             <param name="chosenTarget" value="jar"/>
>         </antcall>
>     </target>
> 
>     <target name="unit_test">
>         <antcall target="build_all" >
>             <param name="chosenTarget" value="unit_test"/>
>         </antcall>
>     </target>
> 
>     <!-- build the core and all of the plugins -->
>     <target name="build_all">
>         <ant antfile="build.xml" dir="core" target="${chosenTarget}"
> inheritRefs="true"/>
>         <ant antfile="build.xml" dir="servers" target="${chosenTarget}"
> inheritRefs="true"/>
>         <ant antfile="build.xml" dir="plugins" target="${chosenTarget}"
> inheritRefs="true"/>
>     </target>
> </project>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message