ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean Morissette <jean.morissette...@videotron.ca>
Subject Re: AW: AW: Write Ant files for many modules
Date Tue, 14 Dec 2004 03:57:13 GMT
Jan.Materne@rzf.fin-nrw.de wrote:
> Provide a <target> for each module and uses "depend"-attributes,
> so Ant can handle the dependency managing of the "targets" (here
> your modules) for you.

Let me describe my repository structure:

seda/
  +---adisk/
  |      +---build.xml
  |
  +---asocket/
  |       +---build.xml
  |
  +---atls/
  |      +---build.xml
  |
  +---gnutella/
  |     +---build.xml
  |
  +---haboob/
  |      +---build.xml
  |
  +---http/
  |      +---build.xml
  |
  +---sandstorm/
  |      +---build.xml
  |
  +---util/
  |      +---build.xml
  |
  +---share.xml


So, I have 8 modules.  Each module have its own build.xml.  Here is an 
exemple of the build.xml file of module 'adisk':

   <project name="adisk" default="jar">
     <path id="compile-classpath">
       <pathelement
           location="../sandstorm/build/lib/module-sandstorm.jar"/>
     </path>
     <import file="../share.xml"/>
   </project>


And here is share.xml:

<project name="share">

   <target name="set-properties">
     <property name="target" location="build"/>
     <property name="src" location="src"/>
     <property name="jar.name" value="module-${ant.project.name}.jar"/>
   </target>

   <target name="setup" depends="set-properties">
     <mkdir dir="${target}/classes"/>
     <mkdir dir="${target}/lib"/>
   </target>

   <target name="compile" depends="setup"
		description="Compile Java source files">
     <javac srcdir="${src}" destdir="${target}/classes">
       <classpath refid="compile-classpath"/>
     </javac>
   </target>

   <target name="jar" depends="compile"
           description="Build jar file">
     <jar destfile="${target}/lib/${jar.name}"
          basedir="${target}/classes"/>
   </target>

   <target name="clean" depends="set-properties"
     description="Clean generated files">
     <delete dir="${target}"/>
   </target>

</project>

I like that each module "import" share.xml, so it help to keep build.xml 
very short.

But, actually, to compile 'haboob' module, we need to execute the target 
'jar' for each module to which 'haboob' is dependent!  I want to handle 
module dependencies without executing the targets in a specific order.

I am a newbie with Ant, so could you explain to me how I can achieve 
that?  You have suggested that I write a target for each module and 
specify the module dependencies in the 'depend' attribute.  But, where 
should I write these targets?  In a master build file?  Maybe something 
like:

in master.xml

   <target name="adisk" depends="sandstorm" />
   <target name="asocket" depends="sandstorm" />
   <target name="atls" depends="asocket" />
   <target name="gnutella" depends="asocket" />
   <target name="haboob" depends="atls, http, gnutella" />
   <target name="http" depends="asocket" />
   <target name="sandstorm" depends="util" />
   <target name="util" depends="" />

But what to do after?  Sorry, I don't understand your idea.  Could you 
explain more please?

Thanks,
Jean






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


Mime
View raw message