Good idea!  The change to the replicator task is rather simple - just
the addition of a flatten setter and the propagation of this to the
underlying copy operation.  

Patch attached.

Cheers, Steve.


> -----Original Message-----
> From: Cameron Taggart [mailto:[EMAIL PROTECTED]
> Sent: 23 September 2004 19:23
> To: Avalon framework users
> Subject: Re: Magic updates
> 
> I have a small feature request for Magic.  I often need to copy the
> jars needed for runtime like so:
> 
>     <x:path id="build.path"/>
>     <x:replicate refid="build.path" todir="target/war"/>
>     <copy todir="target/war" flatten="true">
>       <fileset dir="target/war" includes="**/*.jar"/>
>     </copy>
> 
> It would be nice if replicate task had a flatten="true" option so I
> didn't have to replicate and then do a copy.
> 
> Cameron
> 
> 
> 
> 
> On Thu, 16 Sep 2004 00:23:00 +0800, Niclas Hedhman
<[EMAIL PROTECTED]>
> wrote:
> >
> > Boys and gals,
> >
> > We have been re-thinking the Magic strategy. The standard.xml
doesn't
> declare
> > <x:home/> and that is done in the build.xml instead. By doing this,
we
> don't
> > need any hardcoded properties passed from the build.properties to
Magic.
> >
> > Furthermore, it makes things more explicit and understandable, and
would
> allow
> > us to do even more in the <x:home/> task in the future.
> > The recommended set up of the build.xml is now;
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <project name="facilities" default="default" basedir="."
> >     xmlns:x="antlib:org.apache.avalon.tools">
> >   <property file="build.properties"/>
> >   <x:home />
> >   <import file="${magic.templates}/standard.xml"/>
> > </project>
> >
> > for 'reactor' projects, replace standard.xml with reactor.xml
> >
> > The entire Avalon codebase has been converted to this format, and
the
> > central/system/standard.xml has been killed.
> > The new ${magic.home}/templates/standard.xml (and reactor.xml)
doesn't
> contain
> > a <x:home/> declaration.
> >
> > People who has set up Magic, will need to make some adjustments to
stay
> > in-line with the development of Magic.
> >
> > Cheers
> > Niclas
> > --
> >    +------//-------------------+
> >   / http://www.bali.ac        /
> >  / http://niclas.hedhman.org /
> > +------//-------------------+
> >
> >
---------------------------------------------------------------------
> > 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]
Index: src/main/org/apache/avalon/tools/tasks/ReplicateTask.java
===================================================================
--- src/main/org/apache/avalon/tools/tasks/ReplicateTask.java   (revision 46989)
+++ src/main/org/apache/avalon/tools/tasks/ReplicateTask.java   (working copy)
@@ -43,7 +43,13 @@
     private Path m_path;
     private Context m_context;
     private Home m_home;
+    private boolean m_flatten = false;
 
+    public void setFlatten( boolean flag )
+    {
+        m_flatten = flag;
+    }
+
     public void init()
     {
         if( null == m_context )
@@ -166,6 +172,7 @@
         final Copy copy = (Copy) getProject().createTask( "copy" );
         copy.setTaskName( getTaskName() );
         copy.setPreserveLastModified( true );
+        copy.setFlatten( m_flatten );
         copy.setTodir( destination );
         copy.addFileset( fileset );
         copy.init();

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

Reply via email to