ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Enforcing "depends" order for 3rd-party targets?
Date Fri, 22 Aug 2008 10:39:28 GMT
Alexey Solofnenko wrote:
> I had to update a lot my build scripts in order for them to run in 
> parallel mode with my own parallel executor. The usual problem was a 
> missing dependency. Out of normal order execution breaks in random 
> places and without careful review of all targets, it is difficult to fix 
> all of them. I was thinking about external  target order too, but the 
> ordering logic became too complex when there are several targets setting 
> different orders on other targets. For example, clean build could be 
> "clean;build", meaning first run "clean" and later "build". 
> Unfortunately usually "clean" and "build" targets depend on other 
> targets, so the rule should be translated into
> 
> {depends(clean) ^ depends(build)} -> {depends(clean) - (depends(clean) ^ 
> depends(build))} -> {depends(build) - (depends(clean) ^ depends(build))}"
> 
> This effectively means that all targets in {depends(clean) - 
> (depends(clean) ^ depends(build))} should depend on all targets in 
> {depends(clean) ^ depends(build)}.... And it is assuming that none of 
> the other targets impose other ordering rules. However it is an 
> important feature that is required for a real parallel executor. If you 
> know a solution, please let me know.
> 
> - Alexey.
> 

the trouble with before() targets (and target injection) is what if 
those targets also have dependencies, life gets very complex.

This is what I do

* Have a base template project with lots of predefined targets that do 
nothing (initialized, compile, packaged, tested, published. These 
represent 'states' I want the project to be in.

* Have 'ready-to-X' targets for everything that is needed to prepare 
before doing the work to enter a state.
In by default, "ready-to-compile" depends on "create-output-dirs". In a 
project that does some code generation, the extended project would have

<target name="ready-to-compile" 
depends="base.ready-to-compile,generate-java-code" />

So I'm effectively adding a 'before' to the compile target by adding it 
in to its 'ready-to' predecessor.

One thing I'd like is a way to declare a dependency on all the targets 
of another target, but not its work itself. If compile does a  javac, 
but on one project I don't want that, I can't go

<target name="compile" depends="dependencies(base.compile)" />



-- 
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


Mime
View raw message