ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duffey, Kevin" <>
Subject RE: Conditional use?
Date Wed, 03 Jan 2001 02:17:49 GMT
I'll put a subset of the build file

<?xml version="1.0"?>

<project name="xxx" default="compile" basedir=".">

  <property name="home" value="."/>
  <property name="src.dir" value="source/code-540"/>
  <property name="javadoc.dir" value="docs/api"/>
  <property name="base.dir" value="live-www/WEB-INF"/>
  <property name="build.dir" value="${base.dir}/classes"/>
  <property name="lib.dir" value="${base.dir}/lib"/>
  <property name="deploy.dir" value="z:"/>
  <property name="j2ee.lib.dir" value="${home}/../orion" />
  <property name="admin.dir" value="admin-www/WEB-INF/classes"/>

  <!-- Creates build dir if it does not exist -->
  <target name="prepare">
    <mkdir dir="${build.dir}"/>

  <!-- Compiles the source code -->
  <target name="compile" depends="prepare">
    <javac srcdir="${src.dir}"
    <copy todir="${admin.dir}">
      <fileset dir="${build.dir}"/>

  <target name="deploy" depends="compile">
    <copy todir="${deploy.dir}">
      <fileset dir="${build.dir}"/>

What I would like to see happen is if its possible to "ignore" the copying
of the files if the build resulted in NO files being compiled. Also, I would
like to know if the build failed, to be able to send out an email explaining

Something like:

if( build == ok )
  send email
  copy files
  send email about bad build (or no build)

> At 05:49  2/1/01 -0800, Duffey, Kevin wrote:
> >Hi,
> >
> >Is it possible in a build file to specify conditional 
> capabilities? For
> >example, I want to get the latest source from VSS, then do a 
> build. If there
> >is no difference in the build compared to the current files 
> on the disk,
> >then the rest of the build is terminated. The reason is, if ANY files
> >changed, I want the build to send out an email notifying 
> individuals that a
> >build is ready for testing. But if nothing changed, then I 
> don't want it to
> >do anything else..there is no reason to notify anyone, and 
> no reason to
> >deploy the build to x number of machines. Only if an actual 
> build took
> >place. Even better..I would like to copy only the files that 
> have changed
> >(for speed) so that it doesn't need to copy the whole set of compiled
> >classes, www pages, etc. It seems to me that the "last" 
> target doesn't
> >follow this rule. I don't know why, maybe its just me, but I 
> have a build
> >script with 4 targets. The first 3 targets work as 
> expected..if a file is
> >the same, it doesn't compile it, or copy it, or what ever. 
> The last target,
> >which is a "copy" command to copy a dir from one place to 
> another, should
> >only copy the files that are changed, but it seems to copy 
> the whole dir,
> >despite that most of the files are the same.
> Could you send the build file to the list ;)
> Cheers,
> Pete
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof."                   |
> |              - John Kenneth Galbraith               |
> *-----------------------------------------------------*

View raw message