You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/04/20 20:26:01 UTC

git commit: [flex-falcon] [refs/heads/develop] - allow wildcards in compc include-files

Repository: flex-falcon
Updated Branches:
  refs/heads/develop 8262f1db4 -> e5977e79d


allow wildcards in compc include-files


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/e5977e79
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e5977e79
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e5977e79

Branch: refs/heads/develop
Commit: e5977e79d226a270cb7ca66c0e6f121384808826
Parents: 8262f1d
Author: Alex Harui <ah...@apache.org>
Authored: Mon Apr 20 11:22:13 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Apr 20 11:22:13 2015 -0700

----------------------------------------------------------------------
 .../flex/compiler/config/Configuration.java     |  7 ++++
 .../compiler/internal/targets/SWCTarget.java    | 42 +++++++++++++++++---
 2 files changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e5977e79/compiler/src/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/config/Configuration.java b/compiler/src/org/apache/flex/compiler/config/Configuration.java
index 8c0d63c..2579362 100644
--- a/compiler/src/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/org/apache/flex/compiler/config/Configuration.java
@@ -4074,6 +4074,13 @@ public class Configuration
                 if (!isAbsolute)
                     processedPath = new File(cv.getContext(), processedPath).getAbsolutePath(); 
             }
+            if (processedPath.contains("*"))
+            {
+                // if contains wild card, just prove the part before the wild card is valid
+                int c = processedPath.lastIndexOf("/", processedPath.indexOf("*"));
+                if (c != -1)
+                    processedPath = processedPath.substring(0, c);
+            }
             final File fileSpec = pathResolver.resolve(processedPath);
             if (!returnMissingFiles && !fileSpec.exists())
             {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e5977e79/compiler/src/org/apache/flex/compiler/internal/targets/SWCTarget.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/targets/SWCTarget.java b/compiler/src/org/apache/flex/compiler/internal/targets/SWCTarget.java
index 2c231ba..b445a58 100644
--- a/compiler/src/org/apache/flex/compiler/internal/targets/SWCTarget.java
+++ b/compiler/src/org/apache/flex/compiler/internal/targets/SWCTarget.java
@@ -37,6 +37,7 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.zip.ZipOutputStream;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 
@@ -826,19 +827,50 @@ public class SWCTarget extends Target implements ISWCTarget
         for (Entry<String, File> entry : targetSettings.getIncludeFiles().entrySet())
         {
             String filename = entry.getKey();
-            String path = entry.getValue().getAbsolutePath();
-            IBinaryFileSpecification fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(path);
+            if (filename.contains("*"))
+            {
+                Collection<File> files = getFiles(entry.getValue());
+                String basename = entry.getValue().getAbsolutePath();
+                for (File file : files)
+                {
+                    String path = file.getAbsolutePath();
+                    IBinaryFileSpecification fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(path);
 
-            if (filename != null && fileSpec != null)
+                    if (filename != null && fileSpec != null)
+                    {
+                        String relativePath = path.substring(basename.length() + 1);
+                        relativePath = filename.replace("*", relativePath);
+                        FileEntryValue value = new FileEntryValue(fileSpec, null);
+                        includedFiles.put(relativePath, value);
+                    }                    
+                }
+            }
+            else
             {
-                FileEntryValue value = new FileEntryValue(fileSpec, null);
-                includedFiles.put(filename, value);
+                String path = entry.getValue().getAbsolutePath();
+                IBinaryFileSpecification fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(path);
+    
+                if (filename != null && fileSpec != null)
+                {
+                    FileEntryValue value = new FileEntryValue(fileSpec, null);
+                    includedFiles.put(filename, value);
+                }
             }
         }
 
         return includedFiles;
     }
     
+    private Collection<File> getFiles(File file)
+    {
+        String filename = file.getAbsolutePath();
+        int c = filename.lastIndexOf("/");
+        if (c != -1)
+            filename = filename.substring(0, c);
+        Collection<File> files = FileUtils.listFiles(new File(
+                filename), null, true);
+        return files;
+    }
     /**
      * The collection of files from all of the libraries found on the 
      * -include-libraries path.