ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 29011] - Enhance the <copy/>-tag to support filesets for both source *and* destination
Date Mon, 17 May 2004 12:52:26 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29011>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29011

Enhance the <copy/>-tag to support filesets for both source *and* destination





------- Additional Comments From jan@materne.de  2004-05-17 12:52 -------
I had written a template for my own:

<project name="common-define-treecopy">
    <scriptdef name="treecopy" language="javascript">
        <element name="src"  type="fileset"/>
        <element name="dest" type="dirset"/>
        <![CDATA[
            // use 'copy' task for doing the real work
            copy = project.createTask("copy");

            // for logging purposes ...
            copy.setTaskName("treecopy");

            // add all source filesets
            srcFilesets = elements.get("src");
            for (i=0; i<srcFilesets.size(); i++) {
                copy.addFileset(srcFilesets.get(i));
            }

            // now do the work for each destination directory
            for (i=0; i<elements.get("dest").size(); i++) {
                dirset = elements.get("dest").get(i);
                dirscanner = dirset.getDirectoryScanner(project);
                dirs = dirscanner.getIncludedDirectories();
                for (j=0; j<dirs.length; j++) {
                    todir = new java.io.File(dirscanner.getBasedir(), dirs[j]);
                    copy.setTodir(todir);
                    copy.perform();
                }
            }
        ]]>
    </scriptdef>
</project>


Just <import> it and use it nearly as your example:

<treecopy>
  <src dir=".">
    <include name="${copyfilename.file}"/>
  </src>
  <dest dir=".">
    <include name="*"/>
  </dest>
</copy>

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


Mime
View raw message