You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ro...@apache.org on 2004/11/21 22:15:20 UTC

svn commit: r106118 - /lenya/trunk/src/java/org/apache/lenya/cms/ant/BulkCopyTask.java /lenya/trunk/src/targets/init-build.xml

Author: roku
Date: Sun Nov 21 13:15:19 2004
New Revision: 106118

Added:
   lenya/trunk/src/java/org/apache/lenya/cms/ant/BulkCopyTask.java
Modified:
   lenya/trunk/src/targets/init-build.xml
Log:
- Added generic bulkCopy task. Can also be used for copyJavaSources, but that would require the regexp mapper, which is part of ant optional package.
- Fixes for bug 29553.
- Removed CopyLibraries task.

Added: lenya/trunk/src/java/org/apache/lenya/cms/ant/BulkCopyTask.java
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ant/BulkCopyTask.java?view=auto&rev=106118
==============================================================================
--- (empty file)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ant/BulkCopyTask.java	Sun Nov 21 13:15:19 2004
@@ -0,0 +1,69 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/* $Id: BulkCopyTask.java 106114 2004-11-21 20:54:40Z roku $  */
+
+package org.apache.lenya.cms.ant;
+
+import java.io.File;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * Copies all files matching filename or a all specififed filesets from each source directory.
+ */
+public class BulkCopyTask extends Copy {
+    
+    private Path sourceDirs;
+    private String libDir;
+    
+    /** 
+     * @see org.apache.tools.ant.taskdefs.Copy#execute()
+     */
+    public void execute() throws BuildException {
+                
+        final StringTokenizer sourceDirTokens = new StringTokenizer(sourceDirs.toString(), File.pathSeparator);
+            
+        while (sourceDirTokens.hasMoreTokens()) {
+            final String sourceDir = sourceDirTokens.nextToken();
+            
+            for(int i=0; i<getFileSets().size(); i++)
+                ((FileSet) getFileSets().get(i)).setDir(new File(sourceDir));
+            
+            super.execute();
+        }
+    }
+
+    /**
+     * @param sourceDirs Colon seperated list of source directories
+     */
+    public void setSourceDirs(Path sourceDirs) {
+        this.sourceDirs = sourceDirs;
+    }
+    
+    /**
+     * @return Returns the fileSet.
+     */
+    private List getFileSets() {
+        return super.filesets;
+    }    
+}

Modified: lenya/trunk/src/targets/init-build.xml
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/targets/init-build.xml?view=diff&rev=106118&p1=lenya/trunk/src/targets/init-build.xml&r1=106117&p2=lenya/trunk/src/targets/init-build.xml&r2=106118
==============================================================================
--- lenya/trunk/src/targets/init-build.xml	(original)
+++ lenya/trunk/src/targets/init-build.xml	Sun Nov 21 13:15:19 2004
@@ -72,7 +72,7 @@
            source="1.4"/>
 
     <taskdef name="copyJavaSources" classpath="${build.dir}/tools/anttasks" classname="org.apache.lenya.cms.ant.CopyJavaSourcesTask"/>
-    <taskdef name="copyPubLibraries" classpath="${build.dir}/tools/anttasks" classname="org.apache.lenya.cms.ant.CopyPubLibrariesTask"/>
+    <taskdef name="bulkCopy" classpath="${build.dir}/tools/anttasks" classname="org.apache.lenya.cms.ant.BulkCopyTask"/>
     <taskdef name="copyPubs"        classpath="${build.dir}/tools/anttasks" classname="org.apache.lenya.cms.ant.CopyTask"/>
     <taskdef name="xpatch" classname="XConfToolTask" classpath="${tools.tasks.dest}"/>
   </target>
@@ -201,10 +201,16 @@
       </fileset>
     </copy>
     
+    <!-- FIXME: Use bulkCopy task in the future; needs regexp mapper which is part of ant optional package. -->
     <echo>INFO: Copy java source files from ${pubs.root.dirs} to ${build.src}</echo>
     <copyJavaSources pubsrootdirs="${pubs.root.dirs}" javadir="java/src" builddir="${build.src}" />
     
     <echo>INFO: Copy publication specific libraries from ${pubs.root.dirs} (java/lib) to ${build.webapp}/WEB-INF/lib</echo>
-    <copyPubLibraries pubsrootdirs="${pubs.root.dirs}" libdir="java/lib" builddir="${build.webapp}/WEB-INF/lib" excludes="CVS,.svn"/>
+    <bulkCopy 
+      sourcedirs="${pubs.root.dirs}" 
+      todir="${build.webapp}/WEB-INF/lib" 
+      flatten="true">
+      <fileset includes="*/java/lib/*"/>
+    </bulkCopy>
   </target>
 </project>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org