I agree totally, a bit of a hack.

One way to explain my environment is to show the target I've *almost* got
working, to do the same in a hackish manner :).  The only bit on this not
working yet is the last actual copy task.

Thanks Dominique for your help on this.  By hook or crook I'll beat this :).


<!--
7.4     Copy .class files from build area to a patch directory.
        Which .class files are copied is governed by the
        existance of the relative .java file in src patch directory.
-->
  <target name="put.compiled.java.files.patch" unless="jar.required"
depends="">

<!--
7.4.1   Identify changed .java files in patch
-->
    <fileset
dir="${src.root}/${cvspackage}/${patch.name}/${cvspackage}/${java.dir}"
id="src.java.files" >
        <include name="**/*.java"/>
    </fileset>

<!--
7.4.2   Define "from location", and pathconvert, so pathconvert's map
element matches
-->    
    <dirset dir="${src.root}" id="from.location">
        <include
name="${cvspackage}/${patch.name}/${cvspackage}/${java.dir}"/>
    </dirset>
    
    <pathconvert targetos="unix" pathsep="," property="from.location"
refid="from.location" />
    <echo  message="from.location:${from.location}" level="info"/>

<!--
7.4.3   Convert the filelist into a path, and remove location.
-->
    
    <pathconvert targetos="unix" pathsep="," property="src.java.files"
refid="src.java.files">
        <map from="${from.location}" to="" />
    </pathconvert>

<!--
7.4.4   Replace the .java extensions with .class extensions
-->    
    <propertyfile file="changed.source.filelist" comment="">
        <entry  key="changed.source.filelist" value="${src.java.files}"/>
    </propertyfile>
    
    <replace file="changed.source.filelist" value=".class">
          <replacetoken>.java</replacetoken>
    </replace>

    <property file="changed.source.filelist"/>
  
    <echo  message="changed.source.filelist:${changed.source.filelist}"
level="info"/>

<!--
7.4.5   use the new filelist to do the copy
--> 
    <copy
todir="${patch.dir}/${cvspackage}/${patch.name}/${war.dir}/${class.dir}"
includeEmptyDirs="no" preservelastmodified="true" overwrite="true"
verbose="true" >
        <fileset dir="${build.dir}/${java.dir}"
includes="${changed.source.filelist}" />
    </copy>

  </target>


_______________________________
Dan Gardner        Emap IT - UK



