You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/11/06 06:48:11 UTC

git commit: [flex-falcon] [refs/heads/develop] - Added another pathway for finding 'goog' files by their class name.

Updated Branches:
  refs/heads/develop 325cce668 -> 20296ebb1


Added another pathway for finding 'goog' files by their class name.

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 20296ebb1895b3ec0eb870c2481926e5927c5f8a
Parents: 325cce6
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Nov 6 06:47:24 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Nov 6 06:47:34 2013 +0100

----------------------------------------------------------------------
 .../compiler/internal/graph/GoogDepsWriter.java | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/20296ebb/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index b947e4f..c494ad0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -8,6 +8,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Scanner;
@@ -15,6 +16,7 @@ import java.util.Scanner;
 import org.apache.commons.io.FileUtils;
 import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
 
+import com.google.common.base.Joiner;
 import com.google.common.io.Files;
 
 public class GoogDepsWriter {
@@ -277,6 +279,7 @@ public class GoogDepsWriter {
                 }
                 return fn;
             }
+            
             // if we still haven't found it, use this hack for now.  I guess
             // eventually we should search every file.
             if (googClass.equals("ListenableKey"))
@@ -300,6 +303,33 @@ public class GoogDepsWriter {
                 }
                 return fn;
             }
+
+            // (erikdebruin) Some 'goog' files provide more than one namespace. The
+            //               naming of these files doesn't follow the qualified
+            //               class name as path schema, instead they use the 
+            //               last path element as filename... E.g. 'goog.iter.Iterator'
+            //               is declared not in 'goog/iter/Iterator.js' but in
+            //               'goog/iter/iter.js'.
+            ArrayList<String> googClassArr = new ArrayList<String>(Arrays.asList(googPackage.split(File.separator)));
+            String googClassEx = googClassArr.remove(googClassArr.size() - 1);
+            String googPackageEx = Joiner.on(File.separator).join(googClassArr);
+            fn = googPath + File.separator + "closure" + File.separator + googPackageEx + File.separator + googClassEx + File.separator + googClassEx.toLowerCase() + ".js"; 
+            f = new File(fn);
+            if (f.exists())
+            {
+                fn = outputFolderPath + File.separator + "library" +
+                        File.separator + "closure" + 
+                        File.separator + googPackageEx + File.separator + googClassEx.toLowerCase() + ".js";
+                destFile = new File(fn);
+                // copy source to output
+                try {
+                    FileUtils.copyFile(f, destFile);
+                    System.out.println("Copying file for class: " + className);
+                } catch (IOException e) {
+                    System.out.println("Error copying file for class: " + className);
+                }
+                return fn;
+            }
 		}
 		
         fn = outputFolderPath + File.separator + classPath + ".js";