ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arseny <spanishguitar2...@gmail.com>
Subject Applying ParallelTask
Date Tue, 06 Nov 2007 07:37:34 GMT
Hello!
After moving our Ant server to Intel Core Quadro I decided to make our 
ant build in parallel.
I studied the ParallelTask in ant, but found the following problem in 
applying it to our project.
The project consists of a hundred separate modules (jars) and its 
build.xml is
made in terms of targets. I mean, it is like:
<target name="rebuild_all" depends "ModuleA, ModuleB, ModuleC"/>

<target name="ModuleA" depends="">
   <ant dir="ModuleA_dir" antfile="build.xml" target="rebuild"/>
 </target>

<target name="ModuleB" depends="ModuleA">
   <ant dir="ModuleB_dir" antfile="build.xml" target="rebuild"/>
 </target>

<target name="ModuleC" depends="ModuleA">
   <ant dir="ModuleC_dir" antfile="build.xml" target="rebuild"/>
 </target>
...

I found two ways in making this tasks run in parallel:
1.
<target name="rebuild_all" depends "ModuleA, ModulesParallel"/>

<target name="ModuleA" depends="">
   <ant dir="ModuleA_dir" antfile="build.xml" target="rebuild"/>
 </target>

<target name="ModulesParallel" depends="ModuleA">
    <parallel>
      <ant dir="ModuleB_dir" antfile="build.xml" target="rebuild"/>
      <ant dir="ModuleC_dir" antfile="build.xml" target="rebuild"/>
    </parallel>
 </target>

The problems with the first way are:
1) We lose information on dependencies between certain modules (now I do not
know which of the modules: ModuleB or ModuleC (or both) depends on ModuleA)
2) Difficult to separate in parallel parts all of the numerous tasks

2.
<target name="rebuild_all" depends "Modules"/>

 <target name="Modules" depends="">
    <parallel>
      <antcall target="ModuleA"/>
      <antcall target="ModuleB"/>
      <antcall target="ModuleC"/>
   </targe>

<target name="ModuleA" depends="">
   <ant dir="ModuleA_dir" antfile="build.xml" target="rebuild"/>
 </target>

<target name="ModuleB" depends="ModuleA">
   <ant dir="ModuleB_dir" antfile="build.xml" target="rebuild"/>
 </target>

<target name="ModuleC" depends="">
   <ant dir="ModuleC_dir" antfile="build.xml" target="rebuild"/>
 </target>

The problem with the second variant is that it simply does not work:(
As I see, it has racing conditions when several threads start to rebuild 
the same task, that
results in losing ability to make directories, rebuild jars...

If you have any ideas on how to solve this problem, any help would be 
appreciated!
Thanks for reading my message!

Arseniy.



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


Mime
View raw message