>-----Original Message-----
>From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
>Sent: 30 January 2003 19:55
>To: 'Ant Users List'
>Subject: RE: copy,fileset,mapper
>
>
>Maybe... but I feel it's doable in one fell swoop thanks to 
>the power of
>selectors and mappers. You're solution, if I'm right about the 
>above, would
>much more hack'ish (no offense meant ;-). If you could give 
>more info about
>how the files are laid out on disk, what dir to compare 
>against what other
>dir, where the classes are (relative to two previous of dirs), 
>and where
>they should go, then we could all try to solve your problem ;-)
>
>But if I'm wrong, then your solution becomes *the* solution, 
>or you write a
>little task that does it for you. --DD
>
>-----Original Message-----
>From: Dan Gardner [mailto:[EMAIL PROTECTED]] 
>Sent: Thursday, January 30, 2003 1:25 PM
>To: 'Ant Users List'
>Subject: RE: copy,fileset,mapper
>
>I originally thought the mapper would do it, but now I've 
>formed the opinion
>(hopefully wrongly) that the mapper will just change the file 
>name during a
>copy of move routine.
>
>I need to identify a file list.
>Change that filelist.
>Use the changed filelist as the definition of my source files.
>
>I think I can do what I want using 
>1      a pathconvert, with a map element to change the 
>directory location.
>
>2      Then write to a file.
>3      Use the replace task to change the .java to .class
>4      read it back in
>
>_______________________________
>Dan Gardner        Emap IT - UK
>
>
>
>>-----Original Message-----
>>From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
>>Sent: 30 January 2003 19:06
>>To: 'Ant Users List'
>>Subject: RE: copy,fileset,mapper
>>
>>
>>Sounds like a job for something along the lines of:
>>
>><property name="builddir" location="build" />
>><property name="patchsrc" location="source/patch_1" />
>><copy todir="patches/patch-directory">
>>  <fileset dir="${patchsrc}">
>>    <include name="**/*.java" />
>>    <depend targetdir="other source dir" />
>>  </fileset>
>>  <mapper type="regexp" from="${patchsrc}(.*)\.java"
>>                        to="${builddir}\1.class" />
>></copy>
>>
>>but since I'm not sure I followed you, I might be off. --DD
>>
>>-----Original Message-----
>>From: Dan Gardner [mailto:[EMAIL PROTECTED]] 
>>Sent: Thursday, January 30, 2003 12:18 PM
>>To: 'Ant Users List'
>>Subject: copy,fileset,mapper
>>
>>I'm having trouble doing the following.
>>
>>1     Identify a list of changed .java files in a 
>>source/patch-directory.
>>This is a subset of the complete list for the release.
>>2     Use that list to copy the *relevant* resultant .class 
>>files in the
>>build area into a patches/patch-directory.
>>
>>I was hoping I could do the following:
>>
>>1     identify the changed .java files with a fileset [yes]
>>/source/patch_1/com/bla/foo.java
>>/source/patch_1/com/bla/bar.java
>>
>>2     pathconvert the fileset into a property containing the 
>>files as a
>>comma separated list.  Apply a map within the pathconvert to 
>change the
>>directory location from the source directory to the build directory.
>>${filelist}=/build/com/bla/foo.java,/build/com/bla/foo.java
>>
>>3     replace the *.java extension with *.class somehow {shrug}
>>${filelist}=/build/com/bla/foo.class,/build/com/bla/foo.class
>>
>>4     use this as a fileset includes entry to copy the changed .class
>>files into a patch directory.
>>
>>
>>I'm starting to hit a wall on this one.  Any ideas ?
>>cheers
>>dan
>>
>>_______________________________
>>Dan Gardner        Emap IT - UK
>>
>>
>>** For great Emap magazine subscription & gift offers visit
>>http://www.emapmagazines.co.uk **
>>
>>---------------------------------------------------------------
>>-------------
>>----
>>The information in this email is intended only for the 
>>addressee(s) named
>>above.
>>Access to this email by anyone else is unauthorised.
>>If you are not the intended recipient of this message any disclosure,
>>copying, 
>>distribution or any action taken in reliance on it is 
>>prohibited and may be
>>unlawful. 
>>
>>Emap plc and or its subsidiaries do not warrant that any 
>>attachments are
>>free from 
>>viruses or other defects and accept no liability for any 
>>losses resulting
>>from 
>>infected email transmissions.
>>
>>Please note that any views expressed in this email may be those of the
>>originator 
>>and do not necessarily reflect those of this organisation.
>>---------------------------------------------------------------
>>-------------
>>----
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>** For great Emap magazine subscription & gift offers visit
>http://www.emapmagazines.co.uk **
>
>---------------------------------------------------------------
>-------------
>----
>The information in this email is intended only for the 
>addressee(s) named
>above.
>Access to this email by anyone else is unauthorised.
>If you are not the intended recipient of this message any disclosure,
>copying, 
>distribution or any action taken in reliance on it is 
>prohibited and may be
>unlawful. 
>
>Emap plc and or its subsidiaries do not warrant that any 
>attachments are
>free from 
>viruses or other defects and accept no liability for any 
>losses resulting
>from 
>infected email transmissions.
>
>Please note that any views expressed in this email may be those of the
>originator 
>and do not necessarily reflect those of this organisation.
>---------------------------------------------------------------
>-------------
>----
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


** For great Emap magazine subscription & gift offers visit 
http://www.emapmagazines.co.uk **

--------------------------------------------------------------------------------
The information in this email is intended only for the addressee(s) named above.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient of this message any disclosure, copying, 
distribution or any action taken in reliance on it is prohibited and may be unlawful. 

Emap plc and or its subsidiaries do not warrant that any attachments are free from 
viruses or other defects and accept no liability for any losses resulting from 
infected email transmissions.

Please note that any views expressed in this email may be those of the originator 
and do not necessarily reflect those of this organisation.
--------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to