ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Question about "depends" attribute in the target element
Date Wed, 14 Nov 2007 18:03:35 GMT

--- Steve Loughran <stevel@apache.org> wrote:

> David Weintraub wrote:
> > If you invoke multiple targets on the command
> line, each target will
> > execute, and dependencies will execute
> independently. There is no way
> > of Ant to know if one of the targets you put on
> the command line might
> > affect a later target. For example:
> > 
> > $ ant first clean_first second
> > 
> > If Ant kept track of targets already executed, it
> would be messed up
> > by the "clean_first" target. Target "second"
> depends upon "first", but
> > "clean_first" destroyed what files "first" had
> built. That's why each
> > target will execute all of its dependencies.
> > 
> > However, this works fine:
> > 
> > <project name="test">
> > <target name="first"/>
> > <target name="second" depends="first"/>
> > <target name="third" depends="first,second"/>
> > </project>
> > 
> > Executing:
> > 
> > $ ant third
> > [first]
> > [second]
> > [third]
> > 
> > Executes target "first" only a single time
> 
> There is actually a way to maybe get Ant to resolve
> dependencies across 
> targets on the command line, but it isnt exposed to
> the end user. Inside 
> ant there are these things called Executors that
> decide which targets to 
> run next. The normal executor runs everything on the
> command line. If 
> you go -keepgoing, a new executor runs targets that
> dont depend on 
> targets that have failed; it 'keeps going' as well
> as it can. You could 
> probably add a new executor that took intra-target
> dependencies into 
> account, and switch to it using whichever magic
> property identifies the 
> new executor. This is pretty low level though; I
> don't know anyone who 
> has done this.
> 

This sounds suspiciously like the single-check
executor that runs command-line targets as if they
were all dependencies of another target, similar to
the example the user specified:

ant
-Dant.executor.class=org.apache.tools.ant.helper.SingleCheckExecutor
foo bar

HTH,
Matt

> -- 
> Steve Loughran                 
> http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



      ____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 

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


Mime
View raw message