ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lopez, William" <>
Subject Depend task question
Date Mon, 12 May 2003 23:19:55 GMT
First, let me apologize for a long e-mail...I'm having difficulty
comprehending the depend task.

This is the scenario:

I have multiple projects (source and class directories) that I want to
include in the depend task because there are cycles (circular references)
amongst the projects. For example:
  DirA (contains more than 1 package) 
  DirB (contains more than 1 package)
  DirC (contains more than 1 package)
  DirD ...  

DirA.package2.class1 extends DirA.package1.class1
DirB.package1.class1 uses DirA.package2.class1
DirC.package1.class1 uses DirB.package1.class1
...something to that effect

I want to include all the classes in these projects in the depend task so
that all the classes related would be deleted and forced to recompile...I
set the 'closure="yes"' to allow indirect relationships. Each source
directory (project) has a corresponding class the project
hierarchy looks like this (there are more dirs than depicted):

   |  |
   |  |_DirA
   |  |
   |  |_DirB
   |  |
   |  |_DirC
   |  |
   |  |_DirD
   |  |
   |  |_DirA
   |  |
   |  |_DirB
   |  |
   |  |_DirC
   |  |
   |  |_DirD
   |...other directories

...the Ant doco states the following about the classpath nested element:
The classpath attribute for <depend> is optional. If it is present, depend
will check class dependencies against classes and jars on this classpath.
Any classes which depend on an element from this classpath and which are
older than that element will be deleted. I figured the following could be done:

      <path id="all-BO-classes">
	    <fileset dir="${}\DirA" includes="**\*.class" /> 
          <fileset dir="${}\DirA${Entity}" includes="**\*.class"
          <fileset dir="${}\DirB" includes="**\*.class" />
          <fileset dir="${}\DirC${Entity}" includes="**\*.class"
          <fileset dir=... />

...then use that path in the task:

    <target name="synchBODirs">
      <depend srcdir="${src.base}" destdir="${}"
              cache="depcache" closure="yes">
        <include name="**/*.java"/>
        <classpath refid="all-BO-classes"/>
   </target> is where things get muddy for me. 

The srcdir points to the source_dir and destdir to the class_dir in the
hierarchy. The problem I see is that the srcdir points to the
top_dir/source_dir (which includes 15 other directories/projects) and the
destdir points to the class output directories I want which contains 6
directories...the path element defined has a matching directory in the
destdir- one-to-one. My main question is how do I get the scrdir to only
have the 6 directories of source files to match the six in the destdir so no
extraneous classes are added to the dependency charting? 

One note, The project hierarchy cannot be changed because that is the way it
is in PVCS and in WSAD...we used to do the compilation via WSAD but that was
too cumbersome and error prone. I hope this was not too convoluted. All
suggestions are welcome.


View raw message