ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <Barrie.Trel...@camtech.com.au>
Subject Re: Example on web page
Date Wed, 26 Jul 2000 07:44:16 GMT
On Tue, 25 Jul 2000, David Walend wrote:

> <project name="foo" default="dist" basedir=".">
> 
>   <!-- set global properties for this build -->
>   <property name="src" value="." />
>   <property name="build" value="build" />
>   <property name="dist"  value="dist" />
> 
>   <target name="init">
>     <!-- Create the time stamp -->
>     <tstamp/>
>   </target>
> 
>   <target name="prepare" depends="init">
>     <!-- Create the build directory structure used by compile -->
>     <mkdir dir="${build}" />
>   </target>
> 
>   <target name="compile" depends="prepare">
>     <!-- Compile the java code from ${src} into ${build}
>        Use filtering to replace @version@ and @year@ marks in the code -->
>     <javac srcdir="${src}" destdir="${build}">
>       <include name="*.java"/>
>     </javac>
>   </target>
> 
>   <target name="dist" depends="compile">
>     <!-- Create the ${dist}/lib directory 
>        put everything in ${build} into the foo${DSTAMP}.jar file-->
>     <mkdir dir="${dist}/lib" />
>     <jar jarfile="${dist}/lib/foo${DSTAMP}.jar" 
>            basedir="${build}">
>       <include name="**" />
>     </jar>
>   </target>
> 
>   <target name="clean">
>     <!-- Delete the ${build} and ${dist} directory trees -->
>     <deltree dir="${build}" />
>     <deltree dir="${dist}" />
>   </target>
> </project>
> 
> -------------------

> I've left things grey. (I like grey.)

Some more comments:
        - grrr, I hate grey :)
        - Change name of project to MyProject or some such besides
          foo.
        - Remove init target and place tstamp into prepare.
        - Remove the comment in compile about use of filtering
        - Remove <include> in javac as this should be done
          automatically. 
        - Remove <include> in jar as this is should be done
          automatically.
        - Add a javadoc target?
          We do this by using the properties:

    <property name="src.dir" value="src" />

    <property name="build.dir" value="build" />
    <property name="build.dir.classes" value="${build.dir}/classes" />
    <property name="build.dir.javadoc" value="${build.dir}/javadoc" />

    <property name="classpath" value="your:classpath:goes:here" />
    <!-- You only need to specify the topmost package as javadoc task
    will create the correct package names for you -->
    <property name="packages" value="com.*" />    


    <target name="javadocs" depends="prepare">
      <mkdir dir="${build.dir.javadoc}" />
      <javadoc packagenames="${packages}"
               sourcepath="${src.dir}"
               destdir="${build.dir.javadoc}"
               classpath="${classpath}"
      </javadoc>
    </target>

Thanks for putting it together.

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Mime
View raw message