geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r627661 - in /geronimo/server/branches/2.1: assemblies/geronimo-framework/ assemblies/geronimo-jetty6-javaee5/ assemblies/geronimo-tomcat6-javaee5/ buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/...
Date Thu, 14 Feb 2008 04:42:04 GMT
Author: gawor
Date: Wed Feb 13 20:42:02 2008
New Revision: 627661

URL: http://svn.apache.org/viewvc?rev=627661&view=rev
Log:
Add support for excludes to ArchiverGBean and car-maven-plugin. Also add META-INF/** excludes
to the different assemblies (GERONIMO-3847)

Modified:
    geronimo/server/branches/2.1/assemblies/geronimo-framework/pom.xml
    geronimo/server/branches/2.1/assemblies/geronimo-jetty6-javaee5/pom.xml
    geronimo/server/branches/2.1/assemblies/geronimo-tomcat6-javaee5/pom.xml
    geronimo/server/branches/2.1/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveMojo.java
    geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java

Modified: geronimo/server/branches/2.1/assemblies/geronimo-framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-framework/pom.xml?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/assemblies/geronimo-framework/pom.xml (original)
+++ geronimo/server/branches/2.1/assemblies/geronimo-framework/pom.xml Wed Feb 13 20:42:02
2008
@@ -221,6 +221,11 @@
                         <goals>
                             <goal>archive</goal>
                         </goals>
+                        <configuration>
+                            <excludes>
+                               <exclude>META-INF/**</exclude>
+                            </excludes>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Modified: geronimo/server/branches/2.1/assemblies/geronimo-jetty6-javaee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-jetty6-javaee5/pom.xml?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/assemblies/geronimo-jetty6-javaee5/pom.xml (original)
+++ geronimo/server/branches/2.1/assemblies/geronimo-jetty6-javaee5/pom.xml Wed Feb 13 20:42:02
2008
@@ -662,6 +662,11 @@
                         <goals>
                             <goal>archive</goal>
                         </goals>
+                        <configuration>
+                            <excludes>
+                               <exclude>META-INF/**</exclude>
+                            </excludes>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Modified: geronimo/server/branches/2.1/assemblies/geronimo-tomcat6-javaee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-tomcat6-javaee5/pom.xml?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/assemblies/geronimo-tomcat6-javaee5/pom.xml (original)
+++ geronimo/server/branches/2.1/assemblies/geronimo-tomcat6-javaee5/pom.xml Wed Feb 13 20:42:02
2008
@@ -663,6 +663,11 @@
                         <goals>
                             <goal>archive</goal>
                         </goals>
+                        <configuration>
+                            <excludes>
+                               <exclude>META-INF/**</exclude>
+                            </excludes>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

Modified: geronimo/server/branches/2.1/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveMojo.java?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveMojo.java
(original)
+++ geronimo/server/branches/2.1/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveMojo.java
Wed Feb 13 20:42:02 2008
@@ -72,10 +72,22 @@
      * @required
      */
     private File targetServerDirectory;
+    
+    /**
+     * Files to exclude from the archive
+     *
+     * @parameter
+     */
+    private String[] excludes;
 
     protected void doExecute() throws Exception {
         ServerInfo serverInfo = new BasicServerInfo(targetServerDirectory.getAbsolutePath(),
false);
         ArchiverGBean archiver = new ArchiverGBean(serverInfo);
+        if (excludes != null) {
+            for (String exclude : excludes) {
+                archiver.addExclude(exclude);
+            }
+        }
         archive("tar.gz", archiver);
         archive("zip", archiver);
     }

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
Wed Feb 13 20:42:02 2008
@@ -28,6 +28,7 @@
 import java.net.URL;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -239,6 +240,29 @@
         }
     }
 
+    public static Map<String, File> find(File root, String pattern) {
+        Map<String, File> matches = new HashMap<String, File>();
+        find(root, pattern, matches);
+        return matches;
+    }
+    
+    public static void find(File root, String pattern, Map<String, File> matches) {
  
+        if (!SelectorUtils.hasWildcards(pattern)) {
+            File match = new File(root, pattern);
+            if (match.exists() && match.canRead()) {
+                matches.put(pattern, match);
+            }
+        } else {
+            Map<String, File> files = IOUtil.listAllFileNames(root);
+            for (Map.Entry<String, File> entry : files.entrySet()) {
+                String fileName = entry.getKey();
+                if (SelectorUtils.matchPath(pattern, fileName)) {
+                    matches.put(fileName, entry.getValue());
+                }
+            }
+        }
+    }
+    
     public static Set<URL> search(File root, String pattern) throws MalformedURLException
{
         if (root.isDirectory()) {
             if (pattern == null || pattern.length() == 0) {

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java?rev=627661&r1=627660&r2=627661&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/ArchiverGBean.java
Wed Feb 13 20:42:02 2008
@@ -22,6 +22,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -45,11 +48,31 @@
 
     private final ServerInfo serverInfo;
 
+    private List<String> excludes = new ArrayList<String>();
 
     public ArchiverGBean(ServerInfo serverInfo) {
         this.serverInfo = serverInfo;
     }
 
+    public void addExclude(String pattern) {
+        this.excludes.add(pattern);
+    }
+    
+    public void removeExclude(String pattern) {
+        this.excludes.remove(pattern);
+    }
+    
+    private void removeExcludes(File source, Map<String, File> all) {
+        Map<String, File> matches = new HashMap<String, File>();
+        for (String exclude : this.excludes) {
+            IOUtil.find(source, exclude, matches);
+        }
+
+        for (String exclude : matches.keySet()) {
+            all.remove(exclude);
+        }
+    }
+        
     public File archive(String sourcePath, String destPath, Artifact artifact) throws ArchiverException,
IOException {
         File source = serverInfo.resolve(sourcePath);
         File dest = serverInfo.resolve(destPath);
@@ -79,6 +102,7 @@
         
         // add in all files and mark them with default file permissions
         Map<String, File> all = IOUtil.listAllFileNames(source);
+        removeExcludes(source, all);
         for (Map.Entry<String, File> entry : all.entrySet()) {
             String destFileName = serverName + "/" + entry.getKey();
             File sourceFile = entry.getValue();



Mime
View raw message