ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: 3 optional tasks ? (new to the list)
Date Tue, 22 May 2001 06:52:36 GMT
Olivier Brand <olivier@intraware.com> wrote:

> I am new to the list. I have created 3 tasks and was wondering what
> was the process of adding these tasks into ant (if everybody agrees
> of course that these tasks are useful).

Send them to the list and lobby for their inclusion - may take some
time to get heard 8-)

> The first task allows to generate an XML Java binding framework
> using Castor from exolab (www.exolab.org).

This sounds as if it should be included with Castor, not with Ant -
with a link from <http://jakarta.apache.org/ant/external.html> of
course.

> The second task can be added to the already existing Perforce
> package: P4Add. This allows to add a file to a Perforce depot (we
> needed this feature in our project).

This one probably has a really good chance of being included if it
fits into the P4 classes already present.

> The third task is a conditional task on targets, it allows to
> express conditions like: if/then/else on targets.  For example using
> Perforce, we wanted to add a file in our depot. If the file does not
> exist, we need to add it (P4Add). Otherwise we need to edit it
> (P4Edit).  This task allows to do that : if targetA fails then
> execute targetB else execute targetC. Of course the test can be
> changed (it is a parameter: true or false).

I don't think this would find too many friends among the committers.
How do you know whether a target fails?

The normal Ant way would be a combination of available and a couple of
targets, something like

<target name="check">
  <available file="${file.to.check}" property="exists" />
</target>

<target name="add" depends="check" unless="exists">
  <p4add ...>
</target>

<target name="edit" depends="check" if="exists">
  <p4edit ...>
</target>

<target name="add-or-edit" depends="add,edit" />

and then use them via something like

<antcall target="add-or-edit">
  <param name="file.to.check" location="your-file-name-here" />
</antcall>

Stefan

Mime
View raw message