ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Copying based on fileset
Date Thu, 17 Jul 2003 05:30:17 GMT
There is a <different> selector which can help:
- patched files are different from their unpatched version

So copy all source files into a new directory and patch the files.
Then you can move the patched files (using the <different> selector
and comparing the tmp-directory and the original dir) into a new one.
Then delete the tmp-dir.

Compiling and JARing should be more easily. But you have to ensure
correct classpaths ...



Another possibility would be writing a new selector: parameterized with
a "compare-directory". Select a file, if a file with the same relative path
exists in the compare-directory:
<fileset dir="${src}">
    <xSelector compdir="${comp}"/>
</fileset>
with files
  ${src}/org/apache/tools/ant/Ant.java
  ${src}/org/apache/tools/ant/taskdefs/Echo.java
  ${comp}/org/apache/tools/ant/taskdefs/Echo.java  <--- same name, but patch
file
the Echo.java would be selected.
You can do some name mapping, too (it´s your own selector :-):
*.patch-->*.java



Jan





> -----Original Message-----
> From: Kyle Adams [mailto:kadams@gfs.com]
> Sent: Wednesday, July 16, 2003 2:45 PM
> To: user@ant.apache.org
> Subject: RE: Copying based on fileset
> 
> 
> Hmm... I need to explain better :-)
> 
> *.java.patch are the diff files, not the patched java source 
> code.  So I have a directory with these diff files, which are 
> intentionally named to match up with the files they need to 
> be applied to.
> 
> Then I have the source directory of the third-party project 
> I'm patching, which has several hundred files, and I only 
> want to pull out the ones that need to be patched.
> 
> Then the build script needs to apply the patches, re-compile 
> the patched files, and produce a patched jar.  The patched 
> jar, in turn, will be placed on the classpath before the original jar.
> 
> Everything else should be fairly easy - it's just figuring 
> out the best way to pull the source files that need to be 
> patched from the third party's source directory.  Right now 
> I'm using an includesfile, which needs to be manually updated.
> 
> Here's what I currently have:
> 
> <copy todir="${build.dir}/patch" flatten="true" 
> includeEmptyDirs="false">
>     <fileset dir="${diffs.dir}"/>
> </copy>
> <copy todir="${build.dir}/patch" flatten="true" 
> includeEmptyDirs="false">
>     <fileset dir="${thirdParty.dev.dir}/src" 
> includesfile="${patchfile}"/>
> </copy>
> 
> Kyle
> 
> > Doesn t that work?
> > 
> > <!-- all 'maybe-old' files -->
> > <copy todir="${new.dir}">
> >    <fileset dir="${src.dir}" />
> > </copy>
> > 
> > <!-- all patches -->
> > <copy todir="${new.dir}">
> >     <fileset dir="${patch.dir}">
> >     <mapper type="glob" from="*.java.patch" to="*.java"/>
> > </copy>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message