ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garrick Olson <Garrick.Ol...@Aceva.com>
Subject RE: suggestions
Date Thu, 20 Sep 2001 21:11:45 GMT

> > > 2) something that calls one or more targets AFTER a target has
> > > completed.  for example, in my init target, i often have properties
that
> > > i need to conditionally set, and currently the only way to easily do
> > > that is multiple targets with 'if' attributes.  but, i would still
want
> > > to ensure that the init is completed first, while still ensuring that
> > > the other conditional-inits are completed immediately following the
init
> > > target.
> > 
> > Maybe I'm just not fully awake yet this morning, but -- you lost me. The
> > only I know of to start another target before the first one is done is
to
> > include an <antcall>/<ant> in it, then have additional tasks after that.
> > Eg:
> >   <target name="foo">
> >     <echo message="I'm foo..."/>
> >     <antcall target="bar"/>
> >     <echo message="I'm foo again."/>
> >   </target>
> >   <target name="bar">
> >     <echo message="I'm bar..."/>
> >   </target>
> 
> well, considering all the other problems with variables i've been having
> when using antcall, i was looking for some other solution.  so, i would
> have:
> 
> <target name="foo" depends="before" after="bar">
> ...
> </target>
> 
> so, when this target is invoked, the 'before' target will be invoked
> first, then the 'foo' target is invoked, and then finally (assuming no
> failures) the 'bar' target is invoked.
> 
> this preserves the 'nature' of calling subtargets, and presuming props
> are handled in the same way in the 'after' attribute as they are in the
> 'depends' attribute, the unique behaviour of ant and antcall can be
> ignored.

I have a similar situation with running multiple sets of tests.  Assume I
have the following targets:

<target name="init.tests">
    ...delete and re-create ${testresults.dir}...
</target>

<target name="test.report">
    ...generate report for all test results...
</target>

I want to be able to call some.tests, other.tests, or all.tests from the
command line and get a test report containing whichever tests executed.  You
cannot use <antcall> within the some.tests and other.tests targets, because
then if you call the all.tests target, the test.report target will be called
twice, with the second call squashing the first call's results.  Here is
what I do:

<target name="some.tests" depends="internal.some.tests, test.report">
<target name="internal.some.tests" depends="init.tests">
...
</target>

<target name="other.tests" depends="internal.other.tests, test.report">
<target name="internal.other.tests" depends="init.tests">
...
</target>

<target name="all.tests" depends="internal.some.tests, internal.other.tests,
test.report" />

I think it would be much more elegant if there were an "after" or
"postdepends" so I could instead write:

<target name="some.tests" depends="init.tests" postdepends="test.report">
...
</target>

<target name="other.tests" depends="init.tests" postdepends="test.report">
...
</target>

<target name="all.tests" depends="some.tests, other.tests" />

Note that the behavior here is *not* to simply execute another target
immediately (as an <antcall> would do).  When I call all.tests, the target
order should be:

init.tests
some.tests
other.tests
test.report   (note: executed only once, and immediately after the last
target to have a postdepends="test.report")
all.tests



Confidential Information. This email is for intended recipient only.




Mime
View raw message