ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lopez, William" <william.lo...@eds.com>
Subject RE: Depend task question
Date Tue, 13 May 2003 03:37:15 GMT
I *think* I figured it out...I just added multiple include elements:

<target name="synchBODirs">
    <depend srcdir="${src.base}" destdir="${bo.build.dir}"
            cache="dep/bodepcache" closure="yes">
      <include name="BatchJobs/**/*.java"/>
      <include name="BillReview/**/*.java"/>
      <include name="BillReivewAIG/**/*.java"/>
      <include name="BillReviewSD/**/*.java"/>
      <include name="Reference/**/*.java"/>
      <include name="RulesEngine/**/*.java"/>
      <include name="Vap/**/*.java"/>
      <classpath>
        <fileset dir="${bo.build.dir}">
          <include name="**/*.class"/>
        </fileset>
      </classpath>
    </depend>
</target>

The target is still running...log file has just grown expontentially...if
anyone is interested mail me back...I'll let you know what the result was.

-Will
-----Original Message-----
From: Lopez, William [mailto:william.lopez@eds.com] 
Sent: Monday, May 12, 2003 6:20 PM
To: user@ant.apache.org
Subject: Depend task question


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 directory...so the project
hierarchy looks like this (there are more dirs than depicted):

  top_dir
   |
   |_source_dir
   |  |
   |  |_DirA
   |  |
   |  |_DirB
   |  |
   |  |_DirC
   |  |
   |  |_DirD
   |
   |_class_dir
   |  |
   |  |_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. 

...so I figured the following could be done:

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

...then use that path in the task:

    <target name="synchBODirs">
      <depend srcdir="${src.base}" destdir="${bo.build.dir}"
              cache="depcache" closure="yes">
        <include name="**/*.java"/>
        <classpath refid="all-BO-classes"/>
      </depend>
   </target>

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

Thanks,
-Will

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

Mime
View raw message