harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r786006 - in /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200: Archive.java PackingOptions.java
Date Thu, 18 Jun 2009 10:22:56 GMT
Author: sjanuary
Date: Thu Jun 18 10:22:54 2009
New Revision: 786006

URL: http://svn.apache.org/viewvc?rev=786006&view=rev
Log:
Pack200 - add support for passing files (-p option)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=786006&r1=786005&r2=786006&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
Thu Jun 18 10:22:54 2009
@@ -249,7 +249,7 @@
         if (read != size) {
             throw new RuntimeException("Error reading from stream");
         }
-        if (name.endsWith(".class")) {
+        if (name.endsWith(".class") && !options.isPassFile(name)) {
             Pack200ClassReader classParser = new Pack200ClassReader(bytes);
             classParser.setFileName(name);
             javaClasses.add(classParser);

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java?rev=786006&r1=786005&r2=786006&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
Thu Jun 18 10:22:54 2009
@@ -135,8 +135,25 @@
         this.modificationTime = modificationTime;
     }
 
-    public List getPassFiles() {
-        return passFiles;
+    public boolean isPassFile(String passFileName) {
+        if (passFiles != null) {
+            for (Iterator iterator = passFiles.iterator(); iterator.hasNext();) {
+                String pass = (String) iterator.next();
+                if (passFileName.equals(pass)) {
+                    return true;
+                } else if (!pass.endsWith(".class")) { // a whole directory is
+                    // passed
+                    if (!pass.endsWith("/")) {
+                        // Make sure we don't get any false positives (e.g.
+                        // exclude "org/apache/harmony/pack" should not match
+                        // files under "org/apache/harmony/pack200/")
+                        pass = pass + "/";
+                    }
+                    return passFileName.startsWith(pass);
+                }
+            }
+        }
+        return false;
     }
 
     /**
@@ -150,6 +167,7 @@
         if(passFiles == null) {
             passFiles = new ArrayList();
         }
+        passFileName.replaceAll(System.getProperty("file.separator"), "/");
         passFiles.add(passFileName);
     }
 



Mime
View raw message