ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject Can Depend task use includes? Can it grok jars?
Date Fri, 05 Oct 2001 19:30:49 GMT
Howdy, all.

Below is an edited build.xml file.  For some reason, depend is convinced 
that things are out of date when they are most definitely not.  I suspect 
this is because it and I differ on what we think it should be looking at.

First problem: when building the files in the experiment source directory, 
it decides that 77 files are out of date, when there are only 18 source 
files.  This, I would bet, is because it is scanning everything in 
org.metagraph.app.experiment, rather than just the .java files.

Second problem: I believe it is invalidating various java files because it 
cannot find the .class files in the library jar.  Thus, if a library jar 
contains org.metagraph.model.Blog, and ant tries to build 
org.metagraph.app.experiment.Bloguser which uses the Blog class, it will 
not find it in the build directory, because the already compiled class is 
in the jar.

Thus, depend will redo bloguser, claiming that blog is out of date, when in 
actuality, it is just fine, but it is not being found in the jar.

It does not do either of these behaviors if I perform a copy task to move 
the source files into the build directory.  The first, I presume, is 
because I only copy the .java files.  The second works because 
org.metagraph.model is not copied when I am doing this build, so it does 
not expect to find it.

Is there a way to tell depend to use the "included files" as javac would, 
rather than checking everything?

Is there a way to tell it to use classes contained in the jar file when 
determining if something is out of date?  I do not mind it going a bit 
wonky if someone updates the java files that belong in the library jar 
without updating the jar itself, but it seems to me that if up to date 
.class files are in a jar that is in the classpath, it should accept that.

(NB - the copy files method is not ideal, because some of these targets we 
might want to use have enough java files that a copy takes a noticeable 
amount of time and trouble.)

Scott

<project name="experiment" default="dist" basedir=".">
   <property name="basemgdir" value="../../../.."/>
   <property name="src" value="${basemgdir}"/>
   <property name="build" value="ant-build"/>
   <property name="build-debug" value="${build}/debug"/>
   <property name="depcache-debug" value="${build}/debug-depcache"/>
   <property name="libdir" value="${basemgdir}/org/metagraph/lib"/>
   <property name="utilclasspath" 
value="${libdir}/metagraph.jar:${libdir}/log4j.jar"/>
   <property name="dependclasspath" 
value="${libdir}/metagraph.jar:${libdir}/log4j.jar"/>
   <property name="dist"  value="dist"/>
   <property 
name="includedFiles"  value="org/metagraph/app/experiment/*.java"/>
   <property name="excludedFiles"  value=""/>
   <property name="baseJarName"  value="expImport"/>

   <target name="init">
     <!-- Create the time stamp -->
     <tstamp/>
   </target>

   <target name="depend" depends="init">
     <depend srcdir="${src}"
       destdir="${build-debug}"
       cache="${depcache-debug}"
       closure="yes"
     />
   </target>

   <target name="compile-debug" depends="depend">
     <!-- Compile the java code from ${src} into ${build} -->
     <javac
       debug="on"
       optimize="off"
       srcdir="${src}"
       destdir="${build-debug}"
       classpath="${utilclasspath}"
       includes="${includedFiles}"
       excludes="${excludedFiles}"
     />
   </target>

</project>
Scott Ellsworth
scott@alodar.com


Mime
View raw message