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 2017/04/13 17:43:32 UTC

[01/50] git commit: [flex-falcon] [refs/heads/dual] - fix some tests now that we have better error checking

Repository: flex-falcon
Updated Branches:
  refs/heads/dual fba30de09 -> f39e0fbc3


fix some tests now that we have better error checking


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

Branch: refs/heads/dual
Commit: fde038685889b3d9e821937143e14bb5fd9e7cbb
Parents: 445854b
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 7 22:34:03 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 7 22:34:03 2017 -0800

----------------------------------------------------------------------
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  | 44 ++++++++++++++++----
 1 file changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fde03868/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index 8cb54be..d49661d 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -297,7 +297,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
         		+ "<fx:Script><![CDATA["
                 + "    import org.apache.flex.net.HTTPConstants;"
-                + "]]></fx:Script><basic:initialView><basic:Label text=\"{HTTPConstants.GET}\"/></basic:initialView></basic:Application>";
+                + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{HTTPConstants.GET}\"/></basic:View></basic:initialView></basic:Application>";
 
         IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
         		IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -316,6 +316,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
         		"goog.require('org.apache.flex.html.Label');\n" +
         		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
         		"\n" +
@@ -330,6 +331,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  \n" +
         		"  /**\n" +
         		"   * @private\n" +
+        		"   * @type {org.apache.flex.core.View}\n" +
+        		"   */\n" +
+        		"  this.$ID1_;\n" +
+        		"  \n" +
+        		"  /**\n" +
+        		"   * @private\n" +
         		"   * @type {org.apache.flex.html.Label}\n" +
         		"   */\n" +
         		"  this.$ID0_;\n" +
@@ -350,7 +357,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  ([1,\n" +
         		"'initialView',\n" +
         		"false,\n" +
-        		"[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+        		"[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
         		"0,\n" +
         		"0\n" +
         		"  ]);\n" +
@@ -412,7 +419,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
         		+ "<fx:Script><![CDATA["
                 + "    import org.apache.flex.net.HTTPConstants;"
-                + "]]></fx:Script><basic:initialView><basic:Label text=\"{org.apache.flex.net.HTTPConstants.GET}\"/></basic:initialView></basic:Application>";
+                + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{org.apache.flex.net.HTTPConstants.GET}\"/></basic:View></basic:initialView></basic:Application>";
 
         IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
         		IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -431,6 +438,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
         		"goog.require('org.apache.flex.html.Label');\n" +
         		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
         		"\n" +
@@ -445,6 +453,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  \n" +
         		"  /**\n" +
         		"   * @private\n" +
+        		"   * @type {org.apache.flex.core.View}\n" +
+        		"   */\n" +
+        		"  this.$ID1_;\n" +
+        		"  \n" +
+        		"  /**\n" +
+        		"   * @private\n" +
         		"   * @type {org.apache.flex.html.Label}\n" +
         		"   */\n" +
         		"  this.$ID0_;\n" +
@@ -465,7 +479,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  ([1,\n" +
         		"'initialView',\n" +
         		"false,\n" +
-        		"[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+        		"[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
         		"0,\n" +
         		"0\n" +
         		"  ]);\n" +
@@ -528,7 +542,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		+ "<fx:Script><![CDATA["
                 + "    import binding.ComplexValueObject;\n"
         		+ "    public var firstOne:ComplexValueObject;\n"
-                + "]]></fx:Script><basic:initialView><basic:Label text=\"{firstOne.subObject.labelText}\"/></basic:initialView></basic:Application>";
+                + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"{firstOne.subObject.labelText}\"/></basic:View></basic:initialView></basic:Application>";
 
         IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
         		IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -547,6 +561,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
         		"goog.require('org.apache.flex.html.Label');\n" +
         		"goog.require('binding.ComplexValueObject');\n" +
         		"\n" +
@@ -561,6 +576,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  \n" +
         		"  /**\n" +
         		"   * @private\n" +
+        		"   * @type {org.apache.flex.core.View}\n" +
+        		"   */\n" +
+        		"  this.$ID1_;\n" +
+        		"  \n" +
+        		"  /**\n" +
+        		"   * @private\n" +
         		"   * @type {org.apache.flex.html.Label}\n" +
         		"   */\n" +
         		"  this.$ID0_;\n" +
@@ -581,7 +602,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  ([1,\n" +
         		"'initialView',\n" +
         		"false,\n" +
-        		"[org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null],\n" +
+        		"[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
         		"0,\n" +
         		"0\n" +
         		"  ]);\n" +
@@ -676,7 +697,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         String code = "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
         		+ "<fx:Script><![CDATA["
         		+ "    public var xml:XML = new XML();\n"
-                + "]]></fx:Script><basic:initialView><basic:Label text=\"Hello World\"/></basic:initialView></basic:Application>";
+                + "]]></fx:Script><basic:initialView><basic:View><basic:Label text=\"Hello World\"/></basic:View></basic:initialView></basic:Application>";
 
         IMXMLDocumentNode dnode = (IMXMLDocumentNode) getNode(code,
         		IMXMLDocumentNode.class, FlexJSTestBase.WRAP_LEVEL_NONE);
@@ -695,6 +716,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
         		"goog.require('org.apache.flex.html.Label');\n" +
         		"goog.require('XML');\n" +
         		"goog.require('XML');\n" +
@@ -711,6 +733,12 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  this.xml = new XML();\n" +
         		"  /**\n" +
         		"   * @private\n" +
+        		"   * @type {org.apache.flex.core.View}\n" +
+        		"   */\n" +
+        		"  this.$ID1_;\n" +
+        		"  \n" +
+        		"  /**\n" +
+        		"   * @private\n" +
         		"   * @type {org.apache.flex.html.Label}\n" +
         		"   */\n" +
         		"  this.$ID0_;\n" +
@@ -731,7 +759,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"  ([1,\n" +
         		"'initialView',\n" +
         		"false,\n" +
-        		"[org.apache.flex.html.Label, 2, '_id', true, '$ID0', 'text', true, 'Hello World', 0, 0, null],\n" +
+        		"[org.apache.flex.core.View, 1, '_id', true, '$ID1', 0, 0, [org.apache.flex.html.Label, 2, '_id', true, '$ID0', 'text', true, 'Hello World', 0, 0, null]],\n" +
         		"0,\n" +
         		"0\n" +
         		"  ]);\n" +


[27/50] git commit: [flex-falcon] [refs/heads/dual] - MXMLFlexxJSEmitter: fixed JS output for MXML events to match whitespace in tests

Posted by ah...@apache.org.
MXMLFlexxJSEmitter: fixed JS output for MXML events to match whitespace in tests


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

Branch: refs/heads/dual
Commit: 095d5ee35a32a26526bae4eb309bbfcb20583094
Parents: f2e03cc
Author: Josh Tynjala <jo...@apache.org>
Authored: Sat Mar 25 09:25:30 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Sat Mar 25 09:25:30 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/095d5ee3/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 2b19b87..560927c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -1542,6 +1542,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             write(ASEmitterTokens.BLOCK_CLOSE);
             writeNewline(ASEmitterTokens.SEMICOLON);
             writeNewline();
+            writeNewline();
         }
     }
 


[34/50] git commit: [flex-falcon] [refs/heads/dual] - fix apps that don't use remove-circulars

Posted by ah...@apache.org.
fix apps that don't use remove-circulars


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

Branch: refs/heads/dual
Commit: fce80f5f46864e924bd14205e092f651a9aa5124
Parents: 6593d84
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 28 08:47:36 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 28 08:47:44 2017 -0700

----------------------------------------------------------------------
 .../apache/flex/compiler/internal/graph/GoogDepsWriter.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fce80f5f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index c8bbe16..8efaf77 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -133,10 +133,16 @@ public class GoogDepsWriter {
 			GoogDep gd = dps.get(i);
 			if (!isGoogClass(gd.className)) 
 			{
-				sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', ['")
+				if (removeCirculars)
+					sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', ['")
 						.append(gd.className).append("'], [")
 						.append((gd.fileInfo.impls != null) ? getDependencies(gd.fileInfo.impls) : "")
 						.append("]);\n");
+				else
+					sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', ['")
+					.append(gd.className).append("'], [")
+					.append(getDependencies(gd.deps))
+					.append("]);\n");					
 			}
 		}
 		if (removeCirculars)


[28/50] git commit: [flex-falcon] [refs/heads/dual] - use dependency graph to sort out order of files. Static initializer dependencies are tracked in comments

Posted by ah...@apache.org.
use dependency graph to sort out order of files.  Static initializer dependencies are tracked in comments


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

Branch: refs/heads/dual
Commit: fc1fa430e255c5ce331a2708f3418e9d4ff8b6e4
Parents: 870816b
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 25 10:48:04 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 25 10:48:04 2017 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/JSSessionModel.java     |   2 +
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 131 +++++++---
 .../codegen/js/goog/JSGoogEmitterTokens.java    |   1 +
 .../internal/codegen/js/jx/FieldEmitter.java    |   2 +
 .../codegen/js/jx/PackageHeaderEmitter.java     |  67 ++---
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 132 +++++-----
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |   2 +-
 .../compiler/internal/graph/GoogDepsWriter.java | 255 ++++++++++++-------
 .../utils/JSClosureCompilerWrapper.java         |   8 +-
 .../apache/flex/compiler/utils/NativeUtils.java |   1 +
 .../codegen/js/flexjs/TestFlexJSClass.java      |   2 +-
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  |  18 +-
 .../flexjs/files/FlexJSTest_again_result.js     |  10 +-
 .../flexjs/files/MyInitialView_result.js        |  16 +-
 .../files/controllers/MyController_result.js    |   6 +-
 .../flexjs/files/models/MyModel_result.js       |   3 +-
 .../flexjs/files/wildcard_import_result.js      |   2 +-
 .../flexjs/projects/interfaces/Test_result.js   |   4 +-
 .../projects/internal/MainClass_result.js       |   3 +-
 .../DifferentPackageAsConflict_result.js        |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../NoConflictNoWindow_result.js                |   3 +-
 .../NoConflictUseWindow_result.js               |   3 +-
 .../SamePackageAsConflict_result.js             |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../UseWindow_result.js                         |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../projects/xml_requires/XMLRequire_result.js  |   3 +-
 28 files changed, 408 insertions(+), 284 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
index 36d6881..ca47881 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSessionModel.java
@@ -81,6 +81,8 @@ public class JSSessionModel
 
     public boolean inE4xFilter = false;
 
+    public boolean inStaticInitializer = false;
+    
     private LinkedHashMap<String, PropertyNodes> propertyMap = new LinkedHashMap<String, PropertyNodes>();
 
     private List<String> interfacePropertyMap = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 8ac7ae8..af93844 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -23,7 +23,6 @@ import java.io.File;
 import java.io.FilterWriter;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
@@ -155,6 +154,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     private DefinePropertyFunctionEmitter definePropertyFunctionEmitter;
 
     public ArrayList<String> usedNames = new ArrayList<String>();
+    public ArrayList<String> staticUsedNames = new ArrayList<String>();
     private boolean needNamespace;
 
     @Override
@@ -164,13 +164,13 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
 
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
-        ArrayList<String> deps = new ArrayList<String>();
         boolean foundLanguage = false;
         boolean foundXML = false;
         boolean foundNamespace = false;
         boolean sawRequires = false;
     	boolean stillSearching = true;
-        int depsIndex = -1;
+        int addIndex = -1;
+        int provideIndex = -1;
         int len = lines.length;
     	for (int i = 0; i < len; i++)
     	{
@@ -182,42 +182,34 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                 {
                     // if zero requires are found, require Language after the
                     // call to goog.provide
-                    depsIndex = i + 1;
+                    provideIndex = addIndex = i + 1;
                 }
-                String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
-	            c = line.indexOf(token);
+	            c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
 	            if (c != -1)
 	            {
                     // we found other requires, so we'll just add Language at
                     // the end of the list
-                    depsIndex = i;
-	                int c2 = line.indexOf("*/");
-	                String s = line.substring(c + token.length(), c2);
-	                deps.addAll(Arrays.asList(s.split(",")));
-                    if (deps.contains(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
+                    addIndex = -1;
+	                int c2 = line.indexOf(")");
+	                String s = line.substring(c + 14, c2 - 1);
+                    if (s.equals(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
                     {
                         foundLanguage = true;
                     }
-                    else if (deps.contains(IASLanguageConstants.XML))
+                    else if (s.equals(IASLanguageConstants.XML))
                     {
                         foundXML = true;
                     }
-                    else if (deps.contains(IASLanguageConstants.Namespace))
+                    else if (s.equals(IASLanguageConstants.Namespace))
                     {
                         foundNamespace = true;
                     }
 	    			sawRequires = true;
-	    			ArrayList<String> removalList = new ArrayList<String>();
-	    			for (String dep : deps)
-	    			{
-		    			if (!usedNames.contains(dep))
-	                    {
-	                        removalList.add(dep);
-	                    }	    				
-	    			}
-	    			for (String dep : removalList)
-	    				deps.remove(dep);
-                    continue;
+	    			if (!usedNames.contains(s))
+                    {
+                        removeLineFromMappings(i);
+                        continue;
+                    }
 	    		}
 	    		else if (sawRequires || i == len - 1)
                 {
@@ -234,30 +226,95 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                         boolean needLanguage = flexJSProject.needLanguage;
                         if (needLanguage && !foundLanguage)
                         {
-                            deps.add(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+                            StringBuilder appendString = new StringBuilder();
+                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+                            if(addIndex != -1)
+                            {
+                                // if we didn't find other requires, this index
+                                // points to the line after goog.provide
+                                finalLines.add(addIndex, appendString.toString());
+                                addLineToMappings(addIndex);
+                            }
+                            else
+                            {
+                                finalLines.add(appendString.toString());
+                                addLineToMappings(i);
+                            }
                         }
                         boolean needXML = flexJSProject.needXML;
                         if (needXML && !foundXML)
                         {
-                            deps.add(IASLanguageConstants.XML);
+                            StringBuilder appendString = new StringBuilder();
+                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(IASLanguageConstants.XML);
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+                            if(addIndex != -1)
+                            {
+                                // if we didn't find other requires, this index
+                                // points to the line after goog.provide
+                                finalLines.add(addIndex, appendString.toString());
+                                addLineToMappings(addIndex);
+                            }
+                            else
+                            {
+                                finalLines.add(appendString.toString());
+                                addLineToMappings(i);
+                            }
                         }
                         if (needNamespace && !foundNamespace)
                         {
-                            deps.add(IASLanguageConstants.Namespace);
+                            StringBuilder appendString = new StringBuilder();
+                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(IASLanguageConstants.Namespace);
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+                            if(addIndex != -1)
+                            {
+                                // if we didn't find other requires, this index
+                                // points to the line after goog.provide
+                                finalLines.add(addIndex, appendString.toString());
+                                addLineToMappings(addIndex);
+                            }
+                            else
+                            {
+                                finalLines.add(appendString.toString());
+                                addLineToMappings(i);
+                            }
                         }
                     }
                 }
     		}
     		finalLines.add(line);
     	}
-    	if (deps.size() > 0)
-    	{
-	        StringBuilder sb = new StringBuilder();
-	        sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
-	        sb.append(Joiner.on(",").join(deps));
-	        sb.append("*/\n");
-			finalLines.add(depsIndex, sb.toString());
-    	}
+		if (staticUsedNames.size() > 0)
+		{
+			StringBuilder sb = new StringBuilder();
+			sb.append(JSGoogEmitterTokens.FLEXJS_STATIC_DEPENDENCY_LIST.getToken());
+			boolean firstDependency = true;
+			for (String staticName : staticUsedNames)
+			{
+				if (!firstDependency)
+					sb.append(",");
+				firstDependency = false;
+				sb.append(staticName);
+			}
+			sb.append("*/");
+			finalLines.add(provideIndex, sb.toString());
+		}
+
     	return Joiner.on("\n").join(finalLines);
     }
 
@@ -499,6 +556,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     		name = name.substring(7);
     	else if (!isDoc)
     	{
+        	if (getModel().inStaticInitializer)
+        		if (!staticUsedNames.contains(name))
+        			staticUsedNames.add(name);
+    		
     		if (!usedNames.contains(name))
     			usedNames.add(name);
     	}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
index 5cf6d1c..07dfe14 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
@@ -33,6 +33,7 @@ public enum JSGoogEmitterTokens implements IEmitterTokens
     GOOG_PROVIDE("goog.provide"),
     GOOG_REQUIRE("goog.require"),
     FLEXJS_DEPENDENCY_LIST("/* FlexJS Dependency List: "),
+    FLEXJS_STATIC_DEPENDENCY_LIST("/* FlexJS Static Dependency List: "),
     OBJECT("Object"),
     ARRAY("Array"),
     ERROR("Error"),

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index 1b0d579..7029028 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -108,7 +108,9 @@ public class FieldEmitter extends JSSubEmitter implements
         IExpressionNode vnode = node.getAssignedValueNode();
         if (vnode != null)
         {
+        	getModel().inStaticInitializer = ndef.isStatic();
             String vnodeString = getEmitter().stringifyNode(vnode);
+        	getModel().inStaticInitializer = false;
         	if ((ndef.isStatic() && !EmitterUtils.needsStaticInitializer(vnodeString, className)) || 
         			(!ndef.isStatic() && EmitterUtils.isScalar(vnode)) ||
         			isPackageOrFileMember)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index fa281ad..73d3b80 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -211,15 +211,14 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
         String cname = (type != null) ? type.getQualifiedName() : otherMainDefinition.getQualifiedName();
         writtenRequires.add(cname); // make sure we don't add ourselves
-        String baseName = "";
+
 
         if (type instanceof IClassDefinition) {
-            IClassDefinition bindableClassDef = (IClassDefinition) type;
-            baseName = bindableClassDef.resolveBaseClass(flexProject).getQualifiedName();
             //check whether we should add the requires for the implicit Bindable EventDispatcher implementations
             boolean needsBindableSupport = ((IClassDefinition) type).needsEventDispatcher(flexProject);
 
             if (needsBindableSupport) {
+                IClassDefinition bindableClassDef = (IClassDefinition) type;
                 ClassDefinition objectClassDefinition = (ClassDefinition)flexProject.getBuiltinType(
                         IASLanguageConstants.BuiltinType.OBJECT);
 
@@ -259,23 +258,9 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
         }
 
-        if (interfacesList != null && requiresList != null)
-        {
-	        for (String r : interfacesList)
-	        {
-	        	while (requiresList.contains(r))
-	        	{
-	        		requiresList.remove(r);
-	        		System.out.println("interface " + r + "is already in requires list");
-	        	}
-	        }
-        }
-        boolean emitsRequires = emitRequires(requiresList, writtenRequires, cname, baseName);
+        boolean emitsRequires = emitRequires(requiresList, writtenRequires, cname);
         boolean emitsInterfaces = emitInterfaces(interfacesList, writtenRequires);
 
-        boolean isMainCU = flexProject.mainCU != null
-        	&& cu.getName().equals(flexProject.mainCU.getName());
-        /*
         // erikdebruin: Add missing language feature support, with e.g. 'is' and
         //              'as' operators. We don't need to worry about requiring
         //              this in every project: ADVANCED_OPTIMISATIONS will NOT
@@ -301,8 +286,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
                 }
             }
         }
-		*/
-        
+
         boolean emitsExternalRequires = emitExternalRequires(externalRequiresList, writtenRequires);
 
         if (emitsRequires || emitsInterfaces || emitsExternalRequires || isMainCU)
@@ -314,13 +298,9 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
         writeNewline();
     }
 
-    private boolean emitRequires(List<String> requiresList, List<String> writtenRequires, String cname, String baseName)
+    private boolean emitRequires(List<String> requiresList, List<String> writtenRequires, String cname)
     {
-    	StringBuilder sb = new StringBuilder();
-    	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
-    	
         boolean emitsRequires = false;
-        boolean firstDependency = true;
         if (requiresList != null)
         {
             Collections.sort(requiresList);
@@ -348,37 +328,22 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
                 if (writtenRequires.indexOf(imp) == -1)
                 {
-                	if (imp.equals(baseName))
-                	{
-	                    /* goog.require('x');\n */
-	                    write(JSGoogEmitterTokens.GOOG_REQUIRE);
-	                    write(ASEmitterTokens.PAREN_OPEN);
-	                    write(ASEmitterTokens.SINGLE_QUOTE);
-	                    write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
-	                    write(ASEmitterTokens.SINGLE_QUOTE);
-	                    write(ASEmitterTokens.PAREN_CLOSE);
-	                    writeNewline(ASEmitterTokens.SEMICOLON);
-	                    emitsRequires = true;
-                	}
-                	else
-                	{
-                		if (!firstDependency)
-                			sb.append(",");
-                		sb.append(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
-                		firstDependency = false;
-                	}
+
+                    /* goog.require('x');\n */
+                    write(JSGoogEmitterTokens.GOOG_REQUIRE);
+                    write(ASEmitterTokens.PAREN_OPEN);
+                    write(ASEmitterTokens.SINGLE_QUOTE);
+                    write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
+                    write(ASEmitterTokens.SINGLE_QUOTE);
+                    write(ASEmitterTokens.PAREN_CLOSE);
+                    writeNewline(ASEmitterTokens.SEMICOLON);
 
                     writtenRequires.add(imp);
+
+                    emitsRequires = true;
                 }
             }
         }
-        
-        if (!firstDependency)
-        {
-        	sb.append("*/\n");
-        	write(sb.toString());
-        	emitsRequires = true;
-        }
         return emitsRequires;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index da9d3e3..21aef44 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -23,7 +23,6 @@ package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 import java.io.File;
 import java.io.FilterWriter;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -159,31 +158,27 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
     	int endRequires = -1;
-    	int provideIndex = -1;
     	boolean sawRequires = false;
-    	boolean depsAdded = false;
     	boolean stillSearching = true;
         ArrayList<String> namesToAdd = new ArrayList<String>();
         ArrayList<String> foundRequires = new ArrayList<String>();
-        int i = 0;
     	for (String line : lines)
     	{
     		if (stillSearching)
     		{
-    			String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
-	            int c = line.indexOf(token);
+	            int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
 	            if (c > -1)
 	            {
-	                int c2 = line.indexOf("*/");
-	                String s = line.substring(c + token.length(), c2);
-	                String[] reqs = s.split(",");
-	                for (String req : reqs)
-	                {
-	                	if (usedNames.contains(req) && !foundRequires.contains(req))
-	                		foundRequires.add(req);
-	                }
+	                int c2 = line.indexOf(")");
+	                String s = line.substring(c + 14, c2 - 1);
+                    if (s.equals(IASLanguageConstants.XML))
+                    {
+                        foundXML = true;
+                    }
 	    			sawRequires = true;
-	    			endRequires = i;
+                    foundRequires.add(s);
+	    			if (!usedNames.contains(s))
+	    				continue;
 	    		}
 	    		else if (sawRequires)
 	    		{
@@ -207,23 +202,27 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
                     for (String nameToAdd : namesToAdd) {
                         //System.out.println("adding late requires:"+nameToAdd);
-                    	if (!foundRequires.contains(nameToAdd))
-                    		foundRequires.add(nameToAdd);
+                        finalLines.add(createRequireLine(nameToAdd,false));
                     }
-	    		}
-	    		else if (line.indexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken()) != -1)
-	    		{
-	    			provideIndex = i;
+
+	    			endRequires = finalLines.size();
 	    		}
     		}
     		finalLines.add(line);
-    		i++;
     	}
         boolean needXML = ((FlexJSProject)(((IMXMLBlockWalker) getMXMLWalker()).getProject())).needXML;
-        if (needXML && !foundRequires.contains(IASLanguageConstants.XML))
-        {
-    		foundRequires.add(IASLanguageConstants.XML);
-    		depsAdded = true;
+        if (needXML && !foundXML)
+        {
+            StringBuilder appendString = new StringBuilder();
+            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+            appendString.append(IASLanguageConstants.XML);
+            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+            finalLines.add(endRequires, appendString.toString());
+            // TODO (aharui) addLineToMappings(finalLines.size());
         }
     	// append info() structure if main CU
         ICompilerProject project = getMXMLWalker().getProject();
@@ -256,8 +255,15 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 		            			mixinInject += ", "; 
 		            		mixinInject += mixin;
 		            		firstOne = false;
-		                    foundRequires.add(mixin);
-		                    depsAdded = true;
+		                    StringBuilder appendString = new StringBuilder();
+		                    appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+		                    appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+		                    appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+		                    appendString.append(mixin);
+		                    appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+		                    appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+		                    appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+	                        finalLines.add(endRequires, appendString.toString());
 	                        //addLineToMappings(finalLines.size());
 		            	}
 		            	mixinInject += "]";
@@ -299,18 +305,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 	            }
             }
         }
-        if (foundRequires.size() > 0)
-        {
-        	StringBuilder sb = new StringBuilder();
-        	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
-            sb.append(Joiner.on(",").join(foundRequires));
-            sb.append("*/\n");
-            if (endRequires == -1)
-            	finalLines.add(provideIndex + 1, sb.toString());
-            else
-            	finalLines.set(endRequires, sb.toString());
-
-        }
     	return Joiner.on("\n").join(finalLines);
     }
     
@@ -2324,17 +2318,20 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writtenInstances.add(formatQualifiedName(cname)); // make sure we don't add ourselves
         writtenInstances.add(formatQualifiedName(bcname)); // make sure we don't add the baseclass twice
         allInstances.addAll(0, instances);
-        
+        for (MXMLDescriptorSpecifier instance : allInstances)
+        {
+            String name = instance.name;
+            if (writtenInstances.indexOf(name) == -1)
+            {
+                emitHeaderLine(name);
+                writtenInstances.add(name);
+            }
+        }
         ASProjectScope projectScope = (ASProjectScope) project.getScope();
         IDefinition cdef = node.getDefinition();
         ICompilationUnit cu = projectScope
                 .getCompilationUnitForDefinition(cdef);
         ArrayList<String> deps = project.getRequires(cu);
-        for (MXMLDescriptorSpecifier instance : allInstances)
-        {
-            String name = instance.name;
-            deps.add(name);
-        }
 
         // TODO (mschmalle) will remove this cast as more things get abstracted
         JSFlexJSEmitter fjs = (JSFlexJSEmitter) ((IMXMLBlockWalker) getMXMLWalker())
@@ -2352,20 +2349,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         	String[] interfaces = interfaceList.split(", ");
         	for (String iface : interfaces)
         	{
-        		while (deps.contains(iface))
-        			deps.remove(iface);
+        		deps.add(iface);
         		usedNames.add(iface);
-                if (writtenInstances.indexOf(iface) == -1)
-                {
-                    emitHeaderLine(iface);
-                    writtenInstances.add(iface);
-                }
         	}
         }
-        boolean firstDependency = true;
-        boolean depsAdded = false;
-    	StringBuilder sb = new StringBuilder();
-    	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
         if (deps != null)
         {
         	Collections.sort(deps);
@@ -2402,12 +2389,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 String formatted = formatQualifiedName(imp, false);
                 if (writtenInstances.indexOf(formatted) == -1)
                 {
-            		if (!firstDependency)
-            			sb.append(",");
-                    sb.append(formatted);
+                    emitHeaderLine(imp);
                     writtenInstances.add(formatted);
-                    firstDependency = false;
-                    depsAdded = true;
                 }
             }
         }
@@ -2422,19 +2405,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             if (project instanceof FlexJSProject)
             {
             	if (((FlexJSProject)project).needLanguage)
-            	{
-            		if (!firstDependency)
-            			sb.append(",");
-            		sb.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
-                    depsAdded = true;
-            	}
+            		emitHeaderLine(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
             }
         }
-        sb.append("*/\n");
-        if (depsAdded)
-        {
-        	write(sb.toString());
-        }
+
         writeNewline();
         writeNewline();
     }
@@ -2456,6 +2430,18 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writeNewline(ASEmitterTokens.SEMICOLON);
     }
 
+    private String createRequireLine(String qname, boolean isProvide) {
+        StringBuilder createHeader = new StringBuilder();
+        createHeader.append(isProvide ? JSGoogEmitterTokens.GOOG_PROVIDE.getToken() : JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+        createHeader.append(ASEmitterTokens.PAREN_OPEN.getToken());
+        createHeader.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        createHeader.append(qname);
+        createHeader.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        createHeader.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+        createHeader.append(ASEmitterTokens.SEMICOLON.getToken());
+        return createHeader.toString();
+    }
+
     //--------------------------------------------------------------------------
     //    Utils
     //--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 656dabb..40a83e3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -367,7 +367,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
         if (configuration.release()) {
             final File projectReleaseMainFile = new File(releaseDir, outputFileName);
-            compilerWrapper.setOptions(projectReleaseMainFile.getCanonicalPath(), useStrictPublishing, projectName);
+            compilerWrapper.setOptions(projectReleaseMainFile.getCanonicalPath(), useStrictPublishing, !googConfiguration.getRemoveCirculars(), projectName);
             compilerWrapper.targetFilePath = projectReleaseMainFile.getCanonicalPath();
 
             compilerWrapper.compile();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index d106ea0..6d99aac 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -40,6 +40,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.flex.compiler.clients.problems.ProblemQuery;
 import org.apache.flex.compiler.common.DependencyType;
 import org.apache.flex.compiler.common.DependencyTypeSet;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.driver.js.JSCompilationUnit;
 import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
@@ -102,14 +103,17 @@ public class GoogDepsWriter {
 			files.add(gd.filePath);
 			visited.put(gd.className, gd);
 		}
-		GoogDep mainDep = depMap.get(mainName);
-		visited.put(mainName, mainDep);
-		for (GoogDep gd : depMap.values())
+		if (removeCirculars)
 		{
-			if (!visited.containsKey(gd.className))
-				files.add(gd.filePath);			
+			GoogDep mainDep = depMap.get(mainName);
+			visited.put(mainName, mainDep);
+			for (GoogDep gd : depMap.values())
+			{
+				if (!visited.containsKey(gd.className))
+					files.add(gd.filePath);			
+			}
+			files.add(mainDep.filePath);
 		}
-		files.add(mainDep.filePath);
 		return files;
 	}
 	
@@ -135,30 +139,33 @@ public class GoogDepsWriter {
 						.append("]);\n");
 			}
 		}
-		StringBuilder mainDeps = new StringBuilder();
-		GoogDep mainDep = depMap.get(mainName);
-		mainDeps.append("goog.addDependency('").append(relativePath(mainDep.filePath)).append("', ['")
-							.append(mainDep.className).append("'], [");
-		ArrayList<String> restOfDeps = new ArrayList<String>();
-        DependencyTypeSet dependencyTypes = DependencyTypeSet.allOf();
-		// get the list of all units not referenced by other units
-		for (GoogDep gd : depMap.values())
+		if (removeCirculars)
 		{
-			if (gd.className.equals(mainName)) continue;
-			ICompilationUnit unit = requireMap.get(gd.className);
-			if (unit == null)
+			StringBuilder mainDeps = new StringBuilder();
+			GoogDep mainDep = depMap.get(mainName);
+			mainDeps.append("goog.addDependency('").append(relativePath(mainDep.filePath)).append("', ['")
+								.append(mainDep.className).append("'], [");
+			ArrayList<String> restOfDeps = new ArrayList<String>();
+	        DependencyTypeSet dependencyTypes = DependencyTypeSet.allOf();
+			// get the list of all units not referenced by other units
+			for (GoogDep gd : depMap.values())
 			{
-				restOfDeps.add(gd.className);
-				continue;
+				if (gd.className.equals(mainName)) continue;
+				ICompilationUnit unit = requireMap.get(gd.className);
+				if (unit == null)
+				{
+					restOfDeps.add(gd.className);
+					continue;
+				}
+				Set<ICompilationUnit> deps = graph.getDirectReverseDependencies(unit, dependencyTypes);
+				if (deps.size() == 0)
+					restOfDeps.add(gd.className);
 			}
-			Set<ICompilationUnit> deps = graph.getDirectReverseDependencies(unit, dependencyTypes);
-			if (deps.size() == 0)
-				restOfDeps.add(gd.className);
+			mainDeps.append(getDependencies(restOfDeps)).append("]);\n");
+			sb.insert(0, mainDeps);
+			sb.insert(0, "// generated by FalconJX\n");
+			addRestOfDeps(mainDep, restOfDeps);
 		}
-		mainDeps.append(getDependencies(restOfDeps)).append("]);\n");
-		sb.insert(0, mainDeps);
-		sb.insert(0, "// generated by FalconJX\n");
-		addRestOfDeps(mainDep, restOfDeps);
 		return sb.toString();
 	}
 	
@@ -179,68 +186,115 @@ public class GoogDepsWriter {
     
 	private ArrayList<GoogDep> sort()
 	{
+		ArrayList<GoogDep> arr = new ArrayList<GoogDep>();
 		GoogDep current = depMap.get(mainName);
-		sortFunction(current);
-		ICompilationUnit mainUnit = requireMap.get(mainName);
-		ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
-		roots.add(mainUnit);
-		requireMap.remove(mainName);
-		
-		List<ICompilationUnit> order = graph.topologicalSort(requireMap.values());
-		ArrayList<GoogDep> depsInOrder = new ArrayList<GoogDep>();
-		for (ICompilationUnit unit : order)
+		sortFunction(current, arr);
+		if (removeCirculars)
 		{
-			String name = requireMap2.get(unit);
-			GoogDep dep = depMap.get(name);
-			depsInOrder.add(dep);
+			ICompilationUnit mainUnit = requireMap.get(mainName);
+			ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+			roots.add(mainUnit);
+			requireMap.remove(mainName);
+			
+			List<ICompilationUnit> order = graph.topologicalSort(requireMap.values());
+			ArrayList<GoogDep> depsInOrder = new ArrayList<GoogDep>();
+			for (ICompilationUnit unit : order)
+			{
+				String name = requireMap2.get(unit);
+				GoogDep dep = depMap.get(name);
+				depsInOrder.add(dep);
+			}
+			return depsInOrder;
 		}
-		return depsInOrder;
+		return arr;
 	}
 	
-	private void sortFunction(GoogDep current)
+	private void sortFunction(GoogDep current, List<GoogDep> arr)
 	{
 		visited.put(current.className, current);
 		
-		//removeRequires(current);
+		if (removeCirculars)
+			removeRequires(current);
         System.out.println("Dependencies calculated for '" + current.className + "'");
 
-		ICompilationUnit unit;
-		if (current.fileInfo.deps == null)
-			return;
+		ICompilationUnit unit = null;
 		
-		unit = requireMap.get(current.className);
-		if (unit == null)
-		{
-			unit = new JSCompilationUnit(project, current.filePath, DefinitionPriority.BasePriority.SOURCE_LIST, current.className);
-			graph.addCompilationUnit(unit);
-			requireMap.put(current.className, unit);
-			requireMap2.put(unit, current.className);
-		}
-		ArrayList<String> deps = current.deps;
-		for (String className : deps)
+		if (removeCirculars)
+			if (current.fileInfo.deps == null)
+				return;
+		
+		if (removeCirculars)
 		{
-			if (!isGoogClass(className))
+			unit = requireMap.get(current.className);
+			if (unit == null)
 			{
-				GoogDep gd = depMap.get(className);
-				if (gd != null && current.fileInfo.impls != null && current.fileInfo.impls.contains(className))
+				unit = new JSCompilationUnit(project, current.filePath, DefinitionPriority.BasePriority.SOURCE_LIST, current.className);
+				graph.addCompilationUnit(unit);
+				requireMap.put(current.className, unit);
+				requireMap2.put(unit, current.className);
+			}
+			if (current.fileInfo.staticDeps != null && removeCirculars)
+			{
+				for (String staticDep : current.fileInfo.staticDeps)
 				{
-					ICompilationUnit base = requireMap.get(className);
+					ICompilationUnit base = requireMap.get(staticDep);
 					if (base == null)
 					{
-						base = new JSCompilationUnit(project, className, DefinitionPriority.BasePriority.SOURCE_LIST, className);
+						base = new JSCompilationUnit(project, staticDep, DefinitionPriority.BasePriority.SOURCE_LIST, staticDep);
 						graph.addCompilationUnit(base);
-						requireMap.put(className, base);
-						requireMap2.put(base, className);
+						requireMap.put(staticDep, base);
+						requireMap2.put(base, staticDep);
 					}
+					System.out.println(current.className + " static initialization depends on " + staticDep);
 					graph.addDependency(unit, base, DependencyType.INHERITANCE);
+					
 				}
-				if (!visited.containsKey(className))
+			}
+		}
+		ArrayList<String> impls = current.fileInfo.impls != null ? current.fileInfo.impls : null;
+		if (impls != null)
+		{
+			for (String className : impls)
+			{
+				if (!isGoogClass(className))
 				{
+					GoogDep gd = depMap.get(className);
 					if (gd != null)
-						sortFunction(gd);
+					{
+						if (removeCirculars)
+						{
+							ICompilationUnit base = requireMap.get(className);
+							if (base == null)
+							{
+								base = new JSCompilationUnit(project, className, DefinitionPriority.BasePriority.SOURCE_LIST, className);
+								graph.addCompilationUnit(base);
+								requireMap.put(className, base);
+								requireMap2.put(base, className);
+							}
+							System.out.println(current.className + " depends on " + className);
+							graph.addDependency(unit, base, DependencyType.INHERITANCE);
+						}
+						if (!visited.containsKey(className))
+						{
+							sortFunction(gd, arr);
+						}
+					}
 				}
 			}
 		}
+		ArrayList<String> deps = current.deps;
+		for (String className : deps)
+		{
+			if (!isGoogClass(className))
+			{
+				GoogDep gd = depMap.get(className);
+				if (!visited.containsKey(className))
+				{
+					sortFunction(gd, arr);
+				}
+			}
+		}
+		arr.add(current);
 	}
 	
 	private void addRestOfDeps(GoogDep main, List<String> restOfDeps)
@@ -292,6 +346,13 @@ public class GoogDepsWriter {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
+		if (gd.fileInfo.impls != null)
+		{
+	        for (String dep : gd.fileInfo.impls)
+	        {
+	            addDeps(dep);
+	        }
+		}
 		gd.deps = new ArrayList<String>();
 		if (gd.fileInfo.deps != null)
 		{
@@ -314,6 +375,10 @@ public class GoogDepsWriter {
             List<String> fileLines = Files.readLines(new File(gd.filePath), Charset.defaultCharset());
             ArrayList<String> finalLines = new ArrayList<String>();
             
+            boolean firstDependency = true;
+        	StringBuilder sb = new StringBuilder();
+        	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
+        	
             FileInfo fi = gd.fileInfo;
             int suppressCount = 0;
             int i = 0;
@@ -321,7 +386,10 @@ public class GoogDepsWriter {
             {
             	if (i < fi.constructorLine)
             	{
-                    int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                    int c = line.indexOf(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
+                    if (c > -1)
+                    	return; // already been processed
+                    c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
                     if (c > -1)
                     {
                         int c2 = line.indexOf(")");
@@ -332,6 +400,10 @@ public class GoogDepsWriter {
                         	// time and that class is not this class
                         	suppressCount++;
                         	System.out.println(gd.filePath + " removing require: " + s);
+                    		if (!firstDependency)
+                    			sb.append(",");
+                    		sb.append(s);
+                    		firstDependency = false;
                         	continue;
 	                    }
                     }
@@ -401,6 +473,9 @@ public class GoogDepsWriter {
             		}                		
             	}
             }
+
+            sb.append("*/");
+            finalLines.add(gd.fileInfo.googProvideLine + 1, sb.toString());
             File file = new File(gd.filePath);  
             PrintWriter out = new PrintWriter(new FileWriter(file));  
             for (String s : finalLines)
@@ -421,7 +496,6 @@ public class GoogDepsWriter {
 		FileInfo fi = new FileInfo();
 		
 	    int n = lines.size();
-	    fi.constructorLine = n;
 	    fi.suppressLine = -1;
 	    fi.fileoverviewLine = -1;
 	    fi.googProvideLine = -1;
@@ -430,25 +504,9 @@ public class GoogDepsWriter {
 	    {
 	        String line = lines.get(i);
 	        int c2;
-	        int c = line.indexOf("goog.inherits");
-	        if (c > -1)
+	        int c = line.indexOf("*/");
+	        if (c > -1 && fi.constructorLine > 0)
 	        {
-	            String inheritLine = ""; 
-                while (true)
-                {
-                    inheritLine += line;
-                    c2 = line.indexOf(")");
-                    if (c2 > -1)
-                        break;
-                    else
-                    {
-                        i++;
-                        line = lines.get(i);
-                    }
-                }
-	            c = inheritLine.indexOf(",");
-                c2 = inheritLine.indexOf(")");
-                fi.inherits = inheritLine.substring(c + 1, c2).trim();
                 return fi;
 	        }
 	        else
@@ -525,9 +583,35 @@ public class GoogDepsWriter {
 						    				if (c > -1)
 						    				{
 						    					c2 = line.indexOf("*/");
-						    					line = line.substring(c + token.length(), c2 - 1);
+						    					line = line.substring(c + token.length(), c2);
 							        			fi.deps = new ArrayList<String>();
 						    					fi.deps.addAll(Arrays.asList(line.split(",")));
+						    					fi.depsLine = i;
+						    				}
+						    				else if (fi.depsLine == 0)
+						    				{
+						    					token = JSGoogEmitterTokens.GOOG_REQUIRE.getToken();
+						    					c = line.indexOf(token);
+						    					if (c > -1)
+						    					{
+						                            c2 = line.indexOf(")");
+						                            String s = line.substring(c + 14, c2 - 1);
+						                            if (fi.deps == null)
+						                            	fi.deps = new ArrayList<String>();
+						                            fi.deps.add(s);
+						    					}
+						    					else
+						    					{
+								        			token = JSGoogEmitterTokens.FLEXJS_STATIC_DEPENDENCY_LIST.getToken();
+								    				c = line.indexOf(token);
+								    				if (c > -1)
+								    				{
+								    					c2 = line.indexOf("*/");
+								    					line = line.substring(c + token.length(), c2);
+									        			fi.staticDeps = new ArrayList<String>();
+								    					fi.staticDeps.addAll(Arrays.asList(line.split(",")));
+								    				}						    						
+						    					}
 						    				}
 
 						        		}
@@ -736,10 +820,11 @@ public class GoogDepsWriter {
 	@SuppressWarnings( "unused" )
 	private class FileInfo
 	{
-		public String inherits;
 		public ArrayList<String> impls;
 		public ArrayList<String> deps;
+		public ArrayList<String> staticDeps;
 		public int constructorLine;
+		public int depsLine;
 		public int suppressLine;
 		public int fileoverviewLine;
 		public int googProvideLine;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index cad59fa..42ad2b3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -186,7 +186,7 @@ public class JSClosureCompilerWrapper
         options_.setExtraAnnotationNames(Arrays.asList(asdocTags));
     }
     
-    public void setOptions(String sourceMapPath, boolean useStrictPublishing, String projectName)
+    public void setOptions(String sourceMapPath, boolean useStrictPublishing, boolean manageDependencies, String projectName)
     {
         if (useStrictPublishing)
         {
@@ -232,9 +232,9 @@ public class JSClosureCompilerWrapper
             DependencyOptions dopts = new DependencyOptions();
             ArrayList<ModuleIdentifier> entryPoints = new ArrayList<ModuleIdentifier>();
             entryPoints.add(ModuleIdentifier.forClosure(projectName));
-            dopts.setDependencyPruning(false)
-                 .setDependencySorting(false)
-                 .setMoocherDropping(false)
+            dopts.setDependencyPruning(manageDependencies)
+                 .setDependencySorting(manageDependencies)
+                 .setMoocherDropping(manageDependencies)
                  .setEntryPoints(entryPoints);
             options_.setDependencyOptions(dopts);
             

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
index bdf031e..7245a17 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
@@ -106,6 +106,7 @@ public class NativeUtils
         parseFloat("parseFloat"),
         parseInt("parseInt"),
         String("String"),
+        undefined("undefined"),
         unescape("unescape"),
 
         // (erikdebruin) These aren't strictly 'native' to JS, but the 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index 6664be5..07c8000 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -468,7 +468,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         FileNode node = (FileNode)getNode("package org.apache.flex {\npublic class A {\nimport flash.display.Sprite; Sprite;\n}}", FileNode.class, 0);
         asBlockWalker.visitFile(node);
-        assertOut("/**\n * org.apache.flex.A\n *\n * @fileoverview\n *\n * @suppress {checkTypes|accessControls}\n */\n\ngoog.provide('org.apache.flex.A');\n\n/* FlexJS Dependency List: flash.display.Sprite*/\n\n\n\n/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
+        assertOut("/**\n * org.apache.flex.A\n *\n * @fileoverview\n *\n * @suppress {checkTypes|accessControls}\n */\n\ngoog.provide('org.apache.flex.A');\n\ngoog.require('flash.display.Sprite');\n\n\n\n/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index b03f72c..d49661d 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -316,7 +316,9 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.net.HTTPConstants*/\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
+        		"goog.require('org.apache.flex.html.Label');\n" +
+        		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -436,7 +438,9 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.net.HTTPConstants*/\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
+        		"goog.require('org.apache.flex.html.Label');\n" +
+        		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -557,7 +561,9 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"/* FlexJS Dependency List: binding.ComplexValueObject,org.apache.flex.core.View,org.apache.flex.html.Label*/\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
+        		"goog.require('org.apache.flex.html.Label');\n" +
+        		"goog.require('binding.ComplexValueObject');\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -710,8 +716,10 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.core.Application,XML*/\n" +
-        		"\n" +
+        		"goog.require('org.apache.flex.core.View');\n" +
+        		"goog.require('org.apache.flex.html.Label');\n" +
+        		"goog.require('XML');\n" +
+        		"goog.require('XML');\n" +
         		"\n" +
         		"\n" +
         		"\n" +

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
index fa34845..7da2ae9 100644
--- a/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
@@ -22,7 +22,15 @@
 goog.provide('FlexJSTest_again');
 
 goog.require('org.apache.flex.core.Application');
-/* FlexJS Dependency List: MyInitialView,StockDataJSONItemConverter,controllers.MyController,models.MyModel,org.apache.flex.collections.LazyCollection,org.apache.flex.collections.parsers.JSONInputParser,org.apache.flex.core.SimpleCSSValuesImpl,org.apache.flex.events.Event,org.apache.flex.net.HTTPService*/
+goog.require('org.apache.flex.core.SimpleCSSValuesImpl');
+goog.require('MyInitialView');
+goog.require('models.MyModel');
+goog.require('controllers.MyController');
+goog.require('org.apache.flex.net.HTTPService');
+goog.require('org.apache.flex.collections.LazyCollection');
+goog.require('org.apache.flex.collections.parsers.JSONInputParser');
+goog.require('StockDataJSONItemConverter');
+goog.require('org.apache.flex.events.Event');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js b/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
index 1869f7a..1bc0837 100644
--- a/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
@@ -22,7 +22,21 @@
 goog.provide('MyInitialView');
 
 goog.require('org.apache.flex.core.View');
-/* FlexJS Dependency List: org.apache.flex.binding.ConstantBinding,org.apache.flex.binding.SimpleBinding,org.apache.flex.events.CustomEvent,org.apache.flex.events.Event,org.apache.flex.events.MouseEvent,org.apache.flex.html.CheckBox,org.apache.flex.html.ComboBox,org.apache.flex.html.DropDownList,org.apache.flex.html.Label,org.apache.flex.html.List,org.apache.flex.html.RadioButton,org.apache.flex.html.TextArea,org.apache.flex.html.TextButton,org.apache.flex.html.TextInput,org.apache.flex.utils.Timer*/
+goog.require('org.apache.flex.html.Label');
+goog.require('org.apache.flex.binding.SimpleBinding');
+goog.require('org.apache.flex.html.TextButton');
+goog.require('org.apache.flex.html.List');
+goog.require('org.apache.flex.binding.ConstantBinding');
+goog.require('org.apache.flex.html.TextArea');
+goog.require('org.apache.flex.html.TextInput');
+goog.require('org.apache.flex.html.CheckBox');
+goog.require('org.apache.flex.html.RadioButton');
+goog.require('org.apache.flex.html.DropDownList');
+goog.require('org.apache.flex.html.ComboBox');
+goog.require('org.apache.flex.events.CustomEvent');
+goog.require('org.apache.flex.events.Event');
+goog.require('org.apache.flex.events.MouseEvent');
+goog.require('org.apache.flex.utils.Timer');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js b/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
index 9660e90..7fde95a 100644
--- a/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
@@ -21,9 +21,11 @@
 
 goog.provide('controllers.MyController');
 
-/* FlexJS Dependency List: FlexJSTest_again,MyInitialView,models.MyModel,org.apache.flex.utils.Language*/
-
+goog.require('FlexJSTest_again');
+goog.require('MyInitialView');
+goog.require('models.MyModel');
 goog.require('org.apache.flex.core.IDocument');
+goog.require('org.apache.flex.utils.Language');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js b/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
index 451f6f6..ff0160f 100644
--- a/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
@@ -21,9 +21,8 @@
 
 goog.provide('models.MyModel');
 
+goog.require('org.apache.flex.events.Event');
 goog.require('org.apache.flex.events.EventDispatcher');
-/* FlexJS Dependency List: org.apache.flex.events.Event*/
-
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js b/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
index b7fadeb..7bc6a18 100644
--- a/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
@@ -22,7 +22,7 @@
 goog.provide('wildcard_import');
 
 goog.require('org.apache.flex.core.Application');
-/* FlexJS Dependency List: org.apache.flex.html.Button*/
+goog.require('org.apache.flex.html.Button');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js b/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
index 3d9a208..d2f47bd 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
@@ -22,10 +22,10 @@
 goog.provide('Test');
 
 goog.require('classes.A');
-/* FlexJS Dependency List: interfaces.IC,org.apache.flex.utils.Language*/
-
 goog.require('interfaces.IA');
+goog.require('interfaces.IC');
 goog.require('interfaces.IE');
+goog.require('org.apache.flex.utils.Language');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
index 10e2247..a96b203 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('MainClass');
 
-/* FlexJS Dependency List: OtherClass*/
-
+goog.require('OtherClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
index befa608..deee65d 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('DifferentPackageAsConflict');
 
-/* FlexJS Dependency List: mypackage.TestClass*/
-
+goog.require('mypackage.TestClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
index f950891..229dbc2 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
@@ -22,8 +22,7 @@
 
 goog.provide('mypackage.TestClass');
 
-/* FlexJS Dependency List: otherpackage.Event*/
-
+goog.require('otherpackage.Event');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
index 4b4238f..54347bc 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('NoConflictNoWindow');
 
-/* FlexJS Dependency List: mypackage.TestClass*/
-
+goog.require('mypackage.TestClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
index b5719d6..c99ffad 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('NoConflictUseWindow');
 
-/* FlexJS Dependency List: mypackage.TestClass*/
-
+goog.require('mypackage.TestClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
index e9cf354..83f36cc 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('SamePackageAsConflict');
 
-/* FlexJS Dependency List: mypackage.TestClass*/
-
+goog.require('mypackage.TestClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
index cd6e7a6..fbb13ea 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
@@ -22,8 +22,7 @@
 
 goog.provide('mypackage.TestClass');
 
-/* FlexJS Dependency List: mypackage.Event*/
-
+goog.require('mypackage.Event');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
index 629b8e5..ca1d8dd 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('UseWindow');
 
-/* FlexJS Dependency List: mypackage.TestClass*/
-
+goog.require('mypackage.TestClass');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
index 9ec0d4f..7af3f86 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
@@ -22,8 +22,7 @@
 
 goog.provide('mypackage.TestClass');
 
-/* FlexJS Dependency List: otherpackage.Event*/
-
+goog.require('otherpackage.Event');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fc1fa430/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js b/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
index c788cf8..17ab6dc 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('XMLRequire');
 
-/* FlexJS Dependency List: XML*/
-
+goog.require('XML');
 
 
 


[33/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: moved MXML source maps tests into the integration tests for flex-asjs

Posted by ah...@apache.org.
compiler-jx: moved MXML source maps tests into the integration tests for flex-asjs


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

Branch: refs/heads/dual
Commit: 6593d848a4d24a7e65144a3a964e4008919b5b0e
Parents: bd9a27e
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 28 06:54:42 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 28 06:54:42 2017 -0700

----------------------------------------------------------------------
 compiler-jx/src/test/build.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6593d848/compiler-jx/src/test/build.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/build.xml b/compiler-jx/src/test/build.xml
index 9f8a196..a5d2409 100644
--- a/compiler-jx/src/test/build.xml
+++ b/compiler-jx/src/test/build.xml
@@ -70,6 +70,7 @@
                     <include name="**/Test*.class"/>
                     <exclude name="**/TestFlexJSFile.class"/>
                     <exclude name="**/TestFlexJSMXML*.class"/>
+                    <exclude name="**/TestSourceMapMXML*.class"/>
                     <exclude name="**/TestMXML*.class"/>
                     <!-- externs tests -->
                     <exclude name="**/TestFlexJSClass.class"/>
@@ -107,6 +108,7 @@
                 <fileset dir="${compiler}/target/test-classes">
                     <include name="**/TestFlexJSFile.class"/>
                     <include name="**/TestFlexJSMXML*.class"/>
+                    <include name="**/TestSourceMapMXML*.class"/>
                 </fileset>
             </batchtest>
             <formatter type="xml"/>


[47/50] git commit: [flex-falcon] [refs/heads/dual] - this test result was wrong and we didn't notice

Posted by ah...@apache.org.
this test result was wrong and we didn't notice


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

Branch: refs/heads/dual
Commit: eb2f34dd2a2bebc6dbbe114b56ab5ed9d3b27e33
Parents: c5286f5
Author: Alex Harui <ah...@apache.org>
Authored: Mon Apr 3 06:41:59 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Apr 3 06:41:59 2017 -0700

----------------------------------------------------------------------
 .../internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java   | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/eb2f34dd/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index d49661d..f91a1dd 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -143,6 +143,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"/**\n" +
         		" * @constructor\n" +
         		" * @extends {org.apache.flex.core.Application}\n" +
+        		" * @implements {org.apache.flex.core.IChrome}\n" +
         		" */\n" +
         		"AppName = function() {\n" +
         		"  AppName.base(this, 'constructor');\n" +
@@ -234,6 +235,8 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"/**\n" +
         		" * @constructor\n" +
         		" * @extends {org.apache.flex.core.Application}\n" +
+        		" * @implements {org.apache.flex.core.IChrome}\n" +
+        		" * @implements {org.apache.flex.core.IPopUp}\n" +
         		" */\n" +
         		"AppName = function() {\n" +
         		"  AppName.base(this, 'constructor');\n" +


[20/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: tests for source maps in MXML Script blocks

Posted by ah...@apache.org.
compiler-jx: tests for source maps in MXML Script blocks


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

Branch: refs/heads/dual
Commit: de8288496481a8349ec47a2be7fee01993e595fa
Parents: 83b00a0
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 21 16:06:53 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 21 16:06:53 2017 -0700

----------------------------------------------------------------------
 .../sourcemaps/TestSourceMapMXMLScript.java     | 77 ++++++++++++++++++++
 .../internal/test/FlexJSSourceMapTestBase.java  | 64 ++++++++++++++++
 .../compiler/internal/test/FlexJSTestBase.java  | 33 +++++++++
 3 files changed, 174 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/de828849/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLScript.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLScript.java
new file mode 100644
index 0000000..591e6e5
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLScript.java
@@ -0,0 +1,77 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.flex.compiler.internal.codegen.mxml.sourcemaps;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
+import org.apache.flex.compiler.internal.test.FlexJSSourceMapTestBase;
+import org.apache.flex.compiler.internal.test.TestBase;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
+public class TestSourceMapMXMLScript extends FlexJSSourceMapTestBase
+{
+    @Test
+    public void testField()
+    {
+        String code = "var foo;";
+
+        IVariableNode node = (IVariableNode) getASNode(code, IVariableNode.class);
+        IMXMLDocumentNode dnode = (IMXMLDocumentNode) node
+                .getAncestorOfType(IMXMLDocumentNode.class);
+        IClassDefinition definition = dnode.getClassDefinition();
+        ((JSFlexJSEmitter)(mxmlBlockWalker.getASEmitter())).getModel().setCurrentClass(definition);
+        mxmlBlockWalker.visitDocument(dnode);
+        String definitionName = definition.getQualifiedName();
+        assertTrue(definitionName.startsWith(getClass().getSimpleName()));
+        int endColumn = definitionName.length() + 14;
+        ///**\n * @export\n * @type {*}\n */\nFalconTest_A.prototype.foo
+        assertMapping(node, 0, 4, 42, 0, 42, endColumn);  // foo
+    }
+
+    @Test
+    public void testMethod()
+    {
+        String code = "function foo(){};";
+
+        IFunctionNode node = (IFunctionNode) getASNode(code, IFunctionNode.class);
+        IMXMLDocumentNode dnode = (IMXMLDocumentNode) node
+                .getAncestorOfType(IMXMLDocumentNode.class);
+        IClassDefinition definition = dnode.getClassDefinition();
+        ((JSFlexJSEmitter)(mxmlBlockWalker.getASEmitter())).getModel().setCurrentClass(definition);
+        mxmlBlockWalker.visitDocument(dnode);
+        String definitionName = definition.getQualifiedName();
+        assertTrue(definitionName.startsWith(getClass().getSimpleName()));
+        int nameEndColumn = definitionName.length() + 14;
+        ///**\n * @export\n * @type {*}\n */\nFalconTest_A.prototype.foo
+        assertMapping(node, 0, 9, 38, 0, 38, nameEndColumn);  // foo
+        assertMapping(node, 0, 0, 38, nameEndColumn, 38, nameEndColumn + 11);  // = function
+        assertMapping(node, 0, 12, 38, nameEndColumn + 11, 38, nameEndColumn + 12);  // (
+        assertMapping(node, 0, 13, 38, nameEndColumn + 12, 38, nameEndColumn + 13);  // )
+        assertMapping(node, 0, 14, 38, nameEndColumn + 14, 38, nameEndColumn + 15);  // {
+        assertMapping(node, 0, 15, 39, 0, 39, 1);  // }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/de828849/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSSourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSSourceMapTestBase.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSSourceMapTestBase.java
new file mode 100644
index 0000000..9be5b2a
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSSourceMapTestBase.java
@@ -0,0 +1,64 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.flex.compiler.internal.test;
+
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLNode;
+
+import com.google.debugging.sourcemap.FilePosition;
+import static org.junit.Assert.assertTrue;
+
+public class FlexJSSourceMapTestBase extends FlexJSTestBase
+{
+    protected void assertMapping(IASNode node, int nodeStartLine, int nodeStartColumn,
+                                 int outStartLine, int outStartColumn, int outEndLine, int outEndColumn)
+    {
+        int sourceStartLine = nodeStartLine + node.getLine();
+        int sourceStartColumn = nodeStartColumn;
+        if (nodeStartLine == 0)
+        {
+            sourceStartColumn += node.getColumn();
+        }
+        boolean foundMapping = false;
+        IMappingEmitter emitter = (IMappingEmitter) mxmlEmitter;
+        List<IMappingEmitter.SourceMapMapping> mappings = emitter.getSourceMapMappings();
+        for (IMappingEmitter.SourceMapMapping mapping : mappings)
+        {
+            FilePosition sourcePosition = mapping.sourceStartPosition;
+            FilePosition startPosition = mapping.destStartPosition;
+            FilePosition endPosition = mapping.destEndPosition;
+            if (sourcePosition.getLine() == sourceStartLine
+                    && sourcePosition.getColumn() == sourceStartColumn
+                    && startPosition.getLine() == outStartLine
+                    && startPosition.getColumn() == outStartColumn
+                    && endPosition.getLine() == outEndLine
+                    && endPosition.getColumn() == outEndColumn)
+            {
+                foundMapping = true;
+                break;
+            }
+        }
+        assertTrue("Mapping not found for node " + node.getNodeID() + ". Expected "
+                        + "source: (" + nodeStartLine + ", " + nodeStartColumn + "), dest: (" + outStartLine + ", " + outStartColumn + ") to (" + outEndLine + ", " + outEndColumn + ")",
+                foundMapping);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/de828849/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
index c3f379c..30fcebc 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
@@ -26,8 +26,10 @@ import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
 import org.apache.flex.compiler.internal.mxml.MXMLNamespaceMapping;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
+import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.flex.utils.FilenameNormalization;
 import org.apache.flex.utils.ITestAdapter;
 import org.apache.flex.utils.TestAdapterFactory;
@@ -47,6 +49,7 @@ public class FlexJSTestBase extends TestBase
 
         asEmitter = backend.createEmitter(writer);
         mxmlEmitter = backend.createMXMLEmitter(writer);
+        asEmitter.setParentEmitter(mxmlEmitter);
 
         asBlockWalker = backend.createWalker(project, errors, asEmitter);
         mxmlBlockWalker = backend.createMXMLWalker(project, errors,
@@ -105,19 +108,49 @@ public class FlexJSTestBase extends TestBase
     public static final int WRAP_LEVEL_NONE = 0;
     public static final int WRAP_LEVEL_DOCUMENT = 1;
 
+    protected IASNode getASNode(String code, Class<? extends IASNode> type)
+    {
+        code = ""
+                + "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\"><fx:Script><![CDATA["
+                + code + "]]></fx:Script></basic:Application>";
+
+        IMXMLFileNode node = compileMXML(code);
+
+        return findFirstASDescendantOfType(node, type);
+    }
+
     protected IMXMLNode getNode(String code, Class<? extends IMXMLNode> type,
             int wrapLevel)
     {
         if (wrapLevel >= WRAP_LEVEL_DOCUMENT)
+        {
             code = ""
                     + "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
                     + code + "</basic:Application>";
+        }
 
         IMXMLFileNode node = compileMXML(code);
 
         return findFirstDescendantOfType(node, type);
     }
 
+    protected IASNode findFirstASDescendantOfType(IMXMLNode node,
+                                                  Class<? extends IASNode> nodeType)
+    {
+        IMXMLScriptNode scriptNode = (IMXMLScriptNode) findFirstDescendantOfType(node, IMXMLScriptNode.class);
+        if (scriptNode != null)
+        {
+            for (IASNode asNode : scriptNode.getASNodes())
+            {
+                if (nodeType.isInstance(asNode))
+                {
+                    return asNode;
+                }
+            }
+        }
+        return null;
+    }
+
     protected IMXMLNode findFirstDescendantOfType(IMXMLNode node,
             Class<? extends IMXMLNode> nodeType)
     {


[43/50] git commit: [flex-falcon] [refs/heads/dual] - i guess some identifers are not functions

Posted by ah...@apache.org.
i guess some identifers are not functions


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

Branch: refs/heads/dual
Commit: f0315f6fa3985d51d15ffbe540ae37f173b43d1c
Parents: a8f7a5c
Author: Alex Harui <ah...@apache.org>
Authored: Fri Mar 31 07:30:55 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Mar 31 07:30:55 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/jx/FieldEmitter.java | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f0315f6f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index 07d23a3..ef62ad2 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -120,12 +120,16 @@ public class FieldEmitter extends JSSubEmitter implements
             	{
             		// assume this is a call to static method in the class
             		// otherwise it would be a memberaccessexpression?
-            		FunctionDefinition fd = (FunctionDefinition)fcn.getNameNode().resolve(getProject());
-            		IASNode m = fd.getNode();
-            		if (m != null)
+            		IDefinition d = (IDefinition)fcn.getNameNode().resolve(getProject());
+            		if (d instanceof FunctionDefinition)
             		{
-	            		// re-emit it to collect static initializer class references in usedNames
-	            		getEmitter().stringifyNode(m);
+            			FunctionDefinition fd = (FunctionDefinition)d;
+                		IASNode m = fd.getNode();
+                		if (m != null)
+                		{
+    	            		// re-emit it to collect static initializer class references in usedNames
+    	            		getEmitter().stringifyNode(m);
+                		}
             		}
             	}
             }


[45/50] git commit: [flex-falcon] [refs/heads/dual] - MXML output wasn't including interface impls

Posted by ah...@apache.org.
MXML output wasn't including interface impls


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

Branch: refs/heads/dual
Commit: da2d6923702c70880a35e675ac0be6bd41b06d84
Parents: 4930a2a
Author: Alex Harui <ah...@apache.org>
Authored: Sun Apr 2 23:25:10 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Apr 2 23:25:10 2017 -0700

----------------------------------------------------------------------
 .../internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java      | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/da2d6923/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 74fa0a5..573e0ff 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -691,6 +691,14 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writeNewline("/**");
         writeNewline(" * @constructor");
         writeNewline(" * @extends {" + formatQualifiedName(baseClassName) + "}");
+        if (interfaceList != null && interfaceList.length() > 0)
+        {
+        	String[] interfaces = interfaceList.split(",");
+        	for (String iface : interfaces)
+        	{
+        		writeNewline(" * @implements {" + formatQualifiedName(iface.trim()) + "}");
+        	}
+        }
         writeNewline(" */");
         writeToken(formatQualifiedName(cname));
         writeToken(ASEmitterTokens.EQUAL);


[31/50] git commit: [flex-falcon] [refs/heads/dual] - try to be more tolerant of non-subsetted Google Closure Library folders

Posted by ah...@apache.org.
try to be more tolerant of non-subsetted Google Closure Library folders


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

Branch: refs/heads/dual
Commit: 71b84cb909137202f10235640c59523315f00223
Parents: 50dd25d
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 27 19:29:54 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 27 19:29:54 2017 -0700

----------------------------------------------------------------------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 93 ++++++++++----------
 1 file changed, 46 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/71b84cb9/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 742d806..838b1f7 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -380,57 +380,56 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
     protected List<SourceFile> closureFilesInOrder(String path, List<SourceFile> files, String entryPoint)
     {
     	ArrayList<String> sortedFiles = new ArrayList<String>();
+    	HashMap<String, SourceFile> fileMap = new HashMap<String, SourceFile>();
+    	SourceFile depsFile = null;
     	
     	for (SourceFile sourceFile : files)
     	{
-    		if (sourceFile.getOriginalPath().endsWith("deps.js"))
-    		{
-    			ArrayList<String> deps = new ArrayList<String>();
-    	        try
-    	        {
-    	            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path + sourceFile.getOriginalPath()), "UTF8"));
-
-    	            while (true)
-    	            {
-	    	            String line = in.readLine();
-	    	            if (line.startsWith("//") || line.trim().length() == 0)
-	    	            	continue;
-	    	            deps.add(line);
-    	            }
-    	        }
-	            catch (Exception e)
-	            {
-	                // nothing to see, move along...
-	            }
-
-	            sortClosureFile(deps, entryPoint, sortedFiles);
-	            
-	            ArrayList<SourceFile> list = new ArrayList<SourceFile>();
-	            ArrayList<String> seen = new ArrayList<String>();
-	            sortedFiles.add("goog/deps.js");
-	            sortedFiles.add("goog/base.js");
-	            int n = sortedFiles.size();
-	            for (int i = n - 1; i >= 0; i--)
-	            {
-	            	String fileName = sortedFiles.get(i);
-	            	if (seen.contains(fileName)) continue;
-	            	seen.add(fileName);
-	            	
-	            	for (SourceFile file : files)
-	            	{
-	            		if (file.getOriginalPath().contains(fileName))
-	            		{
-	            			list.add(file);
-	            			files.remove(file);
-	            			break;
-	            		}
-	            	}
-	            }
-	            list.addAll(files);
-	            return list;
-    		}
+    		if ((sourceFile.getOriginalPath().endsWith("goog/deps.js") || sourceFile.getOriginalPath().endsWith("goog\\deps.js")) &&
+        		!(sourceFile.getOriginalPath().endsWith("third_party/goog/deps.js") || sourceFile.getOriginalPath().endsWith("third_party\\goog\\deps.js")))
+    			depsFile = sourceFile;
+    		System.out.println("originalPath: " + sourceFile.getOriginalPath());
+    		fileMap.put(sourceFile.getOriginalPath(), sourceFile);
     	}
-    	return null;
+    	
+		ArrayList<String> deps = new ArrayList<String>();
+        try
+        {
+            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path + depsFile.getOriginalPath()), "UTF8"));
+
+            while (true)
+            {
+	            String line = in.readLine();
+	            if (line.startsWith("//") || line.trim().length() == 0)
+	            	continue;
+	            deps.add(line);
+            }
+        }
+        catch (Exception e)
+        {
+            // nothing to see, move along...
+        }
+
+        sortClosureFile(deps, entryPoint, sortedFiles);
+        
+        ArrayList<SourceFile> list = new ArrayList<SourceFile>();
+        ArrayList<String> seen = new ArrayList<String>();
+        sortedFiles.add("deps.js");
+        sortedFiles.add("base.js");
+        // in dual branch, add this to node publisher
+        sortedFiles.add("bootstrap/nodejs.js");
+        int n = sortedFiles.size();
+        for (int i = n - 1; i >= 0; i--)
+        {
+        	String fileName = sortedFiles.get(i);
+        	System.out.println("sorted filename: " + fileName);
+        	if (seen.contains(fileName)) 
+        		continue;
+        	seen.add(fileName);
+        	
+        	list.add(fileMap.get("goog/" + fileName));
+        }
+        return list;
     }
     
     private void sortClosureFile(List<String> deps, String entryPoint, List<String> sortedFiles)


[09/50] git commit: [flex-falcon] [refs/heads/dual] - try computing the file order ourselves

Posted by ah...@apache.org.
try computing the file order ourselves


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

Branch: refs/heads/dual
Commit: 0b07c7babfd94486262e16b8d96ea7ab321b9a9a
Parents: aee4ae3
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 13 10:32:05 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 13 10:32:14 2017 -0700

----------------------------------------------------------------------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 133 +++++++++++++++++++
 .../utils/JSClosureCompilerWrapper.java         |  10 +-
 2 files changed, 140 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0b07c7ba/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 95eea2b..dfcb73d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -237,6 +237,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         }
         // Dump a copy of the closure lib files to the intermediate directory. Without this
         // the application will not be able to run.
+        closureSourceFiles = closureFilesInOrder(intermediateDir + "/library/closure/", closureSourceFiles, "goog.events.EventTarget");
         for(SourceFile closureSourceFile : closureSourceFiles) {
             FileUtils.write(new File(new File(intermediateDir, "library/closure"),
                     closureSourceFile.getName()), closureSourceFile.getCode());
@@ -410,6 +411,138 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         }
     }
 
+    protected List<SourceFile> closureFilesInOrder(String path, List<SourceFile> files, String entryPoint)
+    {
+    	ArrayList<String> sortedFiles = new ArrayList<String>();
+    	
+    	for (SourceFile sourceFile : files)
+    	{
+    		if (sourceFile.getOriginalPath().endsWith("deps.js"))
+    		{
+    			ArrayList<String> deps = new ArrayList<String>();
+    	        try
+    	        {
+    	            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(path + sourceFile.getOriginalPath()), "UTF8"));
+
+    	            while (true)
+    	            {
+	    	            String line = in.readLine();
+	    	            if (line.startsWith("//") || line.trim().length() == 0)
+	    	            	continue;
+	    	            deps.add(line);
+    	            }
+    	        }
+	            catch (Exception e)
+	            {
+	                // nothing to see, move along...
+	            }
+
+	            sortClosureFile(deps, entryPoint, sortedFiles);
+	            
+	            ArrayList<SourceFile> list = new ArrayList<SourceFile>();
+	            ArrayList<String> seen = new ArrayList<String>();
+	            sortedFiles.add("goog/deps.js");
+	            sortedFiles.add("goog/base.js");
+	            int n = sortedFiles.size();
+	            for (int i = n - 1; i >= 0; i--)
+	            {
+	            	String fileName = sortedFiles.get(i);
+	            	if (seen.contains(fileName)) continue;
+	            	seen.add(fileName);
+	            	
+	            	for (SourceFile file : files)
+	            	{
+	            		if (file.getOriginalPath().contains(fileName))
+	            		{
+	            			list.add(file);
+	            			files.remove(file);
+	            			break;
+	            		}
+	            	}
+	            }
+	            list.addAll(files);
+	            return list;
+    		}
+    	}
+    	return null;
+    }
+    
+    private void sortClosureFile(List<String> deps, String entryPoint, List<String> sortedFiles)
+    {
+    	String provided = getProvidedFile(deps, entryPoint);
+        sortedFiles.add(provided);
+        List<String> reqs = getRequires(deps, entryPoint);
+        if (reqs == null) return;
+        for (String req : reqs)
+        {
+        	sortClosureFile(deps, req, sortedFiles);
+        }
+    }
+    
+    private String getProvidedFile(List<String> deps, String name)
+    {
+    	for (String dep : deps)
+    	{
+    		int open = dep.indexOf("[");
+    		int close = dep.indexOf("]");
+			String list = dep.substring(open + 1, close);
+			String[] parts = list.split(",");
+			ArrayList<String> provideds = new ArrayList<String>();
+			for (String part : parts)
+			{
+				part = part.trim();
+				if (part.startsWith("'"))
+					part = part.substring(1, part.length() - 1);
+				provideds.add(part);    				
+			}
+    		if (provideds.contains(name))
+    		{
+    			open = dep.indexOf("'");
+    			close = dep.indexOf("'", open + 1);
+    			return dep.substring(open + 1, close);    			
+    		}
+    	}
+    	return null;
+    }
+    
+    private List<String> getRequires(List<String> deps, String name)
+    {
+    	for (String dep : deps)
+    	{
+    		int open = dep.indexOf("[");
+    		int close = dep.indexOf("]");
+			String list = dep.substring(open + 1, close);
+			String[] parts = list.split(",");
+			ArrayList<String> provideds = new ArrayList<String>();
+			for (String part : parts)
+			{
+				part = part.trim();
+				if (part.startsWith("'"))
+					part = part.substring(1, part.length() - 1);
+				provideds.add(part);    				
+			}
+    		if (provideds.contains(name))
+    		{
+    			open = dep.indexOf("[", close + 1);
+    			close = dep.indexOf("]", open + 1);
+    			if (open + 1 == close)
+    				return null;
+    			String list2 = dep.substring(open + 1, close);
+    			String[] parts2 = list2.split(",");
+    			ArrayList<String> reqs = new ArrayList<String>();
+    			for (String part : parts2)
+    			{
+    				part = part.trim();
+    				if (part.startsWith("'"))
+    					part = part.substring(1, part.length() - 1);
+    				reqs.add(part);    				
+    			}
+    			return reqs;
+    		}
+    	}
+    	return null;
+    }    
+
     protected String readCode(File file)
     {
         String code = "";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0b07c7ba/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index 1757727..cad59fa 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -102,6 +102,10 @@ public class JSClosureCompilerWrapper
 
     public void compile()
     {
+    	System.out.println("list of source files");
+    	for (SourceFile file : jsSourceFiles_)
+    		System.out.println(file.getName());
+    	System.out.println("end of list of source files");
         compiler_.compile(jsExternsFiles_, jsSourceFiles_, options_);
 
         try
@@ -228,9 +232,9 @@ public class JSClosureCompilerWrapper
             DependencyOptions dopts = new DependencyOptions();
             ArrayList<ModuleIdentifier> entryPoints = new ArrayList<ModuleIdentifier>();
             entryPoints.add(ModuleIdentifier.forClosure(projectName));
-            dopts.setDependencyPruning(true)
-                 .setDependencySorting(true)
-                 .setMoocherDropping(true)
+            dopts.setDependencyPruning(false)
+                 .setDependencySorting(false)
+                 .setMoocherDropping(false)
                  .setEntryPoints(entryPoints);
             options_.setDependencyOptions(dopts);
             


[46/50] git commit: [flex-falcon] [refs/heads/dual] - don't remove requires for static deps

Posted by ah...@apache.org.
don't remove requires for static deps


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

Branch: refs/heads/dual
Commit: c5286f512ac2d9addbaccd489451a6e42f47e666
Parents: da2d692
Author: Alex Harui <ah...@apache.org>
Authored: Sun Apr 2 23:26:25 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Apr 2 23:26:25 2017 -0700

----------------------------------------------------------------------
 .../apache/flex/compiler/internal/graph/GoogDepsWriter.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c5286f51/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 9d3439f..6065efc 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -415,10 +415,11 @@ public class GoogDepsWriter {
                     {
                         int c2 = line.indexOf(")");
                         String s = line.substring(c + 14, c2 - 1);
-                        if (gd.fileInfo.impls == null || !gd.fileInfo.impls.contains(s))
+                        if ((gd.fileInfo.impls == null || !gd.fileInfo.impls.contains(s)) &&
+                        		(gd.fileInfo.staticDeps == null || !gd.fileInfo.staticDeps.contains(s)))
                         {
-                        	// don't add the require if some class needs it at static initialization
-                        	// time and that class is not this class
+                        	// don't remove the require if some class needs it at static initialization
+                        	// time
                         	suppressCount++;
                         	System.out.println(gd.filePath + " removing require: " + s);
                     		if (!firstDependency)


[12/50] git commit: [flex-falcon] [refs/heads/dual] - report on unexpected condition

Posted by ah...@apache.org.
report on unexpected condition


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

Branch: refs/heads/dual
Commit: 65ef0d9a5daf0964783e96c8ef7ab0a25d593323
Parents: 200c568
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 14 15:36:54 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 14 15:36:54 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/compiler/internal/graph/GoogDepsWriter.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/65ef0d9a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 5833696..187ca8f 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -372,6 +372,11 @@ public class GoogDepsWriter {
 	boolean onProtoChain(String name, String base)
 	{
 		GoogDep gd = depMap.get(name);
+		if (gd == null)
+		{
+			System.out.println("no dep info for " + name);
+			return false;
+		}
 		if (gd.fileInfo.impls != null)
 		{
 			if (gd.fileInfo.impls.contains(base))


[42/50] git commit: [flex-falcon] [refs/heads/dual] - parseFloat and others don't have a node?

Posted by ah...@apache.org.
parseFloat and others don't have a node?


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

Branch: refs/heads/dual
Commit: a8f7a5cc0a5f4e7f62335bba311ab23ce0cad20c
Parents: 5331a77
Author: Alex Harui <ah...@apache.org>
Authored: Thu Mar 30 12:16:15 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Mar 30 12:16:15 2017 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/codegen/js/jx/FieldEmitter.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a8f7a5cc/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index 7fabff0..07d23a3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -122,8 +122,11 @@ public class FieldEmitter extends JSSubEmitter implements
             		// otherwise it would be a memberaccessexpression?
             		FunctionDefinition fd = (FunctionDefinition)fcn.getNameNode().resolve(getProject());
             		IASNode m = fd.getNode();
-            		// re-emit it to collect static initializer class references in usedNames
-            		getEmitter().stringifyNode(m);
+            		if (m != null)
+            		{
+	            		// re-emit it to collect static initializer class references in usedNames
+	            		getEmitter().stringifyNode(m);
+            		}
             	}
             }
         	getModel().inStaticInitializer = false;


[23/50] git commit: [flex-falcon] [refs/heads/dual] - MXMLFlexJSEmitter: source maps for MXML event attributes

Posted by ah...@apache.org.
MXMLFlexJSEmitter: source maps for MXML event attributes


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

Branch: refs/heads/dual
Commit: 379b039276bd89f2661de04ca53312fa42779b35
Parents: 548283e
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Mar 23 15:43:47 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Mar 23 15:43:47 2017 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLEventSpecifier.java |  3 ++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 42 +++++++++-----------
 2 files changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/379b0392/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
index d419df6..ab40ca6 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 
 /**
  * @author Erik de Bruin
@@ -68,6 +69,8 @@ public class MXMLEventSpecifier extends MXMLNodeSpecifier
     //---------------------------------
 
     public String type;
+    
+    public IMXMLEventSpecifierNode node;
 
     //--------------------------------------------------------------------------
     //

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/379b0392/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 207e671..6728cc2 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -33,6 +33,7 @@ import java.util.Set;
 import org.apache.flex.abc.semantics.MethodInfo;
 import org.apache.flex.abc.semantics.Name;
 import org.apache.flex.abc.semantics.Namespace;
+import org.apache.flex.compiler.codegen.IEmitterTokens;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
@@ -1518,8 +1519,19 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                     + ".prototype." + event.eventHandler + " = function(event)");
             writeNewline(ASEmitterTokens.BLOCK_OPEN, true);
 
-            writeNewline(event.value + ASEmitterTokens.SEMICOLON.getToken(),
-                    false);
+
+            IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
+                    .getASEmitter();
+            
+            IMXMLEventSpecifierNode node = event.node;
+            int len = node.getChildCount();
+            for (int i = 0; i < len; i++)
+            {
+                IASNode cnode = node.getChild(i);
+                asEmitter.getWalker().walk(cnode);
+                writeToken(ASEmitterTokens.SEMICOLON);
+                writeNewline();
+            }
 
             write(ASEmitterTokens.BLOCK_CLOSE);
             writeNewline(";");
@@ -1671,27 +1683,11 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 .getTypeAsDisplayString();
 
         eventHandlerNameMap.put(node, eventSpecifier.eventHandler);
-        
-        IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
-                .getASEmitter();
 
-        StringBuilder sb = null;
-        int len = node.getChildCount();
-        if (len > 0)
-        {
-            sb = new StringBuilder();
-            for (int i = 0; i < len; i++)
-            {
-                sb.append(getIndent((i > 0) ? 1 : 0)
-                        + asEmitter.stringifyNode(node.getChild(i)));
-                if (i < len - 1)
-                {
-                    sb.append(ASEmitterTokens.SEMICOLON.getToken());
-                    sb.append(ASEmitterTokens.NEW_LINE.getToken());
-                }
-            }
-        }
-        eventSpecifier.value = sb.toString();
+        //save the node for emitting later in emitEvents()
+        //previously, we stringified the node and saved that instead of the
+        //node, but source maps don't work when you stringify a node too early -JT
+        eventSpecifier.node = node;
 
 	    if (currentDescriptor != null)
 	        currentDescriptor.eventSpecifiers.add(eventSpecifier);
@@ -2263,7 +2259,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     {
         //save the script for emitting later in emitScripts()
         //previously, we stringified the node and saved that instead of the
-        //node, but source maps don't work when you stringify a node -JT
+        //node, but source maps don't work when you stringify a node too early -JT
         scripts.add(node);
     }
 


[35/50] git commit: [flex-falcon] [refs/heads/dual] - Try to fix getListOfFiles exception. If you get this error and the log says 'No GoogDep for xxx' and 'xxx' is a native Javascript type, add it to NativeUtils.java

Posted by ah...@apache.org.
Try to fix getListOfFiles exception.  If you get this error and the log says 'No GoogDep for xxx' and 'xxx' is a native Javascript type, add it to NativeUtils.java


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

Branch: refs/heads/dual
Commit: 639c5f2c612864461c8a02ed43a14c285daa11ae
Parents: fce80f5
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 28 09:59:02 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 28 09:59:02 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/flex/compiler/utils/NativeUtils.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/639c5f2c/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
index 7245a17..b2396c1 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
@@ -90,9 +90,19 @@ public class NativeUtils
         
         Event("Event"),
         Array("Array"),
+        Float32Array("Float32Array"),
+        Float64Array("Float64Array"),
+        Int8Array("Int8Array"),
+        Int16Array("Int16Array"),
+        Int32Array("Int32Array"),
+        Uint8Array("Uint8Array"),
+        Uint8ClampedArray("Uint8ClampedArray"),
+        Uint16Array("Uint16Array"),
+        Uint32Array("Uint32Array"),
         Date("Date"),
         Math("Math"),
         Error("Error"),
+        RangeError("RangeError"),
         Boolean("Boolean"),
         decodeURI("decodeURI"),
         decodeURIComponent("decodeURIComponent"),


[32/50] git commit: [flex-falcon] [refs/heads/dual] - add more diagnostics

Posted by ah...@apache.org.
add more diagnostics


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

Branch: refs/heads/dual
Commit: bd9a27ebfcb8c755e47a02ba00d756d060a4a49c
Parents: 71b84cb
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 27 21:36:19 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 27 21:36:19 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/compiler/internal/graph/GoogDepsWriter.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bd9a27eb/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 87a627d..c8bbe16 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -202,6 +202,8 @@ public class GoogDepsWriter {
 			{
 				String name = requireMap2.get(unit);
 				GoogDep dep = depMap.get(name);
+				if (dep == null)
+					System.out.println("No GoogDep for " + name);
 				depsInOrder.add(dep);
 			}
 			return depsInOrder;


[19/50] git commit: [flex-falcon] [refs/heads/dual] - null check

Posted by ah...@apache.org.
null check


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

Branch: refs/heads/dual
Commit: 870816bdc66724c8e7ac2c4c77f9fc7efef0a37a
Parents: db46a75
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 21 09:55:30 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 21 09:55:30 2017 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/870816bd/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 1dd3935..fa281ad 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -259,7 +259,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
         }
 
-        if (interfacesList != null)
+        if (interfacesList != null && requiresList != null)
         {
 	        for (String r : interfacesList)
 	        {


[44/50] git commit: [flex-falcon] [refs/heads/dual] - block some goog classes from the list

Posted by ah...@apache.org.
block some goog classes from the list


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

Branch: refs/heads/dual
Commit: 4930a2a57534c3104a3867c9c40e57cb4498b595
Parents: f0315f6
Author: Alex Harui <ah...@apache.org>
Authored: Fri Mar 31 07:31:13 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Mar 31 07:31:13 2017 -0700

----------------------------------------------------------------------
 .../org/apache/flex/compiler/internal/graph/GoogDepsWriter.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4930a2a5/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 48937fd..9d3439f 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -219,6 +219,7 @@ public class GoogDepsWriter {
 			for (ICompilationUnit unit : order)
 			{
 				String name = requireMap2.get(unit);
+				if (isGoogClass(name)) continue;
 				GoogDep dep = depMap.get(name);
 				if (dep == null)
 					System.out.println("No GoogDep for " + name);


[41/50] git commit: [flex-falcon] [refs/heads/dual] - handle simple static initialization via function calls

Posted by ah...@apache.org.
handle simple static initialization via function calls


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

Branch: refs/heads/dual
Commit: 5331a7703e0e16f69f1cf66c9746419c529e23be
Parents: 1de54cf
Author: Alex Harui <ah...@apache.org>
Authored: Thu Mar 30 11:57:56 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Mar 30 11:57:56 2017 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/FieldEmitter.java        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5331a770/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index 7029028..7fabff0 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -31,7 +31,10 @@ import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSessionModel.BindableVarInfo;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
+import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
+import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
@@ -110,6 +113,19 @@ public class FieldEmitter extends JSSubEmitter implements
         {
         	getModel().inStaticInitializer = ndef.isStatic();
             String vnodeString = getEmitter().stringifyNode(vnode);
+            if (ndef.isStatic() && vnode instanceof FunctionCallNode)
+            {
+            	FunctionCallNode fcn = (FunctionCallNode)vnode;
+            	if (fcn.getNameNode() instanceof IdentifierNode)
+            	{
+            		// assume this is a call to static method in the class
+            		// otherwise it would be a memberaccessexpression?
+            		FunctionDefinition fd = (FunctionDefinition)fcn.getNameNode().resolve(getProject());
+            		IASNode m = fd.getNode();
+            		// re-emit it to collect static initializer class references in usedNames
+            		getEmitter().stringifyNode(m);
+            	}
+            }
         	getModel().inStaticInitializer = false;
         	if ((ndef.isStatic() && !EmitterUtils.needsStaticInitializer(vnodeString, className)) || 
         			(!ndef.isStatic() && EmitterUtils.isScalar(vnode)) ||


[21/50] git commit: [flex-falcon] [refs/heads/dual] - FLEX-35283. Switched parseInt with single argument to output undefined as explicit 2nd (radix or base) argument. See ticket for details

Posted by ah...@apache.org.
FLEX-35283. Switched parseInt with single argument to output undefined as explicit 2nd (radix or base) argument.
See ticket for details


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

Branch: refs/heads/dual
Commit: 70200628124557d322d50243119282144f382c6a
Parents: 13a58d8
Author: greg-dove <gr...@gmail.com>
Authored: Wed Mar 22 05:32:40 2017 +1300
Committer: greg-dove <gr...@gmail.com>
Committed: Wed Mar 22 20:12:50 2017 +1300

----------------------------------------------------------------------
 .../internal/codegen/js/flexjs/JSFlexJSEmitter.java | 16 +++++-----------
 .../js/flexjs/TestFlexJSGlobalFunctions.java        |  2 +-
 2 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/70200628/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index abb9d3b..cd7a189 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -38,7 +38,6 @@ import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSessionModel.ImplicitBindableImplementation;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitter;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
@@ -72,15 +71,7 @@ import org.apache.flex.compiler.internal.embedding.EmbedMIMEType;
 import org.apache.flex.compiler.internal.projects.CompilerProject;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.projects.FlexProject;
-import org.apache.flex.compiler.internal.tree.as.BinaryOperatorAsNode;
-import org.apache.flex.compiler.internal.tree.as.BlockNode;
-import org.apache.flex.compiler.internal.tree.as.DynamicAccessNode;
-import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
-import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
-import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
-import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
-import org.apache.flex.compiler.internal.tree.as.NumericLiteralNode;
+import org.apache.flex.compiler.internal.tree.as.*;
 import org.apache.flex.compiler.problems.EmbedUnableToReadSourceProblem;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
@@ -789,7 +780,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                 {
                     if (nameNode instanceof IdentifierNode)
                     {
-                        newNode = EmitterUtils.insertArgumentsAfter(node, new NumericLiteralNode("10"));
+                        //see FLEX-35283
+                        LiteralNode appendedArgument = new NumericLiteralNode("undefined");
+                        appendedArgument.setSynthetic(true);
+                        newNode = EmitterUtils.insertArgumentsAfter(node, appendedArgument);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/70200628/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
index 9364d45..0ed2fc4 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
@@ -107,7 +107,7 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
     {
         IVariableNode node = getVariable("var a:int = parseInt('1.8');");
         asBlockWalker.visitVariable(node);
-        assertOut("var /** @type {number} */ a = parseInt('1.8', 10)");
+        assertOut("var /** @type {number} */ a = parseInt('1.8', undefined)");
     }
 
     @Test


[15/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: MXMLFlexJSEmitter does not stringify script nodes because this fails to generate source maps.

Posted by ah...@apache.org.
compiler-jx: MXMLFlexJSEmitter does not stringify script nodes because this fails to generate source maps.

Instead, it saves the script nodes for later, and walks them normally.


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

Branch: refs/heads/dual
Commit: d939b6267d98cd62e0a6adcfa575b184e1dd8ac4
Parents: 51ddb85
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Mar 17 15:48:39 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Mar 17 15:48:39 2017 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 112 ++++++++-----------
 1 file changed, 49 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d939b626/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 21aef44..0b87cd6 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -76,6 +76,7 @@ import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
 import org.apache.flex.compiler.tree.mxml.*;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.utils.NativeUtils;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
 import org.apache.flex.swc.ISWC;
 
@@ -99,7 +100,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     private ArrayList<MXMLDescriptorSpecifier> instances;
     // all instances in the document AND its subdocuments
     private ArrayList<MXMLDescriptorSpecifier> allInstances = new ArrayList<MXMLDescriptorSpecifier>();
-    private ArrayList<MXMLScriptSpecifier> scripts;
+    private ArrayList<IMXMLScriptNode> scripts;
     //private ArrayList<MXMLStyleSpecifier> styles;
     private IClassDefinition classDefinition;
     private IClassDefinition documentDefinition;
@@ -344,7 +345,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
         events = new ArrayList<MXMLEventSpecifier>();
         instances = new ArrayList<MXMLDescriptorSpecifier>();
-        scripts = new ArrayList<MXMLScriptSpecifier>();
+        scripts = new ArrayList<IMXMLScriptNode>();
         //styles = new ArrayList<MXMLStyleSpecifier>();
 
         currentInstances = new ArrayList<MXMLDescriptorSpecifier>();
@@ -411,7 +412,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         ArrayList<MXMLDescriptorSpecifier> oldDescriptorTree;
         MXMLDescriptorSpecifier oldPropertiesTree;
         ArrayList<MXMLEventSpecifier> oldEvents;
-        ArrayList<MXMLScriptSpecifier> oldScripts;
+        ArrayList<IMXMLScriptNode> oldScripts;
         ArrayList<MXMLDescriptorSpecifier> oldCurrentInstances;
         ArrayList<MXMLDescriptorSpecifier> oldInstances;
         ArrayList<MXMLDescriptorSpecifier> oldCurrentPropertySpecifiers;
@@ -431,7 +432,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         oldInstances = instances;
         instances = new ArrayList<MXMLDescriptorSpecifier>();
         oldScripts = scripts;
-        scripts = new ArrayList<MXMLScriptSpecifier>();
+        scripts = new ArrayList<IMXMLScriptNode>();
         //styles = new ArrayList<MXMLStyleSpecifier>();
 
         oldCurrentInstances = currentInstances;
@@ -1293,13 +1294,49 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
     protected void emitScripts()
     {
-        for (MXMLScriptSpecifier script : scripts)
+        for (IMXMLScriptNode node : scripts)
         {
-            String output = script.output();
+            IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
+                    .getASEmitter();
 
-            if (!output.equals(""))
+            int len = node.getChildCount();
+            if (len > 0)
             {
-                writeNewline(output);
+                for (int i = 0; i < len; i++)
+                {
+                    IASNode cnode = node.getChild(i);
+                    if (cnode.getNodeID() == ASTNodeID.VariableID) {
+                        ((JSFlexJSEmitter) asEmitter).getModel().getVars().add((IVariableNode) cnode);
+                    } else {
+                        if (cnode.getNodeID() == ASTNodeID.BindableVariableID) {
+                            IVariableNode variableNode = (IVariableNode) cnode;
+                            BindableVarInfo bindableVarInfo = new BindableVarInfo();
+                            bindableVarInfo.isStatic = variableNode.hasModifier(ASModifier.STATIC);;
+                            bindableVarInfo.namespace = variableNode.getNamespace();
+                            IMetaTagsNode metaTags = variableNode.getMetaTags();
+                            if (metaTags != null) {
+                                IMetaTagNode[] tags = metaTags.getAllTags();
+                                if (tags.length > 0)
+                                    bindableVarInfo.metaTags = tags;
+                            }
+
+                            bindableVarInfo.type = variableNode.getVariableTypeNode().resolveType(getMXMLWalker().getProject()).getQualifiedName();
+                            ((JSFlexJSEmitter) asEmitter).getModel().getBindableVars().put(variableNode.getName(), bindableVarInfo);
+                        }
+                    }
+
+                    if (!(cnode instanceof IImportNode))
+                    {
+                        asEmitter.getWalker().walk(cnode);
+                        write(ASEmitterTokens.SEMICOLON.getToken());
+
+                        if (i == len - 1)
+                            indentPop();
+
+                        writeNewline();
+                        writeNewline();
+                    }
+                }
             }
         }
     }
@@ -2061,61 +2098,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     @Override
     public void emitScript(IMXMLScriptNode node)
     {
-        IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
-                .getASEmitter();
-
-        String nl = ASEmitterTokens.NEW_LINE.getToken();
-
-        StringBuilder sb = null;
-        MXMLScriptSpecifier scriptSpecifier = null;
-
-        int len = node.getChildCount();
-        if (len > 0)
-        {
-            for (int i = 0; i < len; i++)
-            {
-                IASNode cnode = node.getChild(i);
-                if (cnode.getNodeID() == ASTNodeID.VariableID) {
-                    ((JSFlexJSEmitter) asEmitter).getModel().getVars().add((IVariableNode) cnode);
-                } else {
-                    if (cnode.getNodeID() == ASTNodeID.BindableVariableID) {
-                        IVariableNode variableNode = (IVariableNode) cnode;
-                        BindableVarInfo bindableVarInfo = new BindableVarInfo();
-                        bindableVarInfo.isStatic = variableNode.hasModifier(ASModifier.STATIC);;
-                        bindableVarInfo.namespace = variableNode.getNamespace();
-                        IMetaTagsNode metaTags = variableNode.getMetaTags();
-                        if (metaTags != null) {
-                            IMetaTagNode[] tags = metaTags.getAllTags();
-                            if (tags.length > 0)
-                                bindableVarInfo.metaTags = tags;
-                        }
-
-                        bindableVarInfo.type = variableNode.getVariableTypeNode().resolveType(getMXMLWalker().getProject()).getQualifiedName();
-                        ((JSFlexJSEmitter) asEmitter).getModel().getBindableVars().put(variableNode.getName(), bindableVarInfo);
-                    }
-                }
-
-                if (!(cnode instanceof IImportNode))
-                {
-                    sb = new StringBuilder();
-                    scriptSpecifier = new MXMLScriptSpecifier();
-
-                    sb.append(asEmitter.stringifyNode(cnode));
-
-                    sb.append(ASEmitterTokens.SEMICOLON.getToken());
-
-                    if (i == len - 1)
-                        indentPop();
-
-                    sb.append(nl);
-                    sb.append(nl);
-
-                    scriptSpecifier.fragment = sb.toString();
-
-                    scripts.add(scriptSpecifier);
-                }
-            }
-        }
+        //save the script for emitting later in emitScripts()
+        //previously, we stringified the node and saved that instead of the
+        //node, but source maps don't work when you stringify a node -JT
+        scripts.add(node);
     }
 
     @Override


[36/50] git commit: [flex-falcon] [refs/heads/dual] - Added 'window' to NativeJSType to permit direct access to window object for javascript, required for 'remove-circulars'

Posted by ah...@apache.org.
Added 'window' to NativeJSType to permit direct access to window object for javascript, required for 'remove-circulars'


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

Branch: refs/heads/dual
Commit: 251672631e4304e58a5ae912788bfad29f88c3fd
Parents: 639c5f2
Author: greg-dove <gr...@gmail.com>
Authored: Wed Mar 29 09:00:53 2017 +1300
Committer: greg-dove <gr...@gmail.com>
Committed: Wed Mar 29 09:01:55 2017 +1300

----------------------------------------------------------------------
 .../src/main/java/org/apache/flex/compiler/utils/NativeUtils.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/25167263/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
index b2396c1..4582a54 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
@@ -118,6 +118,7 @@ public class NativeUtils
         String("String"),
         undefined("undefined"),
         unescape("unescape"),
+        window("window"),
 
         // (erikdebruin) These aren't strictly 'native' to JS, but the 
         //               Publisher provides global functions, so, for all 


[17/50] git commit: [flex-falcon] [refs/heads/dual] - Merge branch 'develop' into mxml-sourcemaps

Posted by ah...@apache.org.
Merge branch 'develop' into mxml-sourcemaps


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

Branch: refs/heads/dual
Commit: 83b00a00415af8de9977860c798b411ad90bed74
Parents: 8886eb3 13a58d8
Author: Josh Tynjala <jo...@apache.org>
Authored: Mon Mar 20 16:25:48 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Mon Mar 20 16:25:48 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/flexjs/TestFlexJSProject.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[39/50] git commit: [flex-falcon] [refs/heads/dual] - make sure impls are in main deps list

Posted by ah...@apache.org.
make sure impls are in main deps list


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

Branch: refs/heads/dual
Commit: 2bab63deb151905254060c90f889c95ac11e4a46
Parents: f117240
Author: Alex Harui <ah...@apache.org>
Authored: Wed Mar 29 23:05:28 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Mar 29 23:05:28 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/graph/GoogDepsWriter.java   | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2bab63de/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 8efaf77..c4f841d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -156,16 +156,28 @@ public class GoogDepsWriter {
 			// get the list of all units not referenced by other units
 			for (GoogDep gd : depMap.values())
 			{
-				if (gd.className.equals(mainName)) continue;
+				if (gd.className.equals(mainName)) 
+				{
+					for (String d : gd.fileInfo.impls)
+					{
+						if (!restOfDeps.contains(d))
+							restOfDeps.add(d);
+					}
+					continue;
+				}
 				ICompilationUnit unit = requireMap.get(gd.className);
 				if (unit == null)
 				{
-					restOfDeps.add(gd.className);
+					if (!restOfDeps.contains(gd.className))
+						restOfDeps.add(gd.className);
 					continue;
 				}
 				Set<ICompilationUnit> deps = graph.getDirectReverseDependencies(unit, dependencyTypes);
 				if (deps.size() == 0)
-					restOfDeps.add(gd.className);
+				{
+					if (!restOfDeps.contains(gd.className))
+						restOfDeps.add(gd.className);
+				}
 			}
 			mainDeps.append(getDependencies(restOfDeps)).append("]);\n");
 			sb.insert(0, mainDeps);


[37/50] git commit: [flex-falcon] [refs/heads/dual] - don't do removes from within the iterator

Posted by ah...@apache.org.
don't do removes from within the iterator


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

Branch: refs/heads/dual
Commit: 7676cf9c7da9fae567e1548a96fcd3b0816d33e7
Parents: 2516726
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 28 13:45:31 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 28 13:49:24 2017 -0700

----------------------------------------------------------------------
 .../internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7676cf9c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 560927c..74fa0a5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -160,12 +160,17 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 .getASEmitter();
 
         String currentClassName = fjs.getModel().getCurrentClass().getQualifiedName();
+        ArrayList<String> removals = new ArrayList<String>();
         for (String usedName : asEmitterUsedNames) {
             //remove any internal component that has been registered with the other emitter's usedNames
             if (usedName.startsWith(currentClassName+".") && subDocumentNames.contains(usedName.substring(currentClassName.length()+1))) {
-                asEmitterUsedNames.remove(usedName);
+                removals.add(usedName);
             }
         }
+        for (String usedName : removals)
+        {
+        	asEmitterUsedNames.remove(usedName);
+        }
         System.out.println(currentClassName + " as: " + asEmitterUsedNames.toString());
         System.out.println(currentClassName + " mxml: " + usedNames.toString());
         usedNames.addAll(asEmitterUsedNames);


[07/50] git commit: [flex-falcon] [refs/heads/dual] - initial pieces for Cordova Publishing. Needs to be implemented

Posted by ah...@apache.org.
initial pieces for Cordova Publishing.  Needs to be implemented


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

Branch: refs/heads/dual
Commit: f1860c1c34442c6231995c7eea889754d9764985
Parents: fba30de
Author: Alex Harui <ah...@apache.org>
Authored: Fri Mar 10 11:27:32 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Mar 10 11:27:32 2017 -0800

----------------------------------------------------------------------
 .../apache/flex/compiler/clients/MXMLJSC.java   |   9 +
 .../compiler/clients/MXMLJSCFlexCordova.java    | 784 +++++++++++++++++++
 .../mxml/flexjs/MXMLFlexJSCordovaPublisher.java |  63 ++
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  12 +-
 .../mxml/flexjs/MXMLFlexJSCordovaBackend.java   |  78 ++
 .../compiler/internal/graph/GoogDepsWriter.java |   6 +
 .../internal/graph/GoogDepsWriterCordova.java   |  67 ++
 7 files changed, 1017 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
index 6f02afc..b087fa5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -349,6 +349,15 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
 	                    	break targetloop;
 	                    }
 	                    break;
+	                case JS_FLEX_CORDOVA:
+	                	MXMLJSCFlexCordova flexCordova = new MXMLJSCFlexCordova();
+	                	lastCompiler = flexCordova;
+	                    result = flexCordova.mainNoExit(removeASArgs(args), problems.getProblems(), false);
+	                    if (result != 0)
+	                    {
+	                    	break targetloop;
+	                    }
+	                    break;
 	                case JS_NODE:
 	                	MXMLJSCNode node = new MXMLJSCNode();
 	                	lastCompiler = node;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlexCordova.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlexCordova.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlexCordova.java
new file mode 100644
index 0000000..fe0b16e
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSCFlexCordova.java
@@ -0,0 +1,784 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+package org.apache.flex.compiler.clients;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.flex.compiler.clients.problems.ProblemPrinter;
+import org.apache.flex.compiler.clients.problems.ProblemQuery;
+import org.apache.flex.compiler.clients.problems.ProblemQueryProvider;
+import org.apache.flex.compiler.clients.problems.WorkspaceProblemFormatter;
+import org.apache.flex.compiler.codegen.js.IJSPublisher;
+import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.config.ConfigurationBuffer;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.config.ICompilerSettingsConstants;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.driver.js.IJSApplication;
+import org.apache.flex.compiler.exceptions.ConfigurationException;
+import org.apache.flex.compiler.exceptions.ConfigurationException.IOError;
+import org.apache.flex.compiler.exceptions.ConfigurationException.MustSpecifyTarget;
+import org.apache.flex.compiler.exceptions.ConfigurationException.OnlyOneSource;
+import org.apache.flex.compiler.internal.config.FlashBuilderConfigurator;
+import org.apache.flex.compiler.internal.driver.as.ASBackend;
+import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.driver.js.jsc.JSCBackend;
+import org.apache.flex.compiler.internal.driver.js.node.NodeBackend;
+import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSCordovaBackend;
+import org.apache.flex.compiler.internal.parsing.as.FlexJSASDocDelegate;
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.targets.FlexJSTarget;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.internal.units.ResourceModuleCompilationUnit;
+import org.apache.flex.compiler.internal.units.SourceCompilationUnitFactory;
+import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.problems.ConfigurationProblem;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.problems.InternalCompilerProblem;
+import org.apache.flex.compiler.problems.UnableToBuildSWFProblem;
+import org.apache.flex.compiler.problems.UnexpectedExceptionProblem;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.targets.ITarget;
+import org.apache.flex.compiler.targets.ITarget.TargetType;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
+import org.apache.flex.tools.FlexTool;
+import org.apache.flex.utils.ArgumentUtil;
+import org.apache.flex.utils.FilenameNormalization;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Erik de Bruin
+ * @author Michael Schmalle
+ */
+public class MXMLJSCFlexCordova implements JSCompilerEntryPoint, ProblemQueryProvider,
+        FlexTool
+{
+    @Override
+    public ProblemQuery getProblemQuery()
+    {
+        return problems;
+    }
+
+
+    /*
+     * Exit code enumerations.
+     */
+    static enum ExitCode
+    {
+        SUCCESS(0),
+        PRINT_HELP(1),
+        FAILED_WITH_PROBLEMS(2),
+        FAILED_WITH_ERRORS(3),
+        FAILED_WITH_EXCEPTIONS(4),
+        FAILED_WITH_CONFIG_PROBLEMS(5);
+
+        ExitCode(int code)
+        {
+            this.code = code;
+        }
+
+        final int code;
+    }
+
+    public static MXMLJSC.JSOutputType jsOutputType;
+
+    @Override
+    public String getName()
+    {
+        return FLEX_TOOL_MXMLC;
+    }
+
+    @Override
+    public int execute(String[] args)
+    {
+        final List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+        return mainNoExit(args, problems, true);
+    }
+
+    /**
+     * Java program entry point.
+     * 
+     * @param args command line arguments
+     */
+    public static void main(final String[] args)
+    {
+        int exitCode = staticMainNoExit(args);
+        System.exit(exitCode);
+    }
+
+    /**
+     * Entry point for the {@code <compc>} Ant task.
+     *
+     * @param args Command line arguments.
+     * @return An exit code.
+     */
+    public static int staticMainNoExit(final String[] args)
+    {
+        long startTime = System.nanoTime();
+
+        final MXMLJSCFlexCordova mxmlc = new MXMLJSCFlexCordova();
+        final List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+        final int exitCode = mxmlc.mainNoExit(args, problems, true);
+
+        long endTime = System.nanoTime();
+        System.out.println((endTime - startTime) / 1e9 + " seconds");
+
+        return exitCode;
+    }
+
+    protected Workspace workspace;
+    protected FlexJSProject project;
+
+    protected ProblemQuery problems;
+    protected ISourceFileHandler asFileHandler;
+    protected Configuration config;
+    protected Configurator projectConfigurator;
+    private ConfigurationBuffer configBuffer;
+    private ICompilationUnit mainCU;
+    protected ITarget target;
+    protected ITargetSettings targetSettings;
+    protected IJSApplication jsTarget;
+    private IJSPublisher jsPublisher;
+    
+    public MXMLJSCFlexCordova()
+    {
+    	this(new MXMLFlexJSCordovaBackend());
+    }
+    
+    public MXMLJSCFlexCordova(IBackend backend)
+    {
+        workspace = new Workspace();
+        workspace.setASDocDelegate(new FlexJSASDocDelegate());
+        project = new FlexJSProject(workspace, backend);
+        problems = new ProblemQuery(); // this gets replaced in configure().  Do we need it here?
+        asFileHandler = backend.getSourceFileHandlerInstance();
+    }
+
+    @Override
+    public int mainNoExit(final String[] args, List<ICompilerProblem> problems,
+            Boolean printProblems)
+    {
+        int exitCode = -1;
+        try
+        {
+            exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems);
+        }
+        catch (Exception e)
+        {
+            System.err.println(e.toString());
+        }
+        finally
+        {
+            if (problems != null && !problems.isEmpty())
+            {
+                if (printProblems)
+                {
+                    final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter(
+                            workspace);
+                    final ProblemPrinter printer = new ProblemPrinter(formatter);
+                    printer.printProblems(problems);
+                }
+            }
+        }
+        return exitCode;
+    }
+
+    /**
+     * Entry point that doesn't call <code>System.exit()</code>. This is for
+     * unit testing.
+     * 
+     * @param args command line arguments
+     * @return exit code
+     */
+    private int _mainNoExit(final String[] args,
+            List<ICompilerProblem> outProblems)
+    {
+        ExitCode exitCode = ExitCode.SUCCESS;
+        try
+        {
+            final boolean continueCompilation = configure(args);
+
+/*            if (outProblems != null && !config.isVerbose())
+                JSSharedData.STDOUT = JSSharedData.STDERR = null;*/
+
+            if (continueCompilation)
+            {
+                project.setProblems(problems.getProblems());
+               	compile();
+                if (problems.hasFilteredProblems())
+                {
+                    if (problems.hasErrors())
+                        exitCode = ExitCode.FAILED_WITH_ERRORS;
+                    else
+                        exitCode = ExitCode.FAILED_WITH_PROBLEMS;
+                }
+            }
+            else if (problems.hasFilteredProblems())
+            {
+                exitCode = ExitCode.FAILED_WITH_CONFIG_PROBLEMS;
+            }
+            else
+            {
+                exitCode = ExitCode.PRINT_HELP;
+            }
+        }
+        catch (Exception e)
+        {
+            if (outProblems == null) {
+                System.err.println(e.getMessage());
+            } else
+            {
+                final ICompilerProblem unexpectedExceptionProblem = new UnexpectedExceptionProblem(
+                        e);
+                problems.add(unexpectedExceptionProblem);
+            }
+            exitCode = ExitCode.FAILED_WITH_EXCEPTIONS;
+        }
+        finally
+        {
+            waitAndClose();
+
+            if (outProblems != null && problems.hasFilteredProblems())
+            {
+                for (ICompilerProblem problem : problems.getFilteredProblems())
+                {
+                    outProblems.add(problem);
+                }
+            }
+        }
+        return exitCode.code;
+    }
+
+    /**
+     * Main body of this program. This method is called from the public static
+     * method's for this program.
+     * 
+     * @return true if compiler succeeds
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    protected boolean compile()
+    {
+        JSGoogConfiguration googConfiguration = (JSGoogConfiguration) config;
+        boolean compilationSuccess = false;
+
+        try
+        {
+            project.getSourceCompilationUnitFactory().addHandler(asFileHandler);
+
+            if (!googConfiguration.getSkipTranspile())
+            {
+	            if (!setupTargetFile()) {
+                    return false;
+                }
+
+	            buildArtifact();
+            }
+            if (jsTarget != null || googConfiguration.getSkipTranspile())
+            {
+                List<ICompilerProblem> errors = new ArrayList<ICompilerProblem>();
+                List<ICompilerProblem> warnings = new ArrayList<ICompilerProblem>();
+
+                if (!config.getCreateTargetWithErrors())
+                {
+                    problems.getErrorsAndWarnings(errors, warnings);
+                    if (errors.size() > 0)
+                        return false;
+                }
+
+                jsPublisher = (IJSPublisher) project.getBackend().createPublisher(
+                        project, errors, config);
+
+                File outputFolder = jsPublisher.getOutputFolder();
+
+                if (!googConfiguration.getSkipTranspile())
+                {
+	                ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+	                roots.add(mainCU);
+	                Set<ICompilationUnit> incs = target.getIncludesCompilationUnits();
+	                roots.addAll(incs);
+	                project.mixinClassNames = new TreeSet<String>();
+	                List<ICompilationUnit> reachableCompilationUnits = project.getReachableCompilationUnitsInSWFOrder(roots);
+	                ((FlexJSTarget)target).collectMixinMetaData(project.mixinClassNames, reachableCompilationUnits);
+	                for (final ICompilationUnit cu : reachableCompilationUnits)
+	                {
+	                    ICompilationUnit.UnitType cuType = cu.getCompilationUnitType();
+	
+	                    if (cuType == ICompilationUnit.UnitType.AS_UNIT
+	                            || cuType == ICompilationUnit.UnitType.MXML_UNIT)
+	                    {
+	                        final File outputClassFile = getOutputClassFile(
+	                                cu.getQualifiedNames().get(0), outputFolder);
+	
+	                        System.out.println("Compiling file: " + outputClassFile);
+	
+	                        ICompilationUnit unit = cu;
+	
+	                        IJSWriter writer;
+	                        if (cuType == ICompilationUnit.UnitType.AS_UNIT)
+	                        {
+	                            writer = (IJSWriter) project.getBackend().createWriter(project,
+	                                    errors, unit, false);
+	                        }
+	                        else
+	                        {
+	                            writer = (IJSWriter) project.getBackend().createMXMLWriter(
+	                                    project, errors, unit, false);
+	                        }
+	
+	                        BufferedOutputStream out = new BufferedOutputStream(
+	                                new FileOutputStream(outputClassFile));
+	
+	                        File outputSourceMapFile = null;
+	                        if (project.config.getSourceMap())
+	                        {
+	                            outputSourceMapFile = getOutputSourceMapFile(
+	                                    cu.getQualifiedNames().get(0), outputFolder);
+	                        }
+	                        
+	                        writer.writeTo(out, outputSourceMapFile);
+	                        out.flush();
+	                        out.close();
+	                        writer.close();
+	                    }
+	                }
+                }
+                
+                if (jsPublisher != null)
+                {
+                    compilationSuccess = jsPublisher.publish(problems);
+                }
+                else
+                {
+                    compilationSuccess = true;
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            final ICompilerProblem problem = new InternalCompilerProblem(e);
+            problems.add(problem);
+        }
+
+        return compilationSuccess;
+    }
+
+    /**
+     * Build target artifact.
+     * 
+     * @throws InterruptedException threading error
+     * @throws IOException IO error
+     * @throws ConfigurationException
+     */
+    protected void buildArtifact() throws InterruptedException, IOException,
+            ConfigurationException
+    {
+        jsTarget = buildJSTarget();
+    }
+
+    private IJSApplication buildJSTarget() throws InterruptedException,
+            FileNotFoundException, ConfigurationException
+    {
+        final List<ICompilerProblem> problemsBuildingSWF = new ArrayList<ICompilerProblem>();
+
+        project.mainCU = mainCU;
+        final IJSApplication app = buildApplication(project,
+                config.getMainDefinition(), mainCU, problemsBuildingSWF);
+        problems.addAll(problemsBuildingSWF);
+        if (app == null)
+        {
+            ICompilerProblem problem = new UnableToBuildSWFProblem(
+                    getOutputFilePath());
+            problems.add(problem);
+        }
+
+        return app;
+    }
+
+    /**
+     * Replaces FlexApplicationProject::buildSWF()
+     * 
+     * @param applicationProject
+     * @param rootClassName
+     * @param problems
+     * @return
+     * @throws InterruptedException
+     */
+
+    private IJSApplication buildApplication(CompilerProject applicationProject,
+            String rootClassName, ICompilationUnit mainCU,
+            Collection<ICompilerProblem> problems) throws InterruptedException,
+            ConfigurationException, FileNotFoundException
+    {
+        Collection<ICompilerProblem> fatalProblems = applicationProject.getFatalProblems();
+        if (!fatalProblems.isEmpty())
+        {
+            problems.addAll(fatalProblems);
+            return null;
+        }
+
+        return ((JSTarget) target).build(mainCU, problems);
+    }
+
+    /**
+     * Get the output file path. If {@code -output} is specified, use its value;
+     * otherwise, use the same base name as the target file.
+     * 
+     * @return output file path
+     */
+    private String getOutputFilePath()
+    {
+        if (config.getOutput() == null)
+        {
+            final String extension = "." + project.getBackend().getOutputExtension();
+            return FilenameUtils.removeExtension(config.getTargetFile()).concat(
+                    extension);
+        }
+        else
+            return config.getOutput();
+    }
+
+    /**
+     * @author Erik de Bruin
+     * 
+     *         Get the output class file. This includes the (sub)directory in
+     *         which the original class file lives. If the directory structure
+     *         doesn't exist, it is created.
+     * 
+     * @param qname
+     * @param outputFolder
+     * @return output class file path
+     */
+    private File getOutputClassFile(String qname, File outputFolder)
+    {
+        String[] cname = qname.split("\\.");
+        String sdirPath = outputFolder + File.separator;
+        if (cname.length > 0)
+        {
+            for (int i = 0, n = cname.length - 1; i < n; i++)
+            {
+                sdirPath += cname[i] + File.separator;
+            }
+
+            File sdir = new File(sdirPath);
+            if (!sdir.exists())
+                sdir.mkdirs();
+
+            qname = cname[cname.length - 1];
+        }
+
+        return new File(sdirPath + qname + "." + project.getBackend().getOutputExtension());
+    }
+
+    /**
+     * @param qname
+     * @param outputFolder
+     * @return output source map file path
+     */
+    private File getOutputSourceMapFile(String qname, File outputFolder)
+    {
+        String[] cname = qname.split("\\.");
+        String sdirPath = outputFolder + File.separator;
+        if (cname.length > 0)
+        {
+            for (int i = 0, n = cname.length - 1; i < n; i++)
+            {
+                sdirPath += cname[i] + File.separator;
+            }
+
+            File sdir = new File(sdirPath);
+            if (!sdir.exists())
+                sdir.mkdirs();
+
+            qname = cname[cname.length - 1];
+        }
+
+        return new File(sdirPath + qname + "." + project.getBackend().getOutputExtension() + ".map");
+    }
+
+    /**
+     * Mxmlc uses target file as the main compilation unit and derive the output
+     * SWF file name from this file.
+     * 
+     * @return true if successful, false otherwise.
+     * @throws OnlyOneSource
+     * @throws InterruptedException
+     */
+    protected boolean setupTargetFile() throws InterruptedException
+    {
+        final String mainFileName = config.getTargetFile();
+
+        final String normalizedMainFileName = FilenameNormalization.normalize(mainFileName);
+
+        final SourceCompilationUnitFactory compilationUnitFactory = project.getSourceCompilationUnitFactory();
+
+        File normalizedMainFile = new File(normalizedMainFileName);
+        if (compilationUnitFactory.canCreateCompilationUnit(normalizedMainFile))
+        {
+            project.addIncludeSourceFile(normalizedMainFile);
+
+            final List<String> sourcePath = config.getCompilerSourcePath();
+            String mainQName = null;
+            if (sourcePath != null && !sourcePath.isEmpty())
+            {
+                for (String path : sourcePath)
+                {
+                    final String otherPath = new File(path).getAbsolutePath();
+                    if (mainFileName.startsWith(otherPath))
+                    {
+                        mainQName = mainFileName.substring(otherPath.length() + 1);
+                        mainQName = mainQName.replaceAll("\\\\", "/");
+                        mainQName = mainQName.replaceAll("\\/", ".");
+                        if (mainQName.endsWith(".as"))
+                            mainQName = mainQName.substring(0,
+                                    mainQName.length() - 3);
+                        break;
+                    }
+                }
+            }
+
+            if (mainQName == null)
+                mainQName = FilenameUtils.getBaseName(mainFileName);
+
+            Collection<ICompilationUnit> mainFileCompilationUnits = workspace.getCompilationUnits(
+                    normalizedMainFileName, project);
+
+            mainCU = Iterables.getOnlyElement(mainFileCompilationUnits);
+
+            config.setMainDefinition(mainQName);
+        }
+
+        Preconditions.checkNotNull(mainCU,
+                "Main compilation unit can't be null");
+
+        ITargetSettings settings = getTargetSettings();
+        if (settings != null)
+            project.setTargetSettings(settings);
+
+        target = project.getBackend().createTarget(project,
+                getTargetSettings(), null);
+
+        return true;
+    }
+
+    private ITargetSettings getTargetSettings()
+    {
+        if (targetSettings == null)
+            targetSettings = projectConfigurator.getTargetSettings(null);
+
+        return targetSettings;
+    }
+
+    /**
+     * Create a new Configurator. This method may be overridden to allow
+     * Configurator subclasses to be created that have custom configurations.
+     * 
+     * @return a new instance or subclass of {@link Configurator}.
+     */
+    protected Configurator createConfigurator()
+    {
+        return project.getBackend().createConfigurator();
+    }
+
+    /**
+     * Load configurations from all the sources.
+     * 
+     * @param args command line arguments
+     * @return True if mxmlc should continue with compilation.
+     */
+    protected boolean configure(final String[] args)
+    {
+        project.getSourceCompilationUnitFactory().addHandler(asFileHandler);
+        project.configurator = projectConfigurator = createConfigurator();
+
+        try
+        {
+            if (useFlashBuilderProjectFiles(args))
+            {
+                projectConfigurator.setConfiguration(
+                        FlashBuilderConfigurator.computeFlashBuilderArgs(args,
+                                getTargetType().getExtension()),
+                        ICompilerSettingsConstants.FILE_SPECS_VAR);
+            }
+            else
+            {
+                projectConfigurator.setConfiguration(args,
+                        ICompilerSettingsConstants.FILE_SPECS_VAR);
+            }
+
+            projectConfigurator.applyToProject(project);
+            project.config = (JSGoogConfiguration) projectConfigurator.getConfiguration();
+
+            config = projectConfigurator.getConfiguration();
+            configBuffer = projectConfigurator.getConfigurationBuffer();
+
+            problems = new ProblemQuery(projectConfigurator.getCompilerProblemSettings());
+            problems.addAll(projectConfigurator.getConfigurationProblems());
+
+            if (configBuffer.getVar("version") != null) //$NON-NLS-1$
+                return false;
+
+            if (problems.hasErrors())
+                return false;
+
+            validateTargetFile();
+            return true;
+        }
+        catch (ConfigurationException e)
+        {
+            final ICompilerProblem problem = new ConfigurationProblem(e);
+            problems.add(problem);
+            return false;
+        }
+        catch (Exception e)
+        {
+            final ICompilerProblem problem = new ConfigurationProblem(null, -1,
+                    -1, -1, -1, e.getMessage());
+            problems.add(problem);
+            return false;
+        }
+        finally
+        {
+            if (config == null)
+            {
+                config = new Configuration();
+                configBuffer = new ConfigurationBuffer(Configuration.class,
+                        Configuration.getAliases());
+            }
+        }
+    }
+
+    private boolean useFlashBuilderProjectFiles(String[] args)
+    {
+        for (String arg : args)
+        {
+            if (arg.equals("-fb")
+                    || arg.equals("-use-flashbuilder-project-files"))
+                return true;
+        }
+        return false;
+    }
+
+    protected TargetType getTargetType()
+    {
+        return TargetType.SWF;
+    }
+
+    /**
+     * Validate target file.
+     * 
+     * @throws MustSpecifyTarget
+     * @throws IOError
+     */
+    protected void validateTargetFile() throws ConfigurationException
+    {
+        if (mainCU instanceof ResourceModuleCompilationUnit)
+            return; //when compiling a Resource Module, no target file is defined.
+
+        final String targetFile = config.getTargetFile();
+        if (targetFile == null)
+            throw new ConfigurationException.MustSpecifyTarget(null, null, -1);
+
+        final File file = new File(targetFile);
+        if (!file.exists())
+            throw new ConfigurationException.IOError(targetFile);
+    }
+
+    /**
+     * Wait till the workspace to finish compilation and close.
+     */
+    protected void waitAndClose()
+    {
+        workspace.startIdleState();
+        try
+        {
+            workspace.close();
+        }
+        finally
+        {
+            workspace.endIdleState(Collections.<ICompilerProject, Set<ICompilationUnit>> emptyMap());
+        }
+    }
+
+    /**
+     * Force terminate the compilation process.
+     */
+    protected void close()
+    {
+        workspace.close();
+    }
+    
+    public List<String> getSourceList()
+    {
+        ArrayList<String> list = new ArrayList<String>();
+        LinkedList<ICompilerProblem> problemList = new LinkedList<ICompilerProblem>();
+        try
+        {
+            ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+            roots.add(mainCU);
+            Set<ICompilationUnit> incs = target.getIncludesCompilationUnits();
+            roots.addAll(incs);
+            project.mixinClassNames = new TreeSet<String>();
+            List<ICompilationUnit> units = project.getReachableCompilationUnitsInSWFOrder(roots);
+            for (ICompilationUnit unit : units)
+            {
+                UnitType ut = unit.getCompilationUnitType();
+                if (ut == UnitType.AS_UNIT || ut == UnitType.MXML_UNIT)
+                {
+                    list.add(unit.getAbsoluteFilename());
+                }
+            }
+        }
+        catch (InterruptedException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+        return list;
+    }
+    
+    public String getMainSource()
+    {
+        return mainCU.getAbsoluteFilename();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSCordovaPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSCordovaPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSCordovaPublisher.java
new file mode 100644
index 0000000..6196c44
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSCordovaPublisher.java
@@ -0,0 +1,63 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.flex.compiler.clients.problems.ProblemQuery;
+import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.internal.codegen.js.jsc.JSCPublisher;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+public class MXMLFlexJSCordovaPublisher extends MXMLFlexJSPublisher
+{
+    public MXMLFlexJSCordovaPublisher(Configuration config, FlexJSProject project)
+    {
+        super(project, config);
+    }
+
+    @Override
+    public boolean publish(ProblemQuery problems) throws IOException
+    {
+		createCordovaProjectIfNeeded();
+		//loadCordovaPlatformsIfNeeded();
+		
+    	if (super.publish(problems))
+    	{
+    		//loadCordovaPlugins();
+    	}
+    	
+    	return true;
+    }
+    
+    private void createCordovaProjectIfNeeded()
+    {
+        // The "intermediate" is the "js-debug" output.
+        final File intermediateDir = outputFolder;
+        final String projectName = FilenameUtils.getBaseName(configuration.getTargetFile());
+
+        // The "release" is the "js-release" directory.
+        File releaseDir = new File(outputParentFolder, FLEXJS_RELEASE_DIR_NAME);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 184248d..ec8d73d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -86,12 +86,20 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         this.project = project;
     }
 
-    private FlexJSProject project;
+    protected FlexJSProject project;
 
     private boolean isMarmotinniRun;
     private String outputPathParameter;
     private boolean useStrictPublishing;
 
+    private GoogDepsWriter getGoogDepsWriter(File intermediateDir, 
+    										String projectName, 
+    										JSGoogConfiguration googConfiguration, 
+    										List<ISWC> swcs)
+    {
+    	return new GoogDepsWriter(intermediateDir, projectName, googConfiguration, swcs);
+    }
+
     @Override
     public File getOutputFolder()
     {
@@ -303,7 +311,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         // Add all files generated by the compiler to the compilation unit.
         /////////////////////////////////////////////////////////////////////////////////
 
-        GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir, projectName, googConfiguration, swcs);
+        GoogDepsWriter gdw = getGoogDepsWriter(intermediateDir, projectName, googConfiguration, swcs);
         // This list contains all files generated by the compiler, this is both the
         // compiled js files created by the sources of the current project plus the
         // js files of used dependencies.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSCordovaBackend.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSCordovaBackend.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSCordovaBackend.java
new file mode 100644
index 0000000..841a536
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSCordovaBackend.java
@@ -0,0 +1,78 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+package org.apache.flex.compiler.internal.driver.mxml.flexjs;
+
+import java.io.FilterWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLWriter;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSCordovaPublisher;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.targets.FlexJSTarget;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link MXMLBlockWalker} is used to traverse the {@link IMXMLFileNode} AST.
+ * 
+ * @author Erik de Bruin
+ */
+public class MXMLFlexJSCordovaBackend extends MXMLFlexJSBackend
+{
+
+    @Override
+    public Configurator createConfigurator()
+    {
+        return new Configurator(JSGoogConfiguration.class);
+    }
+
+    @Override
+    public MXMLFlexJSPublisher createPublisher(FlexJSProject project,
+            List<ICompilerProblem> errors, Configuration config)
+    {
+        return new MXMLFlexJSCordovaPublisher(config, project);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 8b49a88..eeda86e 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -602,6 +602,8 @@ public class GoogDepsWriter {
 				    additionalHTML.add(s);
 				    continue;
                 }
+                else
+                	otherScanning(s);
 				int c = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
 				if (c > -1)
 				{
@@ -622,6 +624,10 @@ public class GoogDepsWriter {
 		return deps;
 	}
 	
+	protected void otherScanning(String s)
+	{		
+	}
+	
 	private String getDependencies(ArrayList<String> deps)
 	{
 		String s = "";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1860c1c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriterCordova.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriterCordova.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriterCordova.java
new file mode 100644
index 0000000..c053381
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriterCordova.java
@@ -0,0 +1,67 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.flex.compiler.internal.graph;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.flex.compiler.clients.problems.ProblemQuery;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.problems.FileNotFoundProblem;
+import org.apache.flex.swc.ISWC;
+import org.apache.flex.swc.ISWCFileEntry;
+
+import com.google.common.io.Files;
+
+public class GoogDepsWriterCordova extends GoogDepsWriter {
+
+    public GoogDepsWriterCordova(File outputFolder, String mainClassName, JSGoogConfiguration config, List<ISWC> swcs)
+	{
+		super(outputFolder, mainClassName, config, swcs);
+	}
+	
+    private final String FLEXJS_CORDOVA_PLUGIN = "@flexjscordovaplugin";
+    
+    public ArrayList<String> cordovaPlugins = new ArrayList<String>();
+
+    @Override
+	protected void otherScanning(String s)
+	{	
+    	int c = s.indexOf(FLEXJS_CORDOVA_PLUGIN);
+    	if (c > -1)
+    	{
+    		cordovaPlugins.add(s.substring(c + FLEXJS_CORDOVA_PLUGIN.length()).trim());
+    	}
+	}
+}


[29/50] git commit: [flex-falcon] [refs/heads/dual] - fix second pass handling of FlexJS Dependency list

Posted by ah...@apache.org.
fix second pass handling of FlexJS Dependency list


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

Branch: refs/heads/dual
Commit: ed270e2a425e74e0a9ab1a2abedc0ee6b2220a8b
Parents: fc1fa43
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 25 11:01:25 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 25 11:01:25 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ed270e2a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 6d99aac..87a627d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -578,42 +578,42 @@ public class GoogDepsWriter {
 						        		}
 						        		else
 						        		{
-						        			String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
+						        			String token = JSGoogEmitterTokens.FLEXJS_STATIC_DEPENDENCY_LIST.getToken();
 						    				c = line.indexOf(token);
 						    				if (c > -1)
 						    				{
 						    					c2 = line.indexOf("*/");
 						    					line = line.substring(c + token.length(), c2);
-							        			fi.deps = new ArrayList<String>();
-						    					fi.deps.addAll(Arrays.asList(line.split(",")));
-						    					fi.depsLine = i;
+							        			fi.staticDeps = new ArrayList<String>();
+						    					fi.staticDeps.addAll(Arrays.asList(line.split(",")));
 						    				}
-						    				else if (fi.depsLine == 0)
+						    				else
 						    				{
-						    					token = JSGoogEmitterTokens.GOOG_REQUIRE.getToken();
-						    					c = line.indexOf(token);
-						    					if (c > -1)
-						    					{
-						                            c2 = line.indexOf(")");
-						                            String s = line.substring(c + 14, c2 - 1);
-						                            if (fi.deps == null)
-						                            	fi.deps = new ArrayList<String>();
-						                            fi.deps.add(s);
-						    					}
-						    					else
-						    					{
-								        			token = JSGoogEmitterTokens.FLEXJS_STATIC_DEPENDENCY_LIST.getToken();
-								    				c = line.indexOf(token);
-								    				if (c > -1)
-								    				{
-								    					c2 = line.indexOf("*/");
-								    					line = line.substring(c + token.length(), c2);
-									        			fi.staticDeps = new ArrayList<String>();
-								    					fi.staticDeps.addAll(Arrays.asList(line.split(",")));
-								    				}						    						
-						    					}
-						    				}
-
+							        			token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
+							    				c = line.indexOf(token);
+							    				if (c > -1)
+							    				{
+							    					c2 = line.indexOf("*/");
+							    					line = line.substring(c + token.length(), c2);
+								        			fi.deps = new ArrayList<String>();
+								        			if (line.length() > 2) // don't add blank or space if no deps
+								        				fi.deps.addAll(Arrays.asList(line.split(",")));
+							    					fi.depsLine = i;
+							    				}
+							    				else if (fi.depsLine == 0)
+							    				{
+							    					token = JSGoogEmitterTokens.GOOG_REQUIRE.getToken();
+							    					c = line.indexOf(token);
+							    					if (c > -1)
+							    					{
+							                            c2 = line.indexOf(")");
+							                            String s = line.substring(c + 14, c2 - 1);
+							                            if (fi.deps == null)
+							                            	fi.deps = new ArrayList<String>();
+							                            fi.deps.add(s);
+							    					}
+							    				}
+							        		}
 						        		}
 					        		}
 					        	}


[18/50] git commit: [flex-falcon] [refs/heads/dual] - change to use FlexJS Dependency List

Posted by ah...@apache.org.
change to use FlexJS Dependency List


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

Branch: refs/heads/dual
Commit: db46a750f870171cfb12027c67047a8ed46b2e1b
Parents: 13a58d8
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 21 09:26:47 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 21 09:26:47 2017 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 110 ++----
 .../codegen/js/goog/JSGoogEmitterTokens.java    |   1 +
 .../internal/codegen/js/jx/LiteralEmitter.java  |   3 +-
 .../codegen/js/jx/PackageHeaderEmitter.java     |  67 +++-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 132 +++----
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |   4 +-
 .../compiler/internal/graph/GoogDepsWriter.java | 347 ++++++++++---------
 .../internal/projects/FlexJSProject.java        |   2 +-
 .../codegen/js/flexjs/TestFlexJSClass.java      |   2 +-
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  |  18 +-
 .../flex/compiler/internal/test/TestBase.java   |   2 +
 .../flexjs/files/FlexJSTest_again_result.js     |  10 +-
 .../flexjs/files/MyInitialView_result.js        |  16 +-
 .../files/controllers/MyController_result.js    |   6 +-
 .../flexjs/files/models/MyModel_result.js       |   3 +-
 .../flexjs/files/wildcard_import_result.js      |   2 +-
 .../flexjs/projects/interfaces/Test_result.js   |   4 +-
 .../projects/internal/MainClass_result.js       |   3 +-
 .../DifferentPackageAsConflict_result.js        |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../NoConflictNoWindow_result.js                |   3 +-
 .../NoConflictUseWindow_result.js               |   3 +-
 .../SamePackageAsConflict_result.js             |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../UseWindow_result.js                         |   3 +-
 .../mypackage/TestClass_result.js               |   3 +-
 .../projects/xml_requires/XMLRequire_result.js  |   3 +-
 27 files changed, 378 insertions(+), 381 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index abb9d3b..8ac7ae8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FilterWriter;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
@@ -163,12 +164,13 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
 
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
+        ArrayList<String> deps = new ArrayList<String>();
         boolean foundLanguage = false;
         boolean foundXML = false;
         boolean foundNamespace = false;
         boolean sawRequires = false;
     	boolean stillSearching = true;
-        int addIndex = -1;
+        int depsIndex = -1;
         int len = lines.length;
     	for (int i = 0; i < len; i++)
     	{
@@ -180,34 +182,42 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                 {
                     // if zero requires are found, require Language after the
                     // call to goog.provide
-                    addIndex = i + 1;
+                    depsIndex = i + 1;
                 }
-	            c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
+	            c = line.indexOf(token);
 	            if (c != -1)
 	            {
                     // we found other requires, so we'll just add Language at
                     // the end of the list
-                    addIndex = -1;
-	                int c2 = line.indexOf(")");
-	                String s = line.substring(c + 14, c2 - 1);
-                    if (s.equals(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
+                    depsIndex = i;
+	                int c2 = line.indexOf("*/");
+	                String s = line.substring(c + token.length(), c2);
+	                deps.addAll(Arrays.asList(s.split(",")));
+                    if (deps.contains(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
                     {
                         foundLanguage = true;
                     }
-                    else if (s.equals(IASLanguageConstants.XML))
+                    else if (deps.contains(IASLanguageConstants.XML))
                     {
                         foundXML = true;
                     }
-                    else if (s.equals(IASLanguageConstants.Namespace))
+                    else if (deps.contains(IASLanguageConstants.Namespace))
                     {
                         foundNamespace = true;
                     }
 	    			sawRequires = true;
-	    			if (!usedNames.contains(s))
-                    {
-                        removeLineFromMappings(i);
-                        continue;
-                    }
+	    			ArrayList<String> removalList = new ArrayList<String>();
+	    			for (String dep : deps)
+	    			{
+		    			if (!usedNames.contains(dep))
+	                    {
+	                        removalList.add(dep);
+	                    }	    				
+	    			}
+	    			for (String dep : removalList)
+	    				deps.remove(dep);
+                    continue;
 	    		}
 	    		else if (sawRequires || i == len - 1)
                 {
@@ -224,80 +234,30 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                         boolean needLanguage = flexJSProject.needLanguage;
                         if (needLanguage && !foundLanguage)
                         {
-                            StringBuilder appendString = new StringBuilder();
-                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-                            if(addIndex != -1)
-                            {
-                                // if we didn't find other requires, this index
-                                // points to the line after goog.provide
-                                finalLines.add(addIndex, appendString.toString());
-                                addLineToMappings(addIndex);
-                            }
-                            else
-                            {
-                                finalLines.add(appendString.toString());
-                                addLineToMappings(i);
-                            }
+                            deps.add(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
                         }
                         boolean needXML = flexJSProject.needXML;
                         if (needXML && !foundXML)
                         {
-                            StringBuilder appendString = new StringBuilder();
-                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(IASLanguageConstants.XML);
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-                            if(addIndex != -1)
-                            {
-                                // if we didn't find other requires, this index
-                                // points to the line after goog.provide
-                                finalLines.add(addIndex, appendString.toString());
-                                addLineToMappings(addIndex);
-                            }
-                            else
-                            {
-                                finalLines.add(appendString.toString());
-                                addLineToMappings(i);
-                            }
+                            deps.add(IASLanguageConstants.XML);
                         }
                         if (needNamespace && !foundNamespace)
                         {
-                            StringBuilder appendString = new StringBuilder();
-                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(IASLanguageConstants.Namespace);
-                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-                            if(addIndex != -1)
-                            {
-                                // if we didn't find other requires, this index
-                                // points to the line after goog.provide
-                                finalLines.add(addIndex, appendString.toString());
-                                addLineToMappings(addIndex);
-                            }
-                            else
-                            {
-                                finalLines.add(appendString.toString());
-                                addLineToMappings(i);
-                            }
+                            deps.add(IASLanguageConstants.Namespace);
                         }
                     }
                 }
     		}
     		finalLines.add(line);
     	}
-
+    	if (deps.size() > 0)
+    	{
+	        StringBuilder sb = new StringBuilder();
+	        sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
+	        sb.append(Joiner.on(",").join(deps));
+	        sb.append("*/\n");
+			finalLines.add(depsIndex, sb.toString());
+    	}
     	return Joiner.on("\n").join(finalLines);
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
index fd41804..5cf6d1c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitterTokens.java
@@ -32,6 +32,7 @@ public enum JSGoogEmitterTokens implements IEmitterTokens
     GOOG_INHERITS("goog.inherits"),
     GOOG_PROVIDE("goog.provide"),
     GOOG_REQUIRE("goog.require"),
+    FLEXJS_DEPENDENCY_LIST("/* FlexJS Dependency List: "),
     OBJECT("Object"),
     ARRAY("Array"),
     ERROR("Error"),

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index 22129d4..5c60baa 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -134,7 +134,8 @@ public class LiteralEmitter extends JSSubEmitter implements
                         s = s.replace("\"", "\\\"");
                         s = "\"" + s + "\"";
                     }
-                    s = "new XML( " + s + ")";
+                    // use formatQualifiedName to get XML in the usedNames dependencies
+                    s = "new " + getEmitter().formatQualifiedName("XML") + "( " + s + ")";
                 }
             }
             s = s.replaceAll("\n", "__NEWLINE_PLACEHOLDER__");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 73d3b80..1dd3935 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -211,14 +211,15 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
         String cname = (type != null) ? type.getQualifiedName() : otherMainDefinition.getQualifiedName();
         writtenRequires.add(cname); // make sure we don't add ourselves
-
+        String baseName = "";
 
         if (type instanceof IClassDefinition) {
+            IClassDefinition bindableClassDef = (IClassDefinition) type;
+            baseName = bindableClassDef.resolveBaseClass(flexProject).getQualifiedName();
             //check whether we should add the requires for the implicit Bindable EventDispatcher implementations
             boolean needsBindableSupport = ((IClassDefinition) type).needsEventDispatcher(flexProject);
 
             if (needsBindableSupport) {
-                IClassDefinition bindableClassDef = (IClassDefinition) type;
                 ClassDefinition objectClassDefinition = (ClassDefinition)flexProject.getBuiltinType(
                         IASLanguageConstants.BuiltinType.OBJECT);
 
@@ -258,9 +259,23 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
         }
 
-        boolean emitsRequires = emitRequires(requiresList, writtenRequires, cname);
+        if (interfacesList != null)
+        {
+	        for (String r : interfacesList)
+	        {
+	        	while (requiresList.contains(r))
+	        	{
+	        		requiresList.remove(r);
+	        		System.out.println("interface " + r + "is already in requires list");
+	        	}
+	        }
+        }
+        boolean emitsRequires = emitRequires(requiresList, writtenRequires, cname, baseName);
         boolean emitsInterfaces = emitInterfaces(interfacesList, writtenRequires);
 
+        boolean isMainCU = flexProject.mainCU != null
+        	&& cu.getName().equals(flexProject.mainCU.getName());
+        /*
         // erikdebruin: Add missing language feature support, with e.g. 'is' and
         //              'as' operators. We don't need to worry about requiring
         //              this in every project: ADVANCED_OPTIMISATIONS will NOT
@@ -286,7 +301,8 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
                 }
             }
         }
-
+		*/
+        
         boolean emitsExternalRequires = emitExternalRequires(externalRequiresList, writtenRequires);
 
         if (emitsRequires || emitsInterfaces || emitsExternalRequires || isMainCU)
@@ -298,9 +314,13 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
         writeNewline();
     }
 
-    private boolean emitRequires(List<String> requiresList, List<String> writtenRequires, String cname)
+    private boolean emitRequires(List<String> requiresList, List<String> writtenRequires, String cname, String baseName)
     {
+    	StringBuilder sb = new StringBuilder();
+    	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
+    	
         boolean emitsRequires = false;
+        boolean firstDependency = true;
         if (requiresList != null)
         {
             Collections.sort(requiresList);
@@ -328,22 +348,37 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
                 if (writtenRequires.indexOf(imp) == -1)
                 {
-
-                    /* goog.require('x');\n */
-                    write(JSGoogEmitterTokens.GOOG_REQUIRE);
-                    write(ASEmitterTokens.PAREN_OPEN);
-                    write(ASEmitterTokens.SINGLE_QUOTE);
-                    write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
-                    write(ASEmitterTokens.SINGLE_QUOTE);
-                    write(ASEmitterTokens.PAREN_CLOSE);
-                    writeNewline(ASEmitterTokens.SEMICOLON);
+                	if (imp.equals(baseName))
+                	{
+	                    /* goog.require('x');\n */
+	                    write(JSGoogEmitterTokens.GOOG_REQUIRE);
+	                    write(ASEmitterTokens.PAREN_OPEN);
+	                    write(ASEmitterTokens.SINGLE_QUOTE);
+	                    write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
+	                    write(ASEmitterTokens.SINGLE_QUOTE);
+	                    write(ASEmitterTokens.PAREN_CLOSE);
+	                    writeNewline(ASEmitterTokens.SEMICOLON);
+	                    emitsRequires = true;
+                	}
+                	else
+                	{
+                		if (!firstDependency)
+                			sb.append(",");
+                		sb.append(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
+                		firstDependency = false;
+                	}
 
                     writtenRequires.add(imp);
-
-                    emitsRequires = true;
                 }
             }
         }
+        
+        if (!firstDependency)
+        {
+        	sb.append("*/\n");
+        	write(sb.toString());
+        	emitsRequires = true;
+        }
         return emitsRequires;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 21aef44..da9d3e3 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -23,6 +23,7 @@ package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 import java.io.File;
 import java.io.FilterWriter;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -158,27 +159,31 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
     	int endRequires = -1;
+    	int provideIndex = -1;
     	boolean sawRequires = false;
+    	boolean depsAdded = false;
     	boolean stillSearching = true;
         ArrayList<String> namesToAdd = new ArrayList<String>();
         ArrayList<String> foundRequires = new ArrayList<String>();
+        int i = 0;
     	for (String line : lines)
     	{
     		if (stillSearching)
     		{
-	            int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+    			String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
+	            int c = line.indexOf(token);
 	            if (c > -1)
 	            {
-	                int c2 = line.indexOf(")");
-	                String s = line.substring(c + 14, c2 - 1);
-                    if (s.equals(IASLanguageConstants.XML))
-                    {
-                        foundXML = true;
-                    }
+	                int c2 = line.indexOf("*/");
+	                String s = line.substring(c + token.length(), c2);
+	                String[] reqs = s.split(",");
+	                for (String req : reqs)
+	                {
+	                	if (usedNames.contains(req) && !foundRequires.contains(req))
+	                		foundRequires.add(req);
+	                }
 	    			sawRequires = true;
-                    foundRequires.add(s);
-	    			if (!usedNames.contains(s))
-	    				continue;
+	    			endRequires = i;
 	    		}
 	    		else if (sawRequires)
 	    		{
@@ -202,27 +207,23 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
                     for (String nameToAdd : namesToAdd) {
                         //System.out.println("adding late requires:"+nameToAdd);
-                        finalLines.add(createRequireLine(nameToAdd,false));
+                    	if (!foundRequires.contains(nameToAdd))
+                    		foundRequires.add(nameToAdd);
                     }
-
-	    			endRequires = finalLines.size();
+	    		}
+	    		else if (line.indexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken()) != -1)
+	    		{
+	    			provideIndex = i;
 	    		}
     		}
     		finalLines.add(line);
+    		i++;
     	}
         boolean needXML = ((FlexJSProject)(((IMXMLBlockWalker) getMXMLWalker()).getProject())).needXML;
-        if (needXML && !foundXML)
-        {
-            StringBuilder appendString = new StringBuilder();
-            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-            appendString.append(IASLanguageConstants.XML);
-            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-            finalLines.add(endRequires, appendString.toString());
-            // TODO (aharui) addLineToMappings(finalLines.size());
+        if (needXML && !foundRequires.contains(IASLanguageConstants.XML))
+        {
+    		foundRequires.add(IASLanguageConstants.XML);
+    		depsAdded = true;
         }
     	// append info() structure if main CU
         ICompilerProject project = getMXMLWalker().getProject();
@@ -255,15 +256,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 		            			mixinInject += ", "; 
 		            		mixinInject += mixin;
 		            		firstOne = false;
-		                    StringBuilder appendString = new StringBuilder();
-		                    appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-		                    appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-		                    appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-		                    appendString.append(mixin);
-		                    appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-		                    appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-		                    appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-	                        finalLines.add(endRequires, appendString.toString());
+		                    foundRequires.add(mixin);
+		                    depsAdded = true;
 	                        //addLineToMappings(finalLines.size());
 		            	}
 		            	mixinInject += "]";
@@ -305,6 +299,18 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 	            }
             }
         }
+        if (foundRequires.size() > 0)
+        {
+        	StringBuilder sb = new StringBuilder();
+        	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
+            sb.append(Joiner.on(",").join(foundRequires));
+            sb.append("*/\n");
+            if (endRequires == -1)
+            	finalLines.add(provideIndex + 1, sb.toString());
+            else
+            	finalLines.set(endRequires, sb.toString());
+
+        }
     	return Joiner.on("\n").join(finalLines);
     }
     
@@ -2318,20 +2324,17 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writtenInstances.add(formatQualifiedName(cname)); // make sure we don't add ourselves
         writtenInstances.add(formatQualifiedName(bcname)); // make sure we don't add the baseclass twice
         allInstances.addAll(0, instances);
-        for (MXMLDescriptorSpecifier instance : allInstances)
-        {
-            String name = instance.name;
-            if (writtenInstances.indexOf(name) == -1)
-            {
-                emitHeaderLine(name);
-                writtenInstances.add(name);
-            }
-        }
+        
         ASProjectScope projectScope = (ASProjectScope) project.getScope();
         IDefinition cdef = node.getDefinition();
         ICompilationUnit cu = projectScope
                 .getCompilationUnitForDefinition(cdef);
         ArrayList<String> deps = project.getRequires(cu);
+        for (MXMLDescriptorSpecifier instance : allInstances)
+        {
+            String name = instance.name;
+            deps.add(name);
+        }
 
         // TODO (mschmalle) will remove this cast as more things get abstracted
         JSFlexJSEmitter fjs = (JSFlexJSEmitter) ((IMXMLBlockWalker) getMXMLWalker())
@@ -2349,10 +2352,20 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         	String[] interfaces = interfaceList.split(", ");
         	for (String iface : interfaces)
         	{
-        		deps.add(iface);
+        		while (deps.contains(iface))
+        			deps.remove(iface);
         		usedNames.add(iface);
+                if (writtenInstances.indexOf(iface) == -1)
+                {
+                    emitHeaderLine(iface);
+                    writtenInstances.add(iface);
+                }
         	}
         }
+        boolean firstDependency = true;
+        boolean depsAdded = false;
+    	StringBuilder sb = new StringBuilder();
+    	sb.append(JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken());
         if (deps != null)
         {
         	Collections.sort(deps);
@@ -2389,8 +2402,12 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 String formatted = formatQualifiedName(imp, false);
                 if (writtenInstances.indexOf(formatted) == -1)
                 {
-                    emitHeaderLine(imp);
+            		if (!firstDependency)
+            			sb.append(",");
+                    sb.append(formatted);
                     writtenInstances.add(formatted);
+                    firstDependency = false;
+                    depsAdded = true;
                 }
             }
         }
@@ -2405,10 +2422,19 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             if (project instanceof FlexJSProject)
             {
             	if (((FlexJSProject)project).needLanguage)
-            		emitHeaderLine(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+            	{
+            		if (!firstDependency)
+            			sb.append(",");
+            		sb.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+                    depsAdded = true;
+            	}
             }
         }
-
+        sb.append("*/\n");
+        if (depsAdded)
+        {
+        	write(sb.toString());
+        }
         writeNewline();
         writeNewline();
     }
@@ -2430,18 +2456,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writeNewline(ASEmitterTokens.SEMICOLON);
     }
 
-    private String createRequireLine(String qname, boolean isProvide) {
-        StringBuilder createHeader = new StringBuilder();
-        createHeader.append(isProvide ? JSGoogEmitterTokens.GOOG_PROVIDE.getToken() : JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-        createHeader.append(ASEmitterTokens.PAREN_OPEN.getToken());
-        createHeader.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        createHeader.append(qname);
-        createHeader.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        createHeader.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-        createHeader.append(ASEmitterTokens.SEMICOLON.getToken());
-        return createHeader.toString();
-    }
-
     //--------------------------------------------------------------------------
     //    Utils
     //--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 3b11121..656dabb 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -312,7 +312,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         // This list contains all files generated by the compiler, this is both the
         // compiled js files created by the sources of the current project plus the
         // js files of used dependencies.
-        ArrayList<String> fileList = gdw.getListOfFiles(problems);
+        ArrayList<String> fileList = gdw.getListOfFiles(project, problems);
         for (String file : fileList) {
             compilerWrapper.addJSSourceFile(file);
         }
@@ -324,7 +324,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
         // The application needs to import all dependencies the application needs, this
         // is generated here so it can be used for outputting the html templates.
-        String depsFileData = gdw.generateDeps(problems);
+        String depsFileData = gdw.generateDeps(project, problems);
 
         File template = ((JSGoogConfiguration)configuration).getHtmlTemplate();
         // Create the index.html for the debug-js version.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 187ca8f..d106ea0 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -28,6 +28,8 @@ import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,9 +38,16 @@ import java.util.Set;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.flex.compiler.clients.problems.ProblemQuery;
+import org.apache.flex.compiler.common.DependencyType;
+import org.apache.flex.compiler.common.DependencyTypeSet;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
+import org.apache.flex.compiler.internal.driver.js.JSCompilationUnit;
 import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.projects.DefinitionPriority;
+import org.apache.flex.compiler.internal.projects.DependencyGraph;
 import org.apache.flex.compiler.problems.FileNotFoundProblem;
+import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.swc.ISWC;
 import org.apache.flex.swc.ISWCFileEntry;
 
@@ -66,42 +75,54 @@ public class GoogDepsWriter {
 	private List<String> otherPaths;
 	private List<ISWC> swcs;
 	private boolean removeCirculars = false;
-	private boolean problemsFound = false;
 	private ArrayList<GoogDep> dps;
+	private DependencyGraph graph;
+	private CompilerProject project;
 	
-	private HashMap<String,GoogDep> depMap = new HashMap<String,GoogDep>();
-	private HashMap<String, String> requireMap = new HashMap<String, String>();
+	private HashMap<String, GoogDep> depMap = new HashMap<String,GoogDep>();
+	private HashMap<String, ICompilationUnit> requireMap = new HashMap<String, ICompilationUnit>();
+	private HashMap<ICompilationUnit, String> requireMap2 = new HashMap<ICompilationUnit, String>();
 	
 	public boolean needCSS = false;
 	
-	public ArrayList<String> getListOfFiles(ProblemQuery problems)
+	public ArrayList<String> getListOfFiles(CompilerProject project, ProblemQuery problems)
 	{
-		problemsFound = false;
+		this.project = project;
 		this.problems = problems;
 
 		if (dps == null)
 		{
 			buildDB();
-			dps = sort(mainName);
+			dps = sort();
 		}
+		visited.clear();
 		ArrayList<String> files = new ArrayList<String>();
 		for (GoogDep gd : dps)
 		{
 			files.add(gd.filePath);
+			visited.put(gd.className, gd);
 		}
+		GoogDep mainDep = depMap.get(mainName);
+		visited.put(mainName, mainDep);
+		for (GoogDep gd : depMap.values())
+		{
+			if (!visited.containsKey(gd.className))
+				files.add(gd.filePath);			
+		}
+		files.add(mainDep.filePath);
 		return files;
 	}
 	
-	public String generateDeps(ProblemQuery problems) throws FileNotFoundException
+	public String generateDeps(CompilerProject project, ProblemQuery problems) throws FileNotFoundException
 	{
-	    problemsFound = false;
+		this.project = project;
 	    this.problems = problems;
 	    if (dps == null)
 	    {
 	    	buildDB();
-	    	dps = sort(mainName);
+	    	dps = sort();
 	    }
-	    StringBuilder sb = new StringBuilder("// generated by FalconJX\n");
+	    StringBuilder sb = new StringBuilder();
 		int n = dps.size();
 		for (int i = n - 1; i >= 0; i--)
 		{
@@ -109,9 +130,35 @@ public class GoogDepsWriter {
 			if (!isGoogClass(gd.className)) 
 			{
 				sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', ['")
-						.append(gd.className).append("'], [").append(getDependencies(gd.deps)).append("]);\n");
+						.append(gd.className).append("'], [")
+						.append((gd.fileInfo.impls != null) ? getDependencies(gd.fileInfo.impls) : "")
+						.append("]);\n");
+			}
+		}
+		StringBuilder mainDeps = new StringBuilder();
+		GoogDep mainDep = depMap.get(mainName);
+		mainDeps.append("goog.addDependency('").append(relativePath(mainDep.filePath)).append("', ['")
+							.append(mainDep.className).append("'], [");
+		ArrayList<String> restOfDeps = new ArrayList<String>();
+        DependencyTypeSet dependencyTypes = DependencyTypeSet.allOf();
+		// get the list of all units not referenced by other units
+		for (GoogDep gd : depMap.values())
+		{
+			if (gd.className.equals(mainName)) continue;
+			ICompilationUnit unit = requireMap.get(gd.className);
+			if (unit == null)
+			{
+				restOfDeps.add(gd.className);
+				continue;
 			}
+			Set<ICompilationUnit> deps = graph.getDirectReverseDependencies(unit, dependencyTypes);
+			if (deps.size() == 0)
+				restOfDeps.add(gd.className);
 		}
+		mainDeps.append(getDependencies(restOfDeps)).append("]);\n");
+		sb.insert(0, mainDeps);
+		sb.insert(0, "// generated by FalconJX\n");
+		addRestOfDeps(mainDep, restOfDeps);
 		return sb.toString();
 	}
 	
@@ -122,71 +169,102 @@ public class GoogDepsWriter {
 	
 	private void buildDB()
 	{
+		graph = new DependencyGraph();
 		addDeps(mainName);
 	}
 	
-    public ArrayList<String> filePathsInOrder = new ArrayList<String>();
-    
     public ArrayList<String> additionalHTML = new ArrayList<String>();
     
     private HashMap<String, GoogDep> visited = new HashMap<String, GoogDep>();
-    private HashMap<String, GoogDep> inArray = new HashMap<String, GoogDep>();
     
-	private ArrayList<GoogDep> sort(String rootClassName)
+	private ArrayList<GoogDep> sort()
 	{
-		ArrayList<GoogDep> arr = new ArrayList<GoogDep>();
-		GoogDep current = depMap.get(rootClassName);
-		sortFunction(current, arr);
-		return arr;
+		GoogDep current = depMap.get(mainName);
+		sortFunction(current);
+		ICompilationUnit mainUnit = requireMap.get(mainName);
+		ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
+		roots.add(mainUnit);
+		requireMap.remove(mainName);
+		
+		List<ICompilationUnit> order = graph.topologicalSort(requireMap.values());
+		ArrayList<GoogDep> depsInOrder = new ArrayList<GoogDep>();
+		for (ICompilationUnit unit : order)
+		{
+			String name = requireMap2.get(unit);
+			GoogDep dep = depMap.get(name);
+			depsInOrder.add(dep);
+		}
+		return depsInOrder;
 	}
 	
-	private void sortFunction(GoogDep current, ArrayList<GoogDep> arr)
+	private void sortFunction(GoogDep current)
 	{
 		visited.put(current.className, current);
 		
-		filePathsInOrder.add(current.filePath);
-		if (removeCirculars)
-			removeCirculars(current);
-        System.out.println("Dependencies calculated for '" + current.filePath + "'");
+		//removeRequires(current);
+        System.out.println("Dependencies calculated for '" + current.className + "'");
 
-		ArrayList<GoogDep> visitedButNotAdded = new ArrayList<GoogDep>();
+		ICompilationUnit unit;
+		if (current.fileInfo.deps == null)
+			return;
+		
+		unit = requireMap.get(current.className);
+		if (unit == null)
+		{
+			unit = new JSCompilationUnit(project, current.filePath, DefinitionPriority.BasePriority.SOURCE_LIST, current.className);
+			graph.addCompilationUnit(unit);
+			requireMap.put(current.className, unit);
+			requireMap2.put(unit, current.className);
+		}
 		ArrayList<String> deps = current.deps;
 		for (String className : deps)
 		{
 			if (!isGoogClass(className))
 			{
-				if (!visited.containsKey(className))
+				GoogDep gd = depMap.get(className);
+				if (gd != null && current.fileInfo.impls != null && current.fileInfo.impls.contains(className))
 				{
-					GoogDep gd = depMap.get(className);
-					sortFunction(gd, arr);
+					ICompilationUnit base = requireMap.get(className);
+					if (base == null)
+					{
+						base = new JSCompilationUnit(project, className, DefinitionPriority.BasePriority.SOURCE_LIST, className);
+						graph.addCompilationUnit(base);
+						requireMap.put(className, base);
+						requireMap2.put(base, className);
+					}
+					graph.addDependency(unit, base, DependencyType.INHERITANCE);
 				}
-				else
+				if (!visited.containsKey(className))
 				{
-			        if (!inArray.containsKey(className))
-			        {
-			        	// if we get here, we haven't yet added the dependency to the
-			        	// array of GoogDeps because we are computing its dependencies.
-			        	// For example, class A extends B which references class C which
-			        	// extends B.  This isn't a circular reference.  But B needs to
-			        	// be in the array before C instead of just before A.
-			        	visitedButNotAdded.add(depMap.get(className));
-				        System.out.println("Visited but haven't added: '" + className + "'");
-			        }
+					if (gd != null)
+						sortFunction(gd);
 				}
 			}
 		}
-		for (GoogDep gdep : visitedButNotAdded)
-		{
-			if (!inArray.containsKey(gdep.className))
+	}
+	
+	private void addRestOfDeps(GoogDep main, List<String> restOfDeps)
+	{
+        List<String> fileLines;
+		try {
+			fileLines = Files.readLines(new File(main.filePath), Charset.defaultCharset());
+			int n = restOfDeps.size();
+			for (int i = n - 1; i >= 0; i--)
 			{
-				arr.add(gdep);
-				inArray.put(gdep.className, gdep);
+				String dep = restOfDeps.get(i);
+				//if (!main.deps.contains(dep))
+					fileLines.add(main.fileInfo.googProvideLine + 1, JSGoogEmitterTokens.GOOG_REQUIRE.getToken() + "('" + dep + "');");
 			}
-		}
-		if (!inArray.containsKey(current.className))
-		{
-			arr.add(current);
-			inArray.put(current.className, current);
+            File file = new File(main.filePath);  
+            PrintWriter out = new PrintWriter(new FileWriter(file));  
+            for (String s : fileLines)
+            {
+                out.println(s);
+            }
+            out.close();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
 		}
 		
 	}
@@ -214,39 +292,25 @@ public class GoogDepsWriter {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-		ArrayList<String> deps = getDirectDependencies(gd.filePath);
-		
 		gd.deps = new ArrayList<String>();
-		for (String dep : deps)
+		if (gd.fileInfo.deps != null)
 		{
-			if (gd.fileInfo.impls != null && gd.fileInfo.impls.contains(dep))
-			{
-				if (!requireMap.containsKey(dep))
-				{
-					// we are first class that needs this dependency
-					// at prototype initialization time
-					requireMap.put(dep, className);
-				}
-			}
-			else if (depMap.containsKey(dep) && !isGoogClass(dep))
-		    {
-		        continue;
-		    }
-			gd.deps.add(dep);
+	        for (String dep : gd.fileInfo.deps)
+	        {
+	        	gd.deps.add(dep);
+	            addDeps(dep);
+	        }
 		}
-        for (String dep : deps)
-        {
-            addDeps(dep);
-        }
 	}
 	
-	void removeCirculars(GoogDep gd)
+	void removeRequires(GoogDep gd)
 	{
 		String className = gd.className;
 		
-	    // remove requires that would cause circularity
+	    // remove requires that are not base classes and interfaces
 	    try
         {
+	    	gd = depMap.get(className);
             List<String> fileLines = Files.readLines(new File(gd.filePath), Charset.defaultCharset());
             ArrayList<String> finalLines = new ArrayList<String>();
             
@@ -264,29 +328,12 @@ public class GoogDepsWriter {
                         String s = line.substring(c + 14, c2 - 1);
                         if (gd.fileInfo.impls == null || !gd.fileInfo.impls.contains(s))
                         {
-	                        if (requireMap.containsKey(s) && requireMap.get(s) != className)
-	                        {
-	                        	// don't add the require if some class needs it at static initialization
-	                        	// time and that class is not this class
-	                        	suppressCount++;
-	                        	System.out.println(gd.filePath + " removing circular (static): " + s);
-	                        	continue;
-	                        }
-	                        else if (!gd.deps.contains(s))
-	                        {
-	                        	// someone require'd this class
-	                        	suppressCount++;
-	                        	System.out.println(gd.filePath + " removing circular: " + s);
-	                        	continue;
-	                        }
-	                        else if (gd.deps.contains(s) && !isGoogClass(s) && onProtoChain(s, className))
-	                        {
-	                        	// if we are on the proto chain of s, then take away our require of s
-	                        	suppressCount++;
-	                        	System.out.println(gd.filePath + " removing circular (proto): " + s);
-	                        	continue;
-	                        }
-                        }
+                        	// don't add the require if some class needs it at static initialization
+                        	// time and that class is not this class
+                        	suppressCount++;
+                        	System.out.println(gd.filePath + " removing require: " + s);
+                        	continue;
+	                    }
                     }
             	}
                 finalLines.add(line);
@@ -368,28 +415,7 @@ public class GoogDepsWriter {
             e.printStackTrace();
         }		
 	}
-	
-	boolean onProtoChain(String name, String base)
-	{
-		GoogDep gd = depMap.get(name);
-		if (gd == null)
-		{
-			System.out.println("no dep info for " + name);
-			return false;
-		}
-		if (gd.fileInfo.impls != null)
-		{
-			if (gd.fileInfo.impls.contains(base))
-				return true;
-			for (String s : gd.fileInfo.impls)
-			{
-				if (!isGoogClass(s) && onProtoChain(s, base))
-					return true;
-			}
-		}
-		return false;
-	}
-	
+		
 	FileInfo getFileInfo(List<String> lines, String className)
 	{
 		FileInfo fi = new FileInfo();
@@ -399,6 +425,7 @@ public class GoogDepsWriter {
 	    fi.suppressLine = -1;
 	    fi.fileoverviewLine = -1;
 	    fi.googProvideLine = -1;
+		boolean inInjectHTML = false;
 	    for (int i = 0; i < n; i++)
 	    {
 	        String line = lines.get(i);
@@ -426,6 +453,24 @@ public class GoogDepsWriter {
 	        }
 	        else
 	        {
+		        if (inInjectHTML)
+	            {
+	                if (line.indexOf("</inject_html>") > -1)
+	                {
+	                    inInjectHTML = false;
+	                    continue;
+	                }
+	            	line = line.trim();
+	            	if (line.startsWith("*"))
+	            		line = line.substring(1);
+				    additionalHTML.add(line);
+				    continue;
+	            }
+                c = line.indexOf("<inject_html>");
+                if (c > -1)
+                {
+                    inInjectHTML = true;
+                }
 		        c = line.indexOf("@constructor");
 		        if (c > -1)
 		        	fi.constructorLine = i;
@@ -472,7 +517,20 @@ public class GoogDepsWriter {
 						        			c2 = line.indexOf("}", c);
 						        			String impl = line.substring(c + 10, c2);
 						        			fi.impls.add(impl);
-						        		}					        			
+						        		}
+						        		else
+						        		{
+						        			String token = JSGoogEmitterTokens.FLEXJS_DEPENDENCY_LIST.getToken();
+						    				c = line.indexOf(token);
+						    				if (c > -1)
+						    				{
+						    					c2 = line.indexOf("*/");
+						    					line = line.substring(c + token.length(), c2 - 1);
+							        			fi.deps = new ArrayList<String>();
+						    					fi.deps.addAll(Arrays.asList(line.split(",")));
+						    				}
+
+						        		}
 					        		}
 					        	}
 				        	}
@@ -628,61 +686,9 @@ public class GoogDepsWriter {
         
 		System.out.println("Could not find file for class: " + className);
 		problems.add(new FileNotFoundProblem(className));
-		problemsFound = true;
 		return "";
 	}
 	
-	private ArrayList<String> getDirectDependencies(String fn)
-	{
-		ArrayList<String> deps = new ArrayList<String>();
-		
-		FileInputStream fis;
-		try {
-			fis = new FileInputStream(fn);
-			Scanner scanner = new Scanner(fis, "UTF-8");
-			boolean inInjectHTML = false;
-			while (scanner.hasNextLine())
-			{
-				String s = scanner.nextLine();
-				if (s.contains("goog.inherits"))
-					break;
-                if (inInjectHTML)
-                {
-                    int c = s.indexOf("</inject_html>");
-                    if (c > -1)
-                    {
-                        inInjectHTML = false;
-                        continue;
-                    }
-                }    
-                if (inInjectHTML)
-                {
-                	s = s.trim();
-                	if (s.startsWith("*"))
-                		s = s.substring(1);
-				    additionalHTML.add(s);
-				    continue;
-                }
-				int c = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-				if (c > -1)
-				{
-					int c2 = s.indexOf(")");
-					s = s.substring(c + 14, c2 - 1);
-					deps.add(s);
-				}
-                c = s.indexOf("<inject_html>");
-                if (c > -1)
-                {
-                    inInjectHTML = true;
-                }
-			}
-			scanner.close();
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		}
-		return deps;
-	}
-	
 	private String getDependencies(ArrayList<String> deps)
 	{
 		String s = "";
@@ -732,6 +738,7 @@ public class GoogDepsWriter {
 	{
 		public String inherits;
 		public ArrayList<String> impls;
+		public ArrayList<String> deps;
 		public int constructorLine;
 		public int suppressLine;
 		public int fileoverviewLine;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 9382e86..3dec3ab 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -91,7 +91,7 @@ public class FlexJSProject extends FlexProject
         IDefinition def = dp.get(0);
         // IDefinition def = to.getDefinitionPromises().get(0);
         IDefinition actualDef = ((DefinitionPromise) def).getActualDefinition();
-        boolean isInterface = actualDef instanceof InterfaceDefinition;
+        boolean isInterface = (actualDef instanceof InterfaceDefinition) && (dt == DependencyType.INHERITANCE);
         if (!isInterface)
         {
             if (from != to)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index 07c8000..6664be5 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -468,7 +468,7 @@ public class TestFlexJSClass extends TestGoogClass
     {
         FileNode node = (FileNode)getNode("package org.apache.flex {\npublic class A {\nimport flash.display.Sprite; Sprite;\n}}", FileNode.class, 0);
         asBlockWalker.visitFile(node);
-        assertOut("/**\n * org.apache.flex.A\n *\n * @fileoverview\n *\n * @suppress {checkTypes|accessControls}\n */\n\ngoog.provide('org.apache.flex.A');\n\ngoog.require('flash.display.Sprite');\n\n\n\n/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
+        assertOut("/**\n * org.apache.flex.A\n *\n * @fileoverview\n *\n * @suppress {checkTypes|accessControls}\n */\n\ngoog.provide('org.apache.flex.A');\n\n/* FlexJS Dependency List: flash.display.Sprite*/\n\n\n\n/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index d49661d..b03f72c 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -316,9 +316,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"goog.require('org.apache.flex.core.View');\n" +
-        		"goog.require('org.apache.flex.html.Label');\n" +
-        		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
+        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.net.HTTPConstants*/\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -438,9 +436,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"goog.require('org.apache.flex.core.View');\n" +
-        		"goog.require('org.apache.flex.html.Label');\n" +
-        		"goog.require('org.apache.flex.net.HTTPConstants');\n" +
+        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.net.HTTPConstants*/\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -561,9 +557,7 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"goog.require('org.apache.flex.core.View');\n" +
-        		"goog.require('org.apache.flex.html.Label');\n" +
-        		"goog.require('binding.ComplexValueObject');\n" +
+        		"/* FlexJS Dependency List: binding.ComplexValueObject,org.apache.flex.core.View,org.apache.flex.html.Label*/\n" +
         		"\n" +
         		"\n" +
         		"\n" +
@@ -716,10 +710,8 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         		"goog.provide('AppName');\n" +
         		"\n" +
         		"goog.require('org.apache.flex.core.Application');\n" +
-        		"goog.require('org.apache.flex.core.View');\n" +
-        		"goog.require('org.apache.flex.html.Label');\n" +
-        		"goog.require('XML');\n" +
-        		"goog.require('XML');\n" +
+        		"/* FlexJS Dependency List: org.apache.flex.core.View,org.apache.flex.html.Label,org.apache.flex.core.Application,XML*/\n" +
+        		"\n" +
         		"\n" +
         		"\n" +
         		"\n" +

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
index fce0907..6a165e6 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
@@ -448,6 +448,7 @@ public class TestBase implements ITestBase
             }
         }
 
+        /*
         File outputRootDir = new File(
                 FilenameNormalization.normalize(tempDir
                         + File.separator + inputDirName));
@@ -464,6 +465,7 @@ public class TestBase implements ITestBase
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
+		*/
         return compiledFileNames;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
index 7da2ae9..fa34845 100644
--- a/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_result.js
@@ -22,15 +22,7 @@
 goog.provide('FlexJSTest_again');
 
 goog.require('org.apache.flex.core.Application');
-goog.require('org.apache.flex.core.SimpleCSSValuesImpl');
-goog.require('MyInitialView');
-goog.require('models.MyModel');
-goog.require('controllers.MyController');
-goog.require('org.apache.flex.net.HTTPService');
-goog.require('org.apache.flex.collections.LazyCollection');
-goog.require('org.apache.flex.collections.parsers.JSONInputParser');
-goog.require('StockDataJSONItemConverter');
-goog.require('org.apache.flex.events.Event');
+/* FlexJS Dependency List: MyInitialView,StockDataJSONItemConverter,controllers.MyController,models.MyModel,org.apache.flex.collections.LazyCollection,org.apache.flex.collections.parsers.JSONInputParser,org.apache.flex.core.SimpleCSSValuesImpl,org.apache.flex.events.Event,org.apache.flex.net.HTTPService*/
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js b/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
index 1bc0837..1869f7a 100644
--- a/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/MyInitialView_result.js
@@ -22,21 +22,7 @@
 goog.provide('MyInitialView');
 
 goog.require('org.apache.flex.core.View');
-goog.require('org.apache.flex.html.Label');
-goog.require('org.apache.flex.binding.SimpleBinding');
-goog.require('org.apache.flex.html.TextButton');
-goog.require('org.apache.flex.html.List');
-goog.require('org.apache.flex.binding.ConstantBinding');
-goog.require('org.apache.flex.html.TextArea');
-goog.require('org.apache.flex.html.TextInput');
-goog.require('org.apache.flex.html.CheckBox');
-goog.require('org.apache.flex.html.RadioButton');
-goog.require('org.apache.flex.html.DropDownList');
-goog.require('org.apache.flex.html.ComboBox');
-goog.require('org.apache.flex.events.CustomEvent');
-goog.require('org.apache.flex.events.Event');
-goog.require('org.apache.flex.events.MouseEvent');
-goog.require('org.apache.flex.utils.Timer');
+/* FlexJS Dependency List: org.apache.flex.binding.ConstantBinding,org.apache.flex.binding.SimpleBinding,org.apache.flex.events.CustomEvent,org.apache.flex.events.Event,org.apache.flex.events.MouseEvent,org.apache.flex.html.CheckBox,org.apache.flex.html.ComboBox,org.apache.flex.html.DropDownList,org.apache.flex.html.Label,org.apache.flex.html.List,org.apache.flex.html.RadioButton,org.apache.flex.html.TextArea,org.apache.flex.html.TextButton,org.apache.flex.html.TextInput,org.apache.flex.utils.Timer*/
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js b/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
index 7fde95a..9660e90 100644
--- a/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/controllers/MyController_result.js
@@ -21,11 +21,9 @@
 
 goog.provide('controllers.MyController');
 
-goog.require('FlexJSTest_again');
-goog.require('MyInitialView');
-goog.require('models.MyModel');
+/* FlexJS Dependency List: FlexJSTest_again,MyInitialView,models.MyModel,org.apache.flex.utils.Language*/
+
 goog.require('org.apache.flex.core.IDocument');
-goog.require('org.apache.flex.utils.Language');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js b/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
index ff0160f..451f6f6 100644
--- a/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/models/MyModel_result.js
@@ -21,8 +21,9 @@
 
 goog.provide('models.MyModel');
 
-goog.require('org.apache.flex.events.Event');
 goog.require('org.apache.flex.events.EventDispatcher');
+/* FlexJS Dependency List: org.apache.flex.events.Event*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js b/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
index 7bc6a18..b7fadeb 100644
--- a/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
+++ b/compiler-jx/src/test/resources/flexjs/files/wildcard_import_result.js
@@ -22,7 +22,7 @@
 goog.provide('wildcard_import');
 
 goog.require('org.apache.flex.core.Application');
-goog.require('org.apache.flex.html.Button');
+/* FlexJS Dependency List: org.apache.flex.html.Button*/
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js b/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
index d2f47bd..3d9a208 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/interfaces/Test_result.js
@@ -22,10 +22,10 @@
 goog.provide('Test');
 
 goog.require('classes.A');
+/* FlexJS Dependency List: interfaces.IC,org.apache.flex.utils.Language*/
+
 goog.require('interfaces.IA');
-goog.require('interfaces.IC');
 goog.require('interfaces.IE');
-goog.require('org.apache.flex.utils.Language');
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
index a96b203..10e2247 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('MainClass');
 
-goog.require('OtherClass');
+/* FlexJS Dependency List: OtherClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
index deee65d..befa608 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/DifferentPackageAsConflict_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('DifferentPackageAsConflict');
 
-goog.require('mypackage.TestClass');
+/* FlexJS Dependency List: mypackage.TestClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
index 229dbc2..f950891 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_different_package_as_conflict/mypackage/TestClass_result.js
@@ -22,7 +22,8 @@
 
 goog.provide('mypackage.TestClass');
 
-goog.require('otherpackage.Event');
+/* FlexJS Dependency List: otherpackage.Event*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
index 54347bc..4b4238f 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_no_window/NoConflictNoWindow_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('NoConflictNoWindow');
 
-goog.require('mypackage.TestClass');
+/* FlexJS Dependency List: mypackage.TestClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
index c99ffad..b5719d6 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_no_conflict_use_window/NoConflictUseWindow_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('NoConflictUseWindow');
 
-goog.require('mypackage.TestClass');
+/* FlexJS Dependency List: mypackage.TestClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
index 83f36cc..e9cf354 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/SamePackageAsConflict_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('SamePackageAsConflict');
 
-goog.require('mypackage.TestClass');
+/* FlexJS Dependency List: mypackage.TestClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
index fbb13ea..cd6e7a6 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_same_package_as_conflict/mypackage/TestClass_result.js
@@ -22,7 +22,8 @@
 
 goog.provide('mypackage.TestClass');
 
-goog.require('mypackage.Event');
+/* FlexJS Dependency List: mypackage.Event*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
index ca1d8dd..629b8e5 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/UseWindow_result.js
@@ -21,7 +21,8 @@
 
 goog.provide('UseWindow');
 
-goog.require('mypackage.TestClass');
+/* FlexJS Dependency List: mypackage.TestClass*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
index 7af3f86..9ec0d4f 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/package_conflicts_use_window/mypackage/TestClass_result.js
@@ -22,7 +22,8 @@
 
 goog.provide('mypackage.TestClass');
 
-goog.require('otherpackage.Event');
+/* FlexJS Dependency List: otherpackage.Event*/
+
 
 
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db46a750/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js b/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
index fa2c11e..c788cf8 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/xml_requires/XMLRequire_result.js
@@ -21,8 +21,7 @@
 
 goog.provide('XMLRequire');
 
-goog.require('XML');
-
+/* FlexJS Dependency List: XML*/
 
 
 


[40/50] git commit: [flex-falcon] [refs/heads/dual] - handle subcomponents

Posted by ah...@apache.org.
handle subcomponents


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

Branch: refs/heads/dual
Commit: 1de54cf60c37434cb92b84275e5831818824a1cb
Parents: 2bab63d
Author: Alex Harui <ah...@apache.org>
Authored: Thu Mar 30 11:57:38 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Mar 30 11:57:38 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/graph/GoogDepsWriter.java   | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1de54cf6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index c4f841d..48937fd 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -515,7 +515,10 @@ public class GoogDepsWriter {
 	{
 		FileInfo fi = new FileInfo();
 		
+		int numProvides = 0;
+		int constructorCount = 0;
 	    int n = lines.size();
+	    fi.constructorLine = -1;
 	    fi.suppressLine = -1;
 	    fi.fileoverviewLine = -1;
 	    fi.googProvideLine = -1;
@@ -525,7 +528,7 @@ public class GoogDepsWriter {
 	        String line = lines.get(i);
 	        int c2;
 	        int c = line.indexOf("*/");
-	        if (c > -1 && fi.constructorLine > 0)
+	        if (c > -1 && constructorCount > 0 && constructorCount == numProvides)
 	        {
                 return fi;
 	        }
@@ -551,7 +554,12 @@ public class GoogDepsWriter {
                 }
 		        c = line.indexOf("@constructor");
 		        if (c > -1)
-		        	fi.constructorLine = i;
+		        {
+		        	if (fi.constructorLine == -1)
+		        		fi.constructorLine = i;
+		        	constructorCount++;
+		        		
+		        }
 		        else
 		        {
 			        c = line.indexOf("@interface");
@@ -571,7 +579,11 @@ public class GoogDepsWriter {
 				        	{
 					        	c = line.indexOf("goog.provide");
 					        	if (c > -1)
-					        		fi.googProvideLine = i;
+					        	{
+					        		if (fi.googProvideLine == -i)
+					        			fi.googProvideLine = i;
+					        		numProvides++;
+					        	}
 					        	else
 					        	{
 					        		c = line.indexOf("@implements");


[08/50] git commit: [flex-falcon] [refs/heads/dual] - - Added a PackageJSMojo to make the usage of the maven-war-plugin and the build-helper-plugin obsolete.

Posted by ah...@apache.org.
- Added a PackageJSMojo to make the usage of the maven-war-plugin and the build-helper-plugin obsolete.


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

Branch: refs/heads/dual
Commit: aee4ae31ab2d5c2fd31d068e2d0aa624d60901e2
Parents: 4426fbf
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Sat Mar 11 21:56:42 2017 +0100
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Sat Mar 11 21:56:42 2017 +0100

----------------------------------------------------------------------
 .../flex/maven/flexjs/CompileAppMojo.java       |  16 +--
 .../apache/flex/maven/flexjs/PackageJSMojo.java | 116 +++++++++++++++++++
 .../resources/META-INF/plexus/components.xml    |   6 +-
 3 files changed, 123 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/aee4ae31/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
index 258f6cc..5f4b11b 100644
--- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
@@ -17,11 +17,9 @@ package org.apache.flex.maven.flexjs;
 import org.apache.flex.tools.FlexTool;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProjectHelper;
 import org.apache.velocity.VelocityContext;
 
 import java.io.File;
@@ -41,8 +39,8 @@ public class CompileAppMojo
     @Parameter(defaultValue = "${project.artifactId}-${project.version}.swf")
     private String flashOutputFileName;
 
-    @Parameter(defaultValue = "${project.artifactId}-${project.version}.war")
-    private String javascriptOutputFileName;
+    @Parameter(defaultValue = "javascript")
+    private String javascriptOutputDirectoryName;
 
     @Parameter(defaultValue = "namespaces")
     protected String namespaceDirectory;
@@ -60,9 +58,6 @@ public class CompileAppMojo
     @Parameter(defaultValue = "false")
     protected boolean removeCirculars;
 
-    @Component
-    protected MavenProjectHelper mavenProjectHelper;
-
     @Override
     protected String getToolGroupName() {
         if(outputJavaScript) {
@@ -95,7 +90,7 @@ public class CompileAppMojo
     @Override
     protected File getOutput() throws MojoExecutionException {
         if(outputJavaScript) {
-            return new File(outputDirectory, "javascript");
+            return new File(outputDirectory, javascriptOutputDirectoryName);
         }
         return new File(outputDirectory, flashOutputFileName);
     }
@@ -192,10 +187,7 @@ public class CompileAppMojo
     @Override
     protected boolean isForceSwcExternalLibraryPath() {
         // The forceSwcExternalLibraryPath should only apply to Flash compilations.
-        if(outputJavaScript) {
-            return false;
-        }
-        return super.isForceSwcExternalLibraryPath();
+        return !outputJavaScript && super.isForceSwcExternalLibraryPath();
     }
 
     /*private void zipDirectory(File source, File target) {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/aee4ae31/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/PackageJSMojo.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/PackageJSMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/PackageJSMojo.java
new file mode 100644
index 0000000..8a9c2d4
--- /dev/null
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/PackageJSMojo.java
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+package org.apache.flex.maven.flexjs;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * Created by christoferdutz on 11.03.17.
+ */
+@Mojo(name="package-js",defaultPhase = LifecyclePhase.PACKAGE)
+public class PackageJSMojo extends AbstractMojo {
+
+    @Parameter(defaultValue="${project.build.directory}")
+    protected File outputDirectory;
+
+    @Parameter(defaultValue = "javascript")
+    private String javascriptOutputDirectoryName;
+
+    @Parameter(defaultValue = "${project.artifactId}-${project.version}.war")
+    private String warOutputFileName;
+
+    @Parameter
+    protected boolean debug = false;
+
+    @Component
+    protected MavenProject project;
+
+    @Component
+    private MavenProjectHelper projectHelper;
+
+    /**
+     * This mojo should only be executed if a JS output was generated
+     *
+     * @throws MojoExecutionException
+     * @throws MojoFailureException
+     */
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        File warSourceDirectory = new File(outputDirectory, javascriptOutputDirectoryName);
+        warSourceDirectory = new File(new File(warSourceDirectory, "bin"), debug ? "js-debug" : "js-release");
+
+        // If the directory exists, pack everything into one zip file.
+        if(warSourceDirectory.exists()) {
+            File warTargetFile = new File(outputDirectory, warOutputFileName);
+
+            // If the output file already exists, delete it first.
+            if(warTargetFile.exists()) {
+                if(!warTargetFile.delete()) {
+                    throw new MojoExecutionException(
+                            "Could not delete existing war file at " + warSourceDirectory.getPath());
+                }
+            }
+
+            // Create a new zip file with the output of the JS compiler.
+            try {
+                ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(warTargetFile));
+                addDirectoryToZip(warSourceDirectory, warSourceDirectory, zipOutputStream);
+                IOUtils.closeQuietly(zipOutputStream);
+            } catch (IOException e) {
+                throw new MojoExecutionException("Error creating war archive", e);
+            }
+
+            // Attach the war file to the maven project.
+            if(warTargetFile.exists()) {
+                projectHelper.attachArtifact( project, "war", null, warTargetFile);
+            }
+        }
+    }
+
+    private void addDirectoryToZip(File zipRootDirectory, File currentDirectory, ZipOutputStream zipOutputStream)
+            throws IOException {
+        File[] directoryContent = currentDirectory.listFiles();
+        if(directoryContent != null) {
+            for (File file : directoryContent) {
+                if(file.isDirectory()) {
+                    addDirectoryToZip(zipRootDirectory, file, zipOutputStream);
+                } else {
+                    String relativePath = zipRootDirectory.toURI().relativize(currentDirectory.toURI()).getPath();
+                    ZipEntry zipEntry = new ZipEntry(relativePath + "/" + file.getName());
+                    zipOutputStream.putNextEntry(zipEntry);
+                    FileInputStream in = new FileInputStream(file);
+                    IOUtils.copy(in, zipOutputStream);
+                    IOUtils.closeQuietly(in);
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/aee4ae31/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml
----------------------------------------------------------------------
diff --git a/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml
index 78dbe96..441a165 100644
--- a/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml
+++ b/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml
@@ -116,9 +116,9 @@
                             <!--test>
                                 org.apache.maven.plugins:maven-surefire-plugin:test
                             </test-->
-                            <!--package>
-                                org.apache.flex.flexjs.compiler:flexjs-maven-plugin:package
-                            </package-->
+                            <package>
+                                org.apache.flex.flexjs.compiler:flexjs-maven-plugin:package-js
+                            </package>
                             <install>
                                 org.apache.maven.plugins:maven-install-plugin:install
                             </install>


[03/50] git commit: [flex-falcon] [refs/heads/dual] - handle xml.@['someProp']

Posted by ah...@apache.org.
handle xml.@['someProp']


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

Branch: refs/heads/dual
Commit: 6e14d68351e6b530179e5fbaf9a6416775a42bd4
Parents: 85a1701
Author: Alex Harui <ah...@apache.org>
Authored: Wed Mar 8 00:02:21 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Mar 8 00:02:21 2017 -0800

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java        | 18 +++++++++++++++---
 .../codegen/js/jx/DynamicAccessEmitter.java       |  3 +++
 .../codegen/js/jx/MemberAccessEmitter.java        |  5 ++++-
 .../js/flexjs/TestFlexJSGlobalClasses.java        | 10 ++++++++++
 4 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e14d683/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 4bcc3cf..abb9d3b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -1060,9 +1060,21 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         }
         else if (node.getNodeID() == ASTNodeID.Op_AtID)
         {
-        	write("attribute('");
-            getWalker().walk(node.getOperandNode());
-        	write("')");
+        	IASNode op = node.getOperandNode();
+        	if (op != null)
+        	{
+            	write("attribute('");
+        		getWalker().walk(node.getOperandNode());
+            	write("')");
+        	}
+        	else if (node.getParent().getNodeID() == ASTNodeID.ArrayIndexExpressionID)
+        	{
+        		DynamicAccessNode parentNode = (DynamicAccessNode)node.getParent();
+            	write("attribute(");
+        		getWalker().walk(parentNode.getRightOperandNode());        		
+            	write(")");
+        	}
+        		
         	return;
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e14d683/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
index f02d298..39321b7 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
@@ -23,6 +23,7 @@ import org.apache.flex.compiler.codegen.ISubEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 
@@ -39,6 +40,8 @@ public class DynamicAccessEmitter extends JSSubEmitter implements
     {
         IExpressionNode leftOperandNode = node.getLeftOperandNode();
         getWalker().walk(leftOperandNode);
+        if (leftOperandNode.getNodeID() == ASTNodeID.Op_AtID)
+        	return;
 
         startMapping(node, leftOperandNode);
         write(ASEmitterTokens.SQUARE_OPEN);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e14d683/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 2f5f278..6060c5e 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -32,6 +32,7 @@ import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.jx.BinaryOperatorEmitter.DatePropertiesGetters;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
+import org.apache.flex.compiler.internal.tree.as.DynamicAccessNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
 import org.apache.flex.compiler.internal.tree.as.GetterNode;
 import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
@@ -85,7 +86,9 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         		boolean descendant = (node.getOperator() == OperatorType.DESCENDANT_ACCESS);
         		boolean child = (node.getOperator() == OperatorType.MEMBER_ACCESS) && 
         							(!(parentNode instanceof FunctionCallNode)) &&
-        							rightNode.getNodeID() != ASTNodeID.Op_AtID;
+        							rightNode.getNodeID() != ASTNodeID.Op_AtID &&
+        							!((rightNode.getNodeID() == ASTNodeID.ArrayIndexExpressionID) && 
+        									(((DynamicAccessNode)rightNode).getLeftOperandNode().getNodeID() == ASTNodeID.Op_AtID));
         		if (descendant || child)
 	        	{
 	        		writeLeftSide(node, leftNode, rightNode);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e14d683/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index 8eb01bd..74b9d1e 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -625,6 +625,16 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
     }
     
     @Test
+    public void testXMLAttributeBracket()
+    {
+        IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:XMLList = a.@[\"attr1\"];");
+        IASNode parentNode = node.getParent();
+        node = (IVariableNode) parentNode.getChild(1);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {XMLList} */ b = a.attribute(\"attr1\")");
+    }
+    
+    @Test
     public void testXMLAttributeToString()
     {
         IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:String = a.@attr1;");


[38/50] git commit: [flex-falcon] [refs/heads/dual] - add one more JS identifier to the list

Posted by ah...@apache.org.
add one more JS identifier to the list


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

Branch: refs/heads/dual
Commit: f11724087c9e565d7ca1dbf135c808321d89bae3
Parents: 7676cf9
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 28 21:05:10 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 28 21:05:10 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/flex/compiler/utils/NativeUtils.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f1172408/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
index 4582a54..4969a3d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
@@ -88,6 +88,7 @@ public class NativeUtils
     {
         // (erikdebruin) Ref.: https://cwiki.apache.org/confluence/display/FLEX/Full+Table
         
+        NaN("NaN"),
         Event("Event"),
         Array("Array"),
         Float32Array("Float32Array"),


[50/50] git commit: [flex-falcon] [refs/heads/dual] - Merge branch 'develop' into dual

Posted by ah...@apache.org.
Merge branch 'develop' into dual

Conflicts:
	compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
	compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
	flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
	flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java


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

Branch: refs/heads/dual
Commit: f39e0fbc379228bd29c1027f86631d056bf3e362
Parents: f1860c1 9f793c6
Author: Alex Harui <ah...@apache.org>
Authored: Thu Apr 13 10:43:29 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Apr 13 10:43:29 2017 -0700

----------------------------------------------------------------------
 RELEASE_NOTES_JX                                |  13 +-
 compiler-jx/pom.xml                             |   2 +
 .../flex/compiler/codegen/INestingEmitter.java  |  26 +
 .../flex/compiler/codegen/as/IASEmitter.java    |   3 +-
 .../flex/compiler/codegen/js/IJSEmitter.java    |  38 +-
 .../compiler/codegen/js/IMappingEmitter.java    |  66 +++
 .../flex/compiler/driver/js/IJSBackend.java     |   4 +-
 .../flex/compiler/internal/codegen/Emitter.java |  28 ++
 .../compiler/internal/codegen/as/ASEmitter.java |  31 +-
 .../compiler/internal/codegen/js/JSEmitter.java |  16 +
 .../internal/codegen/js/JSSessionModel.java     |   2 +
 .../internal/codegen/js/JSSourceMapEmitter.java |  10 +-
 .../compiler/internal/codegen/js/JSWriter.java  |   7 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  57 ++-
 .../internal/codegen/js/goog/JSGoogEmitter.java |   3 +-
 .../codegen/js/goog/JSGoogEmitterTokens.java    |   2 +
 .../codegen/js/jx/DynamicAccessEmitter.java     |   3 +
 .../internal/codegen/js/jx/FieldEmitter.java    |  25 +
 .../internal/codegen/js/jx/LiteralEmitter.java  |  12 +-
 .../codegen/js/jx/MemberAccessEmitter.java      |  21 +-
 .../codegen/js/jx/PackageFooterEmitter.java     |  39 +-
 .../internal/codegen/js/utils/EmitterUtils.java |  29 ++
 .../internal/codegen/mxml/MXMLWriter.java       |  25 +-
 .../codegen/mxml/flexjs/MXMLEventSpecifier.java |   3 +
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 473 +++++++++++++------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 168 +++++--
 .../compiler/internal/driver/js/JSBackend.java  |   3 +-
 .../compiler/internal/graph/GoogDepsWriter.java | 420 ++++++++++++----
 .../internal/projects/FlexJSProject.java        |   4 +-
 .../utils/JSClosureCompilerWrapper.java         |  12 +-
 .../apache/flex/compiler/utils/NativeUtils.java |  13 +
 compiler-jx/src/test/build.xml                  |   2 +
 .../js/flexjs/TestFlexJSExpressions.java        |  45 ++
 .../js/flexjs/TestFlexJSGlobalClasses.java      |  51 ++
 .../js/flexjs/TestFlexJSGlobalFunctions.java    |   2 +-
 .../codegen/js/flexjs/TestFlexJSPackage.java    |   4 +-
 .../codegen/js/flexjs/TestFlexJSProject.java    |  17 +
 .../codegen/js/goog/TestGoogProject.java        |  35 ++
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  |  47 +-
 .../mxml/flexjs/TestFlexJSMXMLScript.java       | 107 +++++
 .../sourcemaps/TestSourceMapMXMLEvents.java     |  44 ++
 .../sourcemaps/TestSourceMapMXMLScript.java     |  77 +++
 .../internal/test/FlexJSSourceMapTestBase.java  |  64 +++
 .../compiler/internal/test/FlexJSTestBase.java  |  33 ++
 .../internal/test/SourceMapTestBase.java        |   5 +-
 .../flex/compiler/internal/test/TestBase.java   |  51 ++
 .../org/apache/flex/utils/EnvProperties.java    |   1 -
 .../flexjs/projects/circular_proto/A.as         |  35 ++
 .../flexjs/projects/circular_proto/A_result.js  |  74 +++
 .../flexjs/projects/circular_proto/B.as         |  39 ++
 .../flexjs/projects/circular_proto/B_result.js  |  78 +++
 .../flexjs/projects/circular_proto/C.as         |  38 ++
 .../flexjs/projects/circular_proto/C_result.js  |  80 ++++
 .../flexjs/projects/circular_proto/D.as         |  37 ++
 .../flexjs/projects/circular_proto/D_result.js  |  80 ++++
 .../flexjs/projects/circular_proto/E.as         |  38 ++
 .../flexjs/projects/circular_proto/E_result.js  |  76 +++
 .../flexjs/projects/circular_proto/F.as         |  36 ++
 .../flexjs/projects/circular_proto/F_result.js  |  80 ++++
 .../projects/circular_proto/index_result.html   |  42 ++
 .../projects/xml_requires/XMLRequire_result.js  |   2 -
 .../flex/compiler/config/Configuration.java     |  20 +
 .../compiler/internal/embedding/EmbedData.java  |  63 ++-
 .../embedding/transcoders/DataTranscoder.java   |   4 +-
 .../projects/FlexProjectConfigurator.java       |   4 +-
 .../semantics/MethodBodySemanticChecker.java    |   7 +
 .../tree/mxml/MXMLPropertySpecifierNode.java    |  47 +-
 ...XMLBadChildTagPropertyAssignmentProblem.java |  47 ++
 .../MXMLMultipleInitializersProblem.java        |  46 ++
 .../src/test/java/as/ASInheritanceTests.java    |  59 +++
 .../flexjs/extension/FlexJsLanguageSupport.java |  14 +
 .../flexjs/extension/FlexJsScopeDeriver.java    |  14 +
 .../flexjs/extension/FlexJsScopeSelector.java   |  14 +
 .../flex/maven/flexjs/CompileAppMojo.java       |  15 +-
 .../apache/flex/maven/flexjs/CompileJSMojo.java |  40 +-
 .../apache/flex/maven/flexjs/PackageJSMojo.java | 116 +++++
 .../resources/META-INF/plexus/components.xml    |   6 +-
 pom.xml                                         |  35 +-
 78 files changed, 3026 insertions(+), 403 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
index 1b526b8,ee2c3f3..a481a6e
--- a/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
+++ b/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
@@@ -70,12 -75,7 +70,11 @@@ public class EnvProperties 
       */
      public String GOOG;
  
 +    /**
 +     * PLAYERGLOBAL_VERSION
 +     */
 +    public String FPVER;
  
- 
      private static EnvProperties env;
  
      public static EnvProperties initiate() {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
----------------------------------------------------------------------
diff --cc flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
index b2686d1,5f4b11b..46f6b33
--- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileAppMojo.java
@@@ -59,12 -58,12 +57,9 @@@ public class CompileAppMoj
      @Parameter(defaultValue = "false")
      protected boolean removeCirculars;
  
-     @Component
-     protected MavenProjectHelper mavenProjectHelper;
- 
      @Override
      protected String getToolGroupName() {
 -        if(outputJavaScript) {
 -            return "FlexJS";
 -        }
 -        return "Falcon";
 +        return "FlexJS";
      }
  
      @Override
@@@ -87,6 -89,9 +82,12 @@@
  
      @Override
      protected File getOutput() throws MojoExecutionException {
++<<<<<<< HEAD
++=======
+         if(outputJavaScript) {
+             return new File(outputDirectory, javascriptOutputDirectoryName);
+         }
++>>>>>>> develop
          return new File(outputDirectory, flashOutputFileName);
      }
  

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f39e0fbc/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java
----------------------------------------------------------------------
diff --cc flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java
index de53957,2347f4a..98bbe75
--- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java
+++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java
@@@ -21,12 -20,12 +21,14 @@@ import org.apache.maven.plugins.annotat
  import org.apache.maven.plugins.annotations.LifecyclePhase;
  import org.apache.maven.plugins.annotations.Mojo;
  import org.apache.maven.plugins.annotations.Parameter;
 +import org.apache.maven.project.MavenProjectHelper;
 +
  
- import java.io.File;
+ import java.io.*;
  import java.util.LinkedList;
  import java.util.List;
+ import java.util.zip.ZipEntry;
+ import java.util.zip.ZipOutputStream;
  
  /**
   * goal which compiles a project into a flexjs swc library.
@@@ -119,16 -121,43 +121,52 @@@ public class CompileJSMoj
  
      @Override
      protected boolean includeLibrary(Artifact library) {
 -        return "typedefs".equalsIgnoreCase(library.getClassifier());
 +        return "typedefs".equalsIgnoreCase(library.getClassifier()) ||
 +                "js".equalsIgnoreCase(library.getClassifier());
 +    }
 +
 +    /* return false since we will already list the libraries we want on the
 +       regular library-path and external-library-path
 +     */
 +    @Override
 +    protected boolean includeLibraryJS(Artifact library) {
 +        return false;
      }
  
+     private void createEmptySwc(File outputFile) throws MojoExecutionException {
+         if(!outputFile.getParentFile().exists()) {
+             if(!outputFile.getParentFile().mkdirs()) {
+                 throw new MojoExecutionException("Could not create directory " + outputFile.getParent());
+             }
+         }
+ 
+         // Create a dummy swc (A zip file which contains a minimal catalog.xml) */
+         try {
+             OutputStream stream = new FileOutputStream(outputFile);
+             stream = new BufferedOutputStream(stream);
+             ZipOutputStream zipStream = new ZipOutputStream(stream);
+             ZipEntry entry = new ZipEntry("catalog.xml");
+             zipStream.putNextEntry(entry);
+             byte[] dummyCatalog = (
+                     "<?xml version=\"1.0\" ?>\n" +
+                     "<swc xmlns=\"http://www.adobe.com/flash/swccatalog/9\">\n" +
+                     "    <versions>\n" +
+                     "        <swc version=\"1.2\"/>\n" +
+                     "        <compiler name=\"Apache Flex - FlexJS: Compiler: Compiler\" version=\"0.8\" build=\"0-SNAPSHOT\"/>\n" +
+                     "    </versions>\n" +
+                     "    <features>\n" +
+                     "    </features>\n" +
+                     "    <libraries>\n" +
+                     "    </libraries>\n" +
+                     "</swc>").getBytes();
+             zipStream.write(dummyCatalog);
+             zipStream.closeEntry();
+             zipStream.close();
+         } catch (FileNotFoundException e) {
+             throw new MojoExecutionException("Could not create empty zip file at " + outputFile.getPath());
+         } catch (IOException e) {
+             throw new MojoExecutionException("Could not create empty zip file at " + outputFile.getPath());
+         }
+     }
+ 
  }


[06/50] git commit: [flex-falcon] [refs/heads/dual] - - Adjusted the EmbedData class to embed resources from all source-paths specified.

Posted by ah...@apache.org.
- Adjusted the EmbedData class to embed resources from all source-paths specified.


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

Branch: refs/heads/dual
Commit: 4426fbf2db8248f3f168e84d47947c63a38555ec
Parents: 628d3ca
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Fri Mar 10 09:41:27 2017 +0100
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Fri Mar 10 09:41:27 2017 +0100

----------------------------------------------------------------------
 .../compiler/internal/embedding/EmbedData.java  | 63 +++++++++++++++++++-
 1 file changed, 60 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4426fbf2/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
index 4835e24..af9e870 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
@@ -46,6 +46,7 @@ import org.apache.flex.compiler.internal.embedding.transcoders.TranscoderBase;
 import org.apache.flex.compiler.internal.embedding.transcoders.XMLTranscoder;
 import org.apache.flex.compiler.internal.projects.CompilerProject;
 import org.apache.flex.compiler.internal.projects.ASProject;
+import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.projects.SourcePathManager;
 import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
@@ -589,7 +590,7 @@ public class EmbedData
 
         Map<String,String> searchedLocations = new LinkedHashMap<String,String>();
         String containingSourcePath = new File(containingSourceFilename).getParent();
-        String sourceFile = getResolvedSourcePath(project, containingSourcePath, 
+        String sourceFile = getResolvedSourcePath(project, containingSourcePath,
                 sourceValue, searchedLocations);
         if (sourceFile == null)
         {
@@ -621,7 +622,7 @@ public class EmbedData
         String sourceFile = null;
         if (new File(filename).isAbsolute())
         {
-            searchedLocations.put(FilenameNormalization.normalize(filename), "QuotedPath"); 
+            searchedLocations.put(FilenameNormalization.normalize(filename), "QuotedPath");
             sourceFile = SourcePathManager.getSourceFileInPath(null, filename);
             if (sourceFile != null)
                 return sourceFile;
@@ -641,7 +642,21 @@ public class EmbedData
 
         if (project instanceof ASProject)
         {
-            sourceFile = getResolvedSourcePath((ASProject)project, filename, 
+            sourceFile = getResolvedSourcePath((ASProject)project, filename,
+                    searchedLocations);
+        }
+        if (project instanceof FlexProject)
+        {
+            FlexProject flexProject = (FlexProject) project;
+            String packagePath = null;
+            if((containingSourcePath != null) && !flexProject.getSourcePath().isEmpty()) {
+                for (File sourcePath : flexProject.getSourcePath()) {
+                    if (containingSourcePath.startsWith(sourcePath.getAbsolutePath())) {
+                        packagePath = containingSourcePath.substring(sourcePath.getAbsolutePath().length() + 1);
+                    }
+                }
+            }
+            sourceFile = getResolvedSourcePath((FlexProject)project, filename, packagePath,
                     searchedLocations);
         }
 
@@ -678,4 +693,46 @@ public class EmbedData
 
         return sourceFile;
     }
+
+    private String getResolvedSourcePath(FlexProject project, String filename, String packagePath,
+                                         Map<String,String> searchedLocations)
+    {
+        // Only files that start with a leading "/" are resolved using the
+        // source path.
+        String sourceFile = null;
+        boolean isAbsolute = filename.startsWith("/");
+        if (isAbsolute)
+        {
+            searchedLocations.put(filename.substring(1), "EmbedOnSourcePath");
+            sourceFile = project.getSourceFileFromSourcePath(filename.substring(1));
+        }
+
+        if (sourceFile != null)
+            return sourceFile;
+
+        // Not in the source path, so finally look for the file within the libraries.
+        // Absolute files are not looked up using the library path.
+        if (!isAbsolute)
+        {
+            for(File sourceDirectory : project.getSourcePath()) {
+                File potentialFile = sourceDirectory;
+                if(packagePath != null) {
+                    potentialFile = new File(potentialFile, packagePath);
+                }
+                searchedLocations.put(filename, potentialFile.getAbsolutePath());
+                potentialFile = new File(potentialFile, filename);
+                if(potentialFile.exists()) {
+                    return potentialFile.getAbsolutePath();
+                }
+            }
+            searchedLocations.put(filename, "EmbedOnLibraryPath");
+            swcSource = project.getSourceFileFromLibraryPath(filename);
+            if (swcSource != null)
+            {
+                sourceFile = swcSource.getPath();
+            }
+        }
+
+        return sourceFile;
+    }
 }


[48/50] git commit: [flex-falcon] [refs/heads/dual] - emit goog.addDependency for rest of deps

Posted by ah...@apache.org.
emit goog.addDependency for rest of deps


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

Branch: refs/heads/dual
Commit: d87235f757c92b2b5480b0cad4e2b1c783e8cdc9
Parents: eb2f34d
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 4 23:49:24 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Apr 4 23:49:24 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d87235f7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 6065efc..5c122d4 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -182,6 +182,14 @@ public class GoogDepsWriter {
 			mainDeps.append(getDependencies(restOfDeps)).append("]);\n");
 			sb.insert(0, mainDeps);
 			sb.insert(0, "// generated by FalconJX\n");
+			for (String dep : restOfDeps)
+			{
+				GoogDep gd = depMap.get(dep);
+				sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', ['")
+				.append(gd.className).append("'], [")
+				.append((gd.fileInfo.impls != null) ? getDependencies(gd.fileInfo.impls) : "")
+				.append("]);\n");
+			}
 			addRestOfDeps(mainDep, restOfDeps);
 		}
 		return sb.toString();


[11/50] git commit: [flex-falcon] [refs/heads/dual] - fix more complex dependency scenarios. Hope this doesn't slow down big project compiles too much.

Posted by ah...@apache.org.
fix more complex dependency scenarios.  Hope this doesn't slow down big project compiles too much.


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

Branch: refs/heads/dual
Commit: 200c568c9034045b5392d7049ad07a47bc094085
Parents: 0271ed0
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 14 12:39:15 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 14 12:39:15 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/graph/GoogDepsWriter.java | 62 ++++++++++++++++++--
 1 file changed, 58 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/200c568c/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 9b843b3..5833696 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -130,6 +130,7 @@ public class GoogDepsWriter {
     public ArrayList<String> additionalHTML = new ArrayList<String>();
     
     private HashMap<String, GoogDep> visited = new HashMap<String, GoogDep>();
+    private HashMap<String, GoogDep> inArray = new HashMap<String, GoogDep>();
     
 	private ArrayList<GoogDep> sort(String rootClassName)
 	{
@@ -148,16 +149,46 @@ public class GoogDepsWriter {
 			removeCirculars(current);
         System.out.println("Dependencies calculated for '" + current.filePath + "'");
 
+		ArrayList<GoogDep> visitedButNotAdded = new ArrayList<GoogDep>();
 		ArrayList<String> deps = current.deps;
 		for (String className : deps)
 		{
-			if (!visited.containsKey(className) && !isGoogClass(className))
+			if (!isGoogClass(className))
 			{
-				GoogDep gd = depMap.get(className);
-				sortFunction(gd, arr);
+				if (!visited.containsKey(className))
+				{
+					GoogDep gd = depMap.get(className);
+					sortFunction(gd, arr);
+				}
+				else
+				{
+			        if (!inArray.containsKey(className))
+			        {
+			        	// if we get here, we haven't yet added the dependency to the
+			        	// array of GoogDeps because we are computing its dependencies.
+			        	// For example, class A extends B which references class C which
+			        	// extends B.  This isn't a circular reference.  But B needs to
+			        	// be in the array before C instead of just before A.
+			        	visitedButNotAdded.add(depMap.get(className));
+				        System.out.println("Visited but haven't added: '" + className + "'");
+			        }
+				}
 			}
 		}
-		arr.add(current);
+		for (GoogDep gdep : visitedButNotAdded)
+		{
+			if (!inArray.containsKey(gdep.className))
+			{
+				arr.add(gdep);
+				inArray.put(gdep.className, gdep);
+			}
+		}
+		if (!inArray.containsKey(current.className))
+		{
+			arr.add(current);
+			inArray.put(current.className, current);
+		}
+		
 	}
 	
 	private void addDeps(String className)
@@ -248,6 +279,13 @@ public class GoogDepsWriter {
 	                        	System.out.println(gd.filePath + " removing circular: " + s);
 	                        	continue;
 	                        }
+	                        else if (gd.deps.contains(s) && !isGoogClass(s) && onProtoChain(s, className))
+	                        {
+	                        	// if we are on the proto chain of s, then take away our require of s
+	                        	suppressCount++;
+	                        	System.out.println(gd.filePath + " removing circular (proto): " + s);
+	                        	continue;
+	                        }
                         }
                     }
             	}
@@ -331,6 +369,22 @@ public class GoogDepsWriter {
         }		
 	}
 	
+	boolean onProtoChain(String name, String base)
+	{
+		GoogDep gd = depMap.get(name);
+		if (gd.fileInfo.impls != null)
+		{
+			if (gd.fileInfo.impls.contains(base))
+				return true;
+			for (String s : gd.fileInfo.impls)
+			{
+				if (!isGoogClass(s) && onProtoChain(s, base))
+					return true;
+			}
+		}
+		return false;
+	}
+	
 	FileInfo getFileInfo(List<String> lines, String className)
 	{
 		FileInfo fi = new FileInfo();


[02/50] git commit: [flex-falcon] [refs/heads/dual] - handle a few more cases with super

Posted by ah...@apache.org.
handle a few more cases with super


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

Branch: refs/heads/dual
Commit: 85a170101d19dcfe51a177fdb21e34bc9bc43c94
Parents: fde0386
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 7 22:34:21 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 7 22:34:21 2017 -0800

----------------------------------------------------------------------
 .../internal/codegen/js/goog/JSGoogEmitter.java |  3 +-
 .../codegen/js/jx/MemberAccessEmitter.java      | 16 ++++++-
 .../js/flexjs/TestFlexJSExpressions.java        | 45 ++++++++++++++++++++
 3 files changed, 62 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 8486ab0..98a4015 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -909,7 +909,8 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
             if (definition instanceof FunctionDefinition &&
                     !((FunctionDefinition)definition).isStatic() &&
                     (!(definition instanceof AccessorDefinition)) &&
-                    node instanceof MemberAccessExpressionNode)
+                    node instanceof MemberAccessExpressionNode &&
+                    ((MemberAccessExpressionNode)node).getLeftOperandNode().getNodeID() != ASTNodeID.SuperID)
             {
                 emitClosureStart();
                 getWalker().walk(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 0c37490..2f5f278 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -269,7 +269,10 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         {
         	write(ASEmitterTokens.COMMA);
         	write(ASEmitterTokens.SPACE);
-        	writeLeftSide(node, leftNode, rightNode);
+        	if (leftNode.getNodeID() == ASTNodeID.SuperID)
+        		write(ASEmitterTokens.THIS);
+        	else
+        		writeLeftSide(node, leftNode, rightNode);
         	getEmitter().emitClosureEnd(node, def);
         }
         
@@ -311,6 +314,17 @@ public class MemberAccessEmitter extends JSSubEmitter implements
                 write(ASEmitterTokens.PAREN_CLOSE);
                 return false;
             }
+            else if (leftNode.getNodeID() == ASTNodeID.SuperID
+                    && (rightDef != null && rightDef instanceof FunctionDefinition))
+            {
+                write(getEmitter().formatQualifiedName(
+                        getEmitter().getModel().getCurrentClass().getQualifiedName()));
+                write(ASEmitterTokens.MEMBER_ACCESS);
+                write(JSGoogEmitterTokens.SUPERCLASS);
+                write(ASEmitterTokens.MEMBER_ACCESS);
+                write(rightDef.getBaseName());
+                return false;
+            }
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/85a17010/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 3331fc6..17c9940 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -102,6 +102,51 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         assertOut("/**\n */\nFalconTest_A.prototype[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo\"] = function() {\n  if (a)\n    FalconTest_A.superClass_['http://www.adobe.com/2006/actionscript/flash/proxy::setProperty'].apply(this, [ a, b] );\n}");
     }
 
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMethodAsFunctionReference()
+    {
+        IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {var f:Function = super.foo;} } }\n" +
+        		"class Base { public function foo(){} }", IFileNode.class, 0, false);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IClassDefinition def = classnode.getDefinition();
+        ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+        asBlockWalker.visitFunction(fnode);
+        assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n  var /** @type {Function} */ f = org.apache.flex.utils.Language.closure(FalconTest_A.superClass_.foo, this, 'foo');\n}");
+    }
+    
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMethodAsVarFunctionReference()
+    {
+    	IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {var f:Function; f = super.foo;} } }\n" +
+        		"class Base { public function foo(){} }", IFileNode.class, 0, false);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IClassDefinition def = classnode.getDefinition();
+        ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+        asBlockWalker.visitFunction(fnode);
+        assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n  var /** @type {Function} */ f;\n  f = org.apache.flex.utils.Language.closure(FalconTest_A.superClass_.foo, this, 'foo');\n}");
+    }
+    
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMethodInApply()
+    {
+    	IFileNode node = (IFileNode)getNode("package { public class FalconTest_A extends Base { override public function foo() {super.foo.apply(this, [a, b, c]);} } }\n" +
+        		"class Base { public function foo(){} }", IFileNode.class, 0, false);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IClassDefinition def = classnode.getDefinition();
+        ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
+        asBlockWalker.visitFunction(fnode);
+        assertOut("/**\n * @export\n * @override\n */\nFalconTest_A.prototype.foo = function() {\n  FalconTest_A.superClass_.foo.apply(this, [a, b, c]);\n}");
+    }
+    
     //----------------------------------
     // Primary expression keywords
     //----------------------------------


[13/50] git commit: [flex-falcon] [refs/heads/dual] - add test for this circular scenario

Posted by ah...@apache.org.
add test for this circular scenario


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

Branch: refs/heads/dual
Commit: 51ddb8580e867c2d2a21d7aebe386a279e72c6f4
Parents: 65ef0d9
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 14 23:29:57 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 14 23:29:57 2017 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSProject.java    | 17 +++++
 .../codegen/js/goog/TestGoogProject.java        | 35 +++++++++
 .../flex/compiler/internal/test/TestBase.java   | 49 ++++++++++++
 .../org/apache/flex/utils/EnvProperties.java    |  8 ++
 .../flexjs/projects/circular_proto/A.as         | 35 +++++++++
 .../flexjs/projects/circular_proto/A_result.js  | 74 ++++++++++++++++++
 .../flexjs/projects/circular_proto/B.as         | 39 ++++++++++
 .../flexjs/projects/circular_proto/B_result.js  | 78 +++++++++++++++++++
 .../flexjs/projects/circular_proto/C.as         | 38 ++++++++++
 .../flexjs/projects/circular_proto/C_result.js  | 80 ++++++++++++++++++++
 .../flexjs/projects/circular_proto/D.as         | 37 +++++++++
 .../flexjs/projects/circular_proto/D_result.js  | 80 ++++++++++++++++++++
 .../flexjs/projects/circular_proto/E.as         | 38 ++++++++++
 .../flexjs/projects/circular_proto/E_result.js  | 76 +++++++++++++++++++
 .../flexjs/projects/circular_proto/F.as         | 36 +++++++++
 .../flexjs/projects/circular_proto/F_result.js  | 80 ++++++++++++++++++++
 .../projects/circular_proto/index_result.html   | 42 ++++++++++
 17 files changed, 842 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
index dbdb67c..fa184b9 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
@@ -131,6 +131,23 @@ public class TestFlexJSProject extends TestGoogProject
     }
 
     @Test
+    public void test_IsItCircularProto()
+    {
+        String testDirPath = projectDirPath + "/circular_proto";
+
+        String fileName = "A.as";
+
+        sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(),
+                projectDirPath + "/circular_proto").getPath();
+
+        int exitCode = compileAndPublishProject(testDirPath, "circular_proto", fileName);
+        
+        assertThat(exitCode, is(0));
+
+        assertPublishedProjectOut(testDirPath, "circular_proto");
+    }
+    
+    @Test
     public void test_XMLRequires()
     {
         String testDirPath = projectDirPath + "/xml_requires";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
index f9be0d7..6d70fa0 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogProject.java
@@ -19,6 +19,10 @@
 
 package org.apache.flex.compiler.internal.codegen.js.goog;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.FileFileFilter;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
 import org.apache.flex.compiler.internal.test.ASTestBase;
@@ -26,6 +30,7 @@ import org.apache.flex.utils.TestAdapterFactory;
 import org.junit.Test;
 
 import java.io.File;
+import java.util.Collection;
 import java.util.List;
 
 import static org.hamcrest.core.Is.is;
@@ -98,4 +103,34 @@ public class TestGoogProject extends ASTestBase
         }
     }
 
+    protected void assertPublishedProjectOut(String projectFolderPath,
+            String projectName)
+    {
+    	String outputFolderName = tempDir + "/" + projectName + "/bin/js-debug";
+        IOFileFilter jsFilter = FileFilterUtils.and(FileFileFilter.FILE,
+                FileFilterUtils.suffixFileFilter("js"));
+        IOFileFilter htmlFilter = FileFilterUtils.and(FileFileFilter.FILE,
+                FileFilterUtils.suffixFileFilter("html"));
+        IOFileFilter resultsFilter = FileFilterUtils.or(jsFilter, htmlFilter);
+        File outputFolder = new File(outputFolderName);
+        File projectFolder = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), projectFolderPath);
+        projectFolderPath = projectFolder.getAbsolutePath();
+        Collection<File> files = FileUtils.listFiles(projectFolder, resultsFilter, null);
+        for (File resultFile : files)
+        {
+            String compiledFilePath = resultFile.getAbsolutePath();
+            if (compiledFilePath.startsWith(projectFolderPath))
+            	compiledFilePath = compiledFilePath.substring(projectFolderPath.length());
+            compiledFilePath = compiledFilePath.replace("_result", "");
+            File compiledFile = new File(outputFolder, compiledFilePath);
+            String compiledResult = readCodeFile(compiledFile);
+
+            String expectedResult = readCodeFile(resultFile);
+            /*if (!compiledResult.equals(expectedResult)) {
+                System.out.println("expected\n"+expectedResult);
+                System.out.println("got\n"+compiledResult);
+            }*/
+            assertThat(compiledResult, is(expectedResult));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
index ab18cbd..fce0907 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/TestBase.java
@@ -27,6 +27,7 @@ import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
@@ -37,6 +38,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.FileFileFilter;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.flex.compiler.clients.MXMLJSC;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
 import org.apache.flex.compiler.config.Configurator;
@@ -743,6 +749,20 @@ public class TestBase implements ITestBase
                     }
                 }
             }
+            else if (line.contains("<!--") && isResult)
+            {
+                // eat opening comment which should be apache header
+                while (line != null)
+                {
+                    line = in.readLine();
+                    if (line.contains("-->"))
+                    {
+                        line = in.readLine();
+                        break;
+                    }
+                }            	
+            }
+
             while (line != null)
             {
                 code += line + "\n";
@@ -783,4 +803,33 @@ public class TestBase implements ITestBase
         return null;
     }
 
+    protected int compileAndPublishProject(String projectFolderPath,
+            String projectName, String mainFileName)
+    {
+    	String sourceFolderName = tempDir + "/" + projectName + "/src";
+        IOFileFilter asFilter = FileFilterUtils.and(FileFileFilter.FILE,
+                FileFilterUtils.suffixFileFilter(".as"));
+        File sourceFolder = new File(sourceFolderName);
+        File projectFolder = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), projectFolderPath);
+        try {
+			FileUtils.copyDirectory(projectFolder, sourceFolder, asFilter);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		int numArgs = 3;
+		if (env.GOOG != null) numArgs++;
+		String[] args = new String[numArgs];
+		File mainFile = new File(sourceFolder, mainFileName);
+		//args[0] = "-compiler.targets=JS";
+		int index = 0;
+		args[index++] = "-external-library-path=" + env.ASJS + "/js/libs/js.swc";
+		args[index++] = "-remove-circulars";
+		if (env.GOOG != null)
+			args[index++] = "-closure-lib=" + env.GOOG;
+		args[index++] = mainFile.getAbsolutePath();
+		int exitCode = MXMLJSC.staticMainNoExit(args);
+		return exitCode;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java b/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
index ea75057..ee2c3f3 100644
--- a/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
+++ b/compiler-jx/src/test/java/org/apache/flex/utils/EnvProperties.java
@@ -70,6 +70,11 @@ public class EnvProperties {
      */
     public String FPVER;
 
+    /**
+     * GOOG_HOME
+     */
+    public String GOOG;
+
 
     private static EnvProperties env;
 
@@ -144,6 +149,9 @@ public class EnvProperties {
         if (ASJS == null)
             ASJS = FilenameNormalization.normalize("../../../../flex-asjs");
         System.out.println("environment property - ASJS_HOME = " + ASJS);
+        
+        GOOG = p.getProperty(prefix + "GOOG_HOME", System.getenv("GOOG_HOME"));
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A.as
new file mode 100644
index 0000000..09c4156
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+	 */
+	public class A
+	{
+		public function A()
+		{
+		}
+		
+		private function test():void {
+			var bar:int = E.a(false);
+		}
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A_result.js
new file mode 100644
index 0000000..8fd88dd
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/A_result.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from A.as
+ * A
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes|accessControls}
+ */
+
+goog.provide('A');
+
+goog.require('E');
+
+
+
+/**
+ * @constructor
+ */
+A = function() {
+};
+
+
+/**
+ * @private
+ */
+A.prototype.test = function() {
+  var /** @type {number} */ bar = E.a(false);
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+A.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'A', qName: 'A', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('A', A);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+A.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'A': { type: '', declaredBy: 'A'}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B.as
new file mode 100644
index 0000000..fac9035
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+	 * FlowComposerBase
+	 */
+	public class B
+	{
+		
+		public function B()
+		{
+			
+		}
+		
+		public static function a(b:Boolean):int{
+			if (b)
+			   return E.a(false);
+			return 0;
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B_result.js
new file mode 100644
index 0000000..ff881d1
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/B_result.js
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from B.as
+ * B
+ *
+ * @fileoverview
+ *
+ * @suppress {missingRequire|checkTypes|accessControls}
+ */
+
+goog.provide('B');
+
+
+
+
+/**
+ * @constructor
+ */
+B = function() {
+};
+
+
+/**
+ * @export
+ * @param {boolean} b
+ * @return {number}
+ */
+B.a = function(b) {
+  if (b)
+    return E.a(false);
+  return 0;
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+B.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'B', qName: 'B', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('B', B);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+B.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'B': { type: '', declaredBy: 'B'},
+        '|a': { type: 'int', declaredBy: 'B', parameters: function () { return [  { index: 1, type: 'Boolean', optional: false } ]; }}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C.as
new file mode 100644
index 0000000..f75cc04
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+		StandardFlowComposer extends FlowComposerBase
+	 */
+	public class C extends B
+	{
+		
+		public function C()
+		{
+			
+		}
+		
+		public static function a(b:Boolean):int{
+			// FactoryComposer
+			return F.a(false);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C_result.js
new file mode 100644
index 0000000..9dece88
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/C_result.js
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from C.as
+ * C
+ *
+ * @fileoverview
+ *
+ * @suppress {missingRequire|checkTypes|accessControls}
+ */
+
+goog.provide('C');
+
+goog.require('B');
+
+
+
+/**
+ * @constructor
+ * @extends {B}
+ */
+C = function() {
+  C.base(this, 'constructor');
+};
+goog.inherits(C, B);
+
+
+/**
+ * @export
+ * @param {boolean} b
+ * @return {number}
+ */
+C.a = function(b) {
+  return F.a(false);
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+C.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'C', qName: 'C', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('C', C);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+C.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'C': { type: '', declaredBy: 'C'},
+        '|a': { type: 'int', declaredBy: 'C', parameters: function () { return [  { index: 1, type: 'Boolean', optional: false } ]; }}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D.as
new file mode 100644
index 0000000..fd2f01e
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+	 * FactoryComposer extends StandardFlowComposer
+	 */
+	public class D extends C
+	{
+		
+		public function D()
+		{
+			
+		}
+		
+		public static function a(b:Boolean):int {
+			return 0;
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D_result.js
new file mode 100644
index 0000000..3dcbe6f
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/D_result.js
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from D.as
+ * D
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes|accessControls}
+ */
+
+goog.provide('D');
+
+goog.require('C');
+
+
+
+/**
+ * @constructor
+ * @extends {C}
+ */
+D = function() {
+  D.base(this, 'constructor');
+};
+goog.inherits(D, C);
+
+
+/**
+ * @export
+ * @param {boolean} b
+ * @return {number}
+ */
+D.a = function(b) {
+  return 0;
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+D.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'D', qName: 'D', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('D', D);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+D.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'D': { type: '', declaredBy: 'D'},
+        '|a': { type: 'int', declaredBy: 'D', parameters: function () { return [  { index: 1, type: 'Boolean', optional: false } ]; }}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E.as
new file mode 100644
index 0000000..dfae20b
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+	 * Configuration
+	 */
+	public class E
+	{
+		
+		public function E()
+		{
+			
+		}
+		
+		public static function a(b:Boolean):int {
+			// StandardFlowComposer
+			return C.a(false);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E_result.js
new file mode 100644
index 0000000..ccf81c0
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/E_result.js
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from E.as
+ * E
+ *
+ * @fileoverview
+ *
+ * @suppress {missingRequire|checkTypes|accessControls}
+ */
+
+goog.provide('E');
+
+
+
+
+/**
+ * @constructor
+ */
+E = function() {
+};
+
+
+/**
+ * @export
+ * @param {boolean} b
+ * @return {number}
+ */
+E.a = function(b) {
+  return C.a(false);
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+E.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'E', qName: 'E', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('E', E);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+E.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'E': { type: '', declaredBy: 'E'},
+        '|a': { type: 'int', declaredBy: 'E', parameters: function () { return [  { index: 1, type: 'Boolean', optional: false } ]; }}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F.as
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F.as b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F.as
new file mode 100644
index 0000000..350cf84
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	/**
+	 */
+	public class F extends D
+	{
+		
+		public function F()
+		{
+			
+		}
+		
+		public static function a(b:Boolean):int {
+			return D.a(false);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F_result.js b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F_result.js
new file mode 100644
index 0000000..96d9530
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/F_result.js
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from F.as
+ * F
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes|accessControls}
+ */
+
+goog.provide('F');
+
+goog.require('D');
+
+
+
+/**
+ * @constructor
+ * @extends {D}
+ */
+F = function() {
+  F.base(this, 'constructor');
+};
+goog.inherits(F, D);
+
+
+/**
+ * @export
+ * @param {boolean} b
+ * @return {number}
+ */
+F.a = function(b) {
+  return D.a(false);
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+F.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'F', qName: 'F', kind: 'class' }] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('F', F);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+F.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {return {};},
+    accessors: function () {return {};},
+    methods: function () {
+      return {
+        'F': { type: '', declaredBy: 'F'},
+        '|a': { type: 'int', declaredBy: 'F', parameters: function () { return [  { index: 1, type: 'Boolean', optional: false } ]; }}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/51ddb858/compiler-jx/src/test/resources/flexjs/projects/circular_proto/index_result.html
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/circular_proto/index_result.html b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/index_result.html
new file mode 100644
index 0000000..80c7d8e
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/projects/circular_proto/index_result.html
@@ -0,0 +1,42 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+
+-->
+<!DOCTYPE html>
+<html>
+<head>
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+	<link rel="stylesheet" type="text/css" href="A.css">
+	<script type="text/javascript" src="./library/closure/goog/base.js"></script>
+	<script type="text/javascript">
+// generated by FalconJX
+goog.addDependency('../../../A.js', ['A'], ['E']);
+goog.addDependency('../../../E.js', ['E'], ['C']);
+goog.addDependency('../../../F.js', ['F'], ['D']);
+goog.addDependency('../../../D.js', ['D'], ['C']);
+goog.addDependency('../../../C.js', ['C'], ['B', 'F']);
+goog.addDependency('../../../B.js', ['B'], []);
+		goog.require("A");
+	</script>
+</head>
+<body>
+	<script type="text/javascript">
+		new A().start();
+	</script>
+</body>
+</html>
\ No newline at end of file


[22/50] git commit: [flex-falcon] [refs/heads/dual] - Merge branch 'mxml-sourcemaps' into develop

Posted by ah...@apache.org.
Merge branch 'mxml-sourcemaps' into develop


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

Branch: refs/heads/dual
Commit: 548283ede67a3145152c6a57dba09fe49361be11
Parents: 7020062 de82884
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Mar 23 15:14:53 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Mar 23 15:14:53 2017 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/INestingEmitter.java  |  26 ++
 .../flex/compiler/codegen/as/IASEmitter.java    |   3 +-
 .../flex/compiler/codegen/js/IJSEmitter.java    |  38 +--
 .../compiler/codegen/js/IMappingEmitter.java    |  66 +++++
 .../flex/compiler/driver/js/IJSBackend.java     |   4 +-
 .../flex/compiler/internal/codegen/Emitter.java |  28 ++
 .../compiler/internal/codegen/as/ASEmitter.java |  31 +-
 .../compiler/internal/codegen/js/JSEmitter.java |  16 +
 .../internal/codegen/js/JSSourceMapEmitter.java |  10 +-
 .../compiler/internal/codegen/js/JSWriter.java  |   7 +-
 .../internal/codegen/mxml/MXMLWriter.java       |  25 +-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 291 ++++++++++++++-----
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  34 ---
 .../compiler/internal/driver/js/JSBackend.java  |   3 +-
 .../sourcemaps/TestSourceMapMXMLScript.java     |  77 +++++
 .../internal/test/FlexJSSourceMapTestBase.java  |  64 ++++
 .../compiler/internal/test/FlexJSTestBase.java  |  33 +++
 .../internal/test/SourceMapTestBase.java        |   5 +-
 18 files changed, 597 insertions(+), 164 deletions(-)
----------------------------------------------------------------------



[14/50] git commit: [flex-falcon] [refs/heads/dual] - disable test for now

Posted by ah...@apache.org.
disable test for now


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

Branch: refs/heads/dual
Commit: 13a58d87ae97cfd16529e1e2b8c4736963596b29
Parents: 51ddb85
Author: Alex Harui <ah...@apache.org>
Authored: Thu Mar 16 22:14:56 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Mar 16 22:14:56 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/flexjs/TestFlexJSProject.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/13a58d87/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
index fa184b9..50ff64a 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
@@ -130,7 +130,7 @@ public class TestFlexJSProject extends TestGoogProject
         assertProjectOut(compiledFileNames, testDirPath);
     }
 
-    @Test
+    @Ignore
     public void test_IsItCircularProto()
     {
         String testDirPath = projectDirPath + "/circular_proto";


[26/50] git commit: [flex-falcon] [refs/heads/dual] - MXMLFlexxJSEmitter: fixed JS output for MXML script and events to match whitespace in tests

Posted by ah...@apache.org.
MXMLFlexxJSEmitter: fixed JS output for MXML script and events to match whitespace in tests


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

Branch: refs/heads/dual
Commit: f2e03cce9646adfca5685af7d273932e6701fed4
Parents: 43eae18
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Mar 24 15:09:12 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Mar 24 15:09:12 2017 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java         | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f2e03cce/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 6728cc2..2b19b87 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -1499,6 +1499,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
                         writeNewline();
                         writeNewline();
+                        writeNewline();
                     }
                 }
             }
@@ -1527,15 +1528,19 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             int len = node.getChildCount();
             for (int i = 0; i < len; i++)
             {
+                if (i > 0)
+                {
+                    writeNewline();
+                }
                 IASNode cnode = node.getChild(i);
                 asEmitter.getWalker().walk(cnode);
-                writeToken(ASEmitterTokens.SEMICOLON);
-                writeNewline();
+                write(ASEmitterTokens.SEMICOLON);
             }
 
-            write(ASEmitterTokens.BLOCK_CLOSE);
-            writeNewline(";");
+            indentPop();
             writeNewline();
+            write(ASEmitterTokens.BLOCK_CLOSE);
+            writeNewline(ASEmitterTokens.SEMICOLON);
             writeNewline();
         }
     }


[30/50] git commit: [flex-falcon] [refs/heads/dual] - Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop

Posted by ah...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-falcon into develop


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

Branch: refs/heads/dual
Commit: 50dd25d9dd41e23ddad8148928e8da7cb587b8fe
Parents: ed270e2 095d5ee
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 25 21:44:42 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 25 21:44:42 2017 -0700

----------------------------------------------------------------------
 compiler-jx/pom.xml                             |   2 +
 .../flex/compiler/codegen/INestingEmitter.java  |  26 ++
 .../flex/compiler/codegen/as/IASEmitter.java    |   3 +-
 .../flex/compiler/codegen/js/IJSEmitter.java    |  38 +--
 .../compiler/codegen/js/IMappingEmitter.java    |  66 ++++
 .../flex/compiler/driver/js/IJSBackend.java     |   4 +-
 .../flex/compiler/internal/codegen/Emitter.java |  28 ++
 .../compiler/internal/codegen/as/ASEmitter.java |  31 +-
 .../compiler/internal/codegen/js/JSEmitter.java |  16 +
 .../internal/codegen/js/JSSourceMapEmitter.java |  10 +-
 .../compiler/internal/codegen/js/JSWriter.java  |   7 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  16 +-
 .../internal/codegen/mxml/MXMLWriter.java       |  25 +-
 .../codegen/mxml/flexjs/MXMLEventSpecifier.java |   3 +
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 339 ++++++++++++++-----
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  34 --
 .../compiler/internal/driver/js/JSBackend.java  |   3 +-
 .../js/flexjs/TestFlexJSGlobalFunctions.java    |   2 +-
 .../sourcemaps/TestSourceMapMXMLEvents.java     |  44 +++
 .../sourcemaps/TestSourceMapMXMLScript.java     |  77 +++++
 .../internal/test/FlexJSSourceMapTestBase.java  |  64 ++++
 .../compiler/internal/test/FlexJSTestBase.java  |  33 ++
 .../internal/test/SourceMapTestBase.java        |   5 +-
 23 files changed, 677 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50dd25d9/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50dd25d9/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------


[49/50] git commit: [flex-falcon] [refs/heads/dual] - - Added the express example to the maven build - Updated the tomcat version used in the integration test module - Made the tomcat download url more resilient against new versions - Fine-tuned the RAT

Posted by ah...@apache.org.
- Added the express example to the maven build
- Updated the tomcat version used in the integration test module
- Made the tomcat download url more resilient against new versions
- Fine-tuned the RAT exclusions to be more resilient when compiling with different sets of modules in the reactor
- Added some missing license headers


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

Branch: refs/heads/dual
Commit: 9f793c69c8d0260602f9040de47bfc66ad514f8f
Parents: d87235f
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Wed Apr 5 13:15:19 2017 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Wed Apr 5 13:15:19 2017 +0200

----------------------------------------------------------------------
 .../flexjs/extension/FlexJsLanguageSupport.java   | 14 ++++++++++++++
 .../flexjs/extension/FlexJsScopeDeriver.java      | 14 ++++++++++++++
 .../flexjs/extension/FlexJsScopeSelector.java     | 14 ++++++++++++++
 pom.xml                                           | 18 ++++++++++++++----
 4 files changed, 56 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9f793c69/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsLanguageSupport.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsLanguageSupport.java b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsLanguageSupport.java
index 054c63a..f3d9266 100644
--- a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsLanguageSupport.java
+++ b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsLanguageSupport.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
+
 package org.apache.flex.maven.flexjs.extension;
 
 import org.apache.maven.repository.internal.LanguageSupport;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9f793c69/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeDeriver.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeDeriver.java b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeDeriver.java
index c57083f..23af0ac 100644
--- a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeDeriver.java
+++ b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeDeriver.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
+
 package org.apache.flex.maven.flexjs.extension;
 
 import org.eclipse.aether.RepositoryException;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9f793c69/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeSelector.java
----------------------------------------------------------------------
diff --git a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeSelector.java b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeSelector.java
index b58e580..2d7811e 100644
--- a/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeSelector.java
+++ b/flexjs-maven-extension/src/main/java/org/apache/flex/maven/flexjs/extension/FlexJsScopeSelector.java
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
+
 package org.apache.flex.maven.flexjs.extension;
 
 import org.eclipse.aether.RepositoryException;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9f793c69/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8a013ad..0f34fc2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,10 +146,20 @@
             <exclude>README*</exclude>
             <exclude>RELEASE_NOTES*</exclude>
             <!-- Modules which are excluded from the build -->
-            <exclude>compiler-build-tools/**</exclude>
-            <exclude>compiler-jburg-types/**</exclude>
-            <exclude>flexjs-maven-extension/**</exclude>
-            <exclude>externs/**</exclude>
+            <!-- FlashBuilder settings. frameworks/fb.properties contains Alex' path entries and should be removed -->
+            <exclude>fb.properties</exclude>
+            <!-- FlashBuilder / Eclipse settings. If checked in, they should have apache headers -->
+            <exclude>**/.settings/**</exclude>
+            <!-- Ignore IntelliJ IDEA project files -->
+            <exclude>**/*.iml</exclude>
+            <exclude>**/.idea/**</exclude>
+            <!--
+                Exclude any eventually existing content of target directories.
+                Some times when building with a bigger maven reactor and then
+                with a smaller one, RAT will complain about stuff still in the
+                target directories. We don't want that.
+            -->
+            <exclude>**/target/**</exclude>
             <!-- Stuff an Ant build might have left behind. -->
             <exclude>lib/**</exclude>
           </excludes>


[10/50] git commit: [flex-falcon] [refs/heads/dual] - oops, wrong order

Posted by ah...@apache.org.
oops, wrong order


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

Branch: refs/heads/dual
Commit: 0271ed01f4938cebce05c2dfb4ddf2f3de05607f
Parents: 0b07c7b
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 13 12:52:37 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 13 12:52:37 2017 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0271ed01/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index dfcb73d..3b11121 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -237,11 +237,11 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         }
         // Dump a copy of the closure lib files to the intermediate directory. Without this
         // the application will not be able to run.
-        closureSourceFiles = closureFilesInOrder(intermediateDir + "/library/closure/", closureSourceFiles, "goog.events.EventTarget");
         for(SourceFile closureSourceFile : closureSourceFiles) {
             FileUtils.write(new File(new File(intermediateDir, "library/closure"),
                     closureSourceFile.getName()), closureSourceFile.getCode());
         }
+        closureSourceFiles = closureFilesInOrder(intermediateDir + "/library/closure/", closureSourceFiles, "goog.events.EventTarget");
 
 
         /////////////////////////////////////////////////////////////////////////////////


[04/50] git commit: [flex-falcon] [refs/heads/dual] - fix interface override checking

Posted by ah...@apache.org.
fix interface override checking


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

Branch: refs/heads/dual
Commit: dad773a2193b5a80aee1e5a5f82d30b82ac19431
Parents: 6e14d68
Author: Alex Harui <ah...@apache.org>
Authored: Wed Mar 8 22:42:14 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Mar 8 22:42:14 2017 -0800

----------------------------------------------------------------------
 .../semantics/MethodBodySemanticChecker.java    |  7 +++
 .../src/test/java/as/ASInheritanceTests.java    | 59 ++++++++++++++++++++
 2 files changed, 66 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dad773a2/compiler/src/main/java/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java b/compiler/src/main/java/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
index 1b51727..3904823 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
@@ -2799,7 +2799,14 @@ public class MethodBodySemanticChecker
         if( conflicts.size() > 0 )
         {
             for( IFunctionDefinition overriden : conflicts )
+            {
+            	if ((overriden instanceof SetterDefinition &&
+            		funcDef instanceof GetterDefinition) ||
+            		(overriden instanceof GetterDefinition &&
+            		funcDef instanceof SetterDefinition))
+            		continue;
                 addProblem(new InterfaceMethodOverrideProblem(iNode, funcDef.getBaseName(), overriden.getParent().getBaseName()));
+            }
         }
 
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dad773a2/compiler/src/test/java/as/ASInheritanceTests.java
----------------------------------------------------------------------
diff --git a/compiler/src/test/java/as/ASInheritanceTests.java b/compiler/src/test/java/as/ASInheritanceTests.java
index 4d1d393..b5833e1 100644
--- a/compiler/src/test/java/as/ASInheritanceTests.java
+++ b/compiler/src/test/java/as/ASInheritanceTests.java
@@ -83,4 +83,63 @@ public class ASInheritanceTests  extends ASFeatureTestsBase{
 
         compileAndExpectErrors(source, false,false,false, null,"No default constructor found in base class A.\n");
     }
+    
+    @Test
+    public void InterfaceOverrideError()
+    {
+        // all tests can assume that flash.display.Sprite
+        // flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+                {
+                };
+        String[] declarations = new String[]
+                {
+                };
+        String[] testCode = new String[]
+                {
+
+                };
+        String[] extra = new String[]
+                {
+                        "interface A {",
+                        "function get text():String;",
+                        "}",
+                        "interface B extends A {",
+                        "function get text():String;",
+                        "}"
+                };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        compileAndExpectErrors(source, false,false,false, null,"Cannot override an interface method.  Method text conflicts with a method in base interface A.\n");
+    }
+
+    @Test
+    public void InterfaceOverrideOK()
+    {
+        // all tests can assume that flash.display.Sprite
+        // flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+                {
+                };
+        String[] declarations = new String[]
+                {
+                };
+        String[] testCode = new String[]
+                {
+
+                };
+        String[] extra = new String[]
+                {
+                        "interface A {",
+                        "function get text():String;",
+                        "}",
+                        "interface B extends A {",
+                        "function set text(value:String):void;",
+                        "}"
+                };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        compileAndRun(source);;
+    }
+
 }


[05/50] git commit: [flex-falcon] [refs/heads/dual] - handle some tricky RegExp literals

Posted by ah...@apache.org.
handle some tricky RegExp literals


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

Branch: refs/heads/dual
Commit: 628d3ca65391645c52d76098c6e9a2155b5c77b2
Parents: dad773a
Author: Alex Harui <ah...@apache.org>
Authored: Thu Mar 9 11:28:48 2017 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Mar 9 11:28:48 2017 -0800

----------------------------------------------------------------------
 .../internal/codegen/js/jx/LiteralEmitter.java  |  9 +++++
 .../js/flexjs/TestFlexJSGlobalClasses.java      | 41 ++++++++++++++++++++
 2 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/628d3ca6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index 84e883a..22129d4 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -172,6 +172,15 @@ public class LiteralEmitter extends JSSubEmitter implements
             }
 
         }
+        else
+        {
+            s = s.replaceAll("\n", "\\\\u000a");
+            s = s.replaceAll("\r", "\\\\u000d");
+            s = s.replaceAll("\t", "\\\\u0009");        	
+            s = s.replaceAll(" ", "\\\\u0020");
+            s = s.replace("\u2028", "\\u2028");
+            s = s.replace("\u2029", "\\u2029");
+        }
 
         if (!isWritten)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/628d3ca6/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index 74b9d1e..05b318b 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -915,4 +915,45 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
         assertOut("var foreachiter0_target = a;\nfor (var foreachiter0 in foreachiter0_target.propertyNames()) \n{\nvar p = foreachiter0_target.getProperty(foreachiter0);\n\n  var /** @type {number} */ i = p.length;}\n");
     }
     
+    @Test
+    public void testRegExp_LiteralUnicode()
+    {
+        IVariableNode node = getVariable("var a:RegExp = /[\\u0065\\u0066\\u0067]/g;");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {RegExp} */ a = /[efg]/g");
+    }
+
+    @Test
+    public void testRegExp_LiteralComplex1()
+    {
+        IVariableNode node = getVariable("var a:RegExp = /[\\u0009\\u000a\\u000d]/g;");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {RegExp} */ a = /[\\u0009\\u000a\\u000d]/g");
+    }
+
+    @Test
+    public void testRegExp_LiteralComplex2()
+    {
+        IVariableNode node = getVariable("var a:RegExp = /\\u2028/;");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {RegExp} */ a = /\\u2028/");
+    }
+
+    @Test
+    public void testRegExp_LiteralComplex3()
+    {
+        IVariableNode node = getVariable("var a:RegExp = /\\u000A|\\u000D\\u000A?/g;");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {RegExp} */ a = /\\u000a|\\u000d\\u000a?/g");
+    }
+
+    @Test
+    public void testRegExp_LiteralComplex4()
+    {
+        IVariableNode node = getVariable("var a:RegExp = /[^\\u0009\\u000a\\u000d\\u0020]/g;");
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {RegExp} */ a = /[^\\u0009\\u000a\\u000d\\u0020]/g");
+    }
+
+    
 }


[16/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: source maps for fx:Script blocks

Posted by ah...@apache.org.
compiler-jx: source maps for fx:Script blocks


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

Branch: refs/heads/dual
Commit: 8886eb3b2e095b1b123f07aea22d0cd05e89b762
Parents: d939b62
Author: Josh Tynjala <jo...@apache.org>
Authored: Mon Mar 20 16:24:19 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Mon Mar 20 16:24:19 2017 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/INestingEmitter.java  |  26 +++
 .../flex/compiler/codegen/as/IASEmitter.java    |   3 +-
 .../flex/compiler/codegen/js/IJSEmitter.java    |  38 +---
 .../compiler/codegen/js/IMappingEmitter.java    |  66 +++++++
 .../flex/compiler/driver/js/IJSBackend.java     |   4 +-
 .../flex/compiler/internal/codegen/Emitter.java |  28 +++
 .../compiler/internal/codegen/as/ASEmitter.java |  31 +++-
 .../compiler/internal/codegen/js/JSEmitter.java |  16 ++
 .../internal/codegen/js/JSSourceMapEmitter.java |  10 +-
 .../compiler/internal/codegen/js/JSWriter.java  |   7 +-
 .../internal/codegen/mxml/MXMLWriter.java       |  25 ++-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 179 ++++++++++++++++++-
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  34 ----
 .../compiler/internal/driver/js/JSBackend.java  |   3 +-
 .../internal/test/SourceMapTestBase.java        |   5 +-
 15 files changed, 374 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/INestingEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/INestingEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/INestingEmitter.java
new file mode 100644
index 0000000..36889c5
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/INestingEmitter.java
@@ -0,0 +1,26 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+package org.apache.flex.compiler.codegen;
+
+public interface INestingEmitter extends IEmitter
+{
+    IEmitter getParentEmitter();
+    void setParentEmitter(IEmitter emitter);
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
index 928259b..3716aba 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -23,6 +23,7 @@ import java.io.Writer;
 
 import org.apache.flex.compiler.codegen.IDocEmitter;
 import org.apache.flex.compiler.codegen.IEmitter;
+import org.apache.flex.compiler.codegen.INestingEmitter;
 import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.tree.as.IASNode;
@@ -76,7 +77,7 @@ import org.apache.flex.compiler.visitor.IBlockWalker;
  * 
  * @author Michael Schmalle
  */
-public interface IASEmitter extends IEmitter
+public interface IASEmitter extends INestingEmitter
 {
     IBlockWalker getWalker();
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index b686a3a..f71eb90 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -20,11 +20,8 @@
 package org.apache.flex.compiler.codegen.js;
 
 import java.io.Writer;
-import java.util.List;
 
-import com.google.debugging.sourcemap.FilePosition;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
-import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.codegen.js.JSSessionModel;
 import org.apache.flex.compiler.tree.as.IASNode;
@@ -37,47 +34,14 @@ import org.apache.flex.compiler.visitor.IASNodeStrategy;
  * 
  * @author Michael Schmalle
  */
-public interface IJSEmitter extends IASEmitter
+public interface IJSEmitter extends IASEmitter, IMappingEmitter
 {
     JSSessionModel getModel();
-    List<SourceMapMapping> getSourceMapMappings();
     
     String formatQualifiedName(String name);
-
-    /**
-     * Adds a node to the source map.
-     */
-    void startMapping(ISourceLocation node);
-
-    /**
-     * Adds a node to the source map using custom line and column values,
-     * instead of the node's own line and column. Useful for starting a mapping
-     * in the middle of the node.
-     */
-    void startMapping(ISourceLocation node, int line, int column);
-
-    /**
-     * Adds a node to the source map after a particular node instead using the
-     * node's own line and column.
-     */
-    void startMapping(ISourceLocation node, ISourceLocation afterNode);
-
-    /**
-     * Commits a mapping to the source map.
-     */
-    void endMapping(ISourceLocation node);
     
     void emitSourceMapDirective(ITypeNode node);
     
     void emitClosureStart();
     void emitClosureEnd(IASNode node, IDefinition nodeDef);
-    
-    class SourceMapMapping
-    {
-        public String sourcePath;
-        public String name;
-        public FilePosition sourceStartPosition;
-        public FilePosition destStartPosition;
-        public FilePosition destEndPosition;
-    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IMappingEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IMappingEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IMappingEmitter.java
new file mode 100644
index 0000000..dc4bb6b
--- /dev/null
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/IMappingEmitter.java
@@ -0,0 +1,66 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+
+package org.apache.flex.compiler.codegen.js;
+
+import java.util.List;
+
+import org.apache.flex.compiler.common.ISourceLocation;
+
+import com.google.debugging.sourcemap.FilePosition;
+
+/**
+ * Tracks mappings to generate source maps while it emits code.
+ */
+public interface IMappingEmitter
+{
+    List<SourceMapMapping> getSourceMapMappings();
+
+    /**
+     * Adds a node to the source map.
+     */
+    void startMapping(ISourceLocation node);
+
+    /**
+     * Adds a node to the source map using custom line and column values,
+     * instead of the node's own line and column. Useful for starting a mapping
+     * in the middle of the node.
+     */
+    void startMapping(ISourceLocation node, int line, int column);
+
+    /**
+     * Adds a node to the source map after a particular node instead using the
+     * node's own line and column.
+     */
+    void startMapping(ISourceLocation node, ISourceLocation afterNode);
+
+    /**
+     * Commits a mapping to the source map.
+     */
+    void endMapping(ISourceLocation node);
+
+    class SourceMapMapping
+    {
+        public String sourcePath;
+        public String name;
+        public FilePosition sourceStartPosition;
+        public FilePosition destStartPosition;
+        public FilePosition destEndPosition;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/driver/js/IJSBackend.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/driver/js/IJSBackend.java b/compiler-jx/src/main/java/org/apache/flex/compiler/driver/js/IJSBackend.java
index eb0f4e2..80099b6 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/driver/js/IJSBackend.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/driver/js/IJSBackend.java
@@ -20,10 +20,10 @@
 package org.apache.flex.compiler.driver.js;
 
 import org.apache.flex.compiler.codegen.ISourceMapEmitter;
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.driver.IBackend;
 
 public interface IJSBackend extends IBackend
 {
-    ISourceMapEmitter createSourceMapEmitter(IJSEmitter emitter);
+    ISourceMapEmitter createSourceMapEmitter(IMappingEmitter emitter);
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/Emitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/Emitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/Emitter.java
index c399d73..d559058 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/Emitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/Emitter.java
@@ -108,6 +108,20 @@ public class Emitter implements IEmitter
         walker = value;
     }
 
+    private int currentLine = 0;
+
+    protected int getCurrentLine()
+    {
+        return currentLine;
+    }
+
+    private int currentColumn = 0;
+
+    protected int getCurrentColumn()
+    {
+        return currentColumn;
+    }
+
     public Emitter(FilterWriter out)
     {
         this.out = out;
@@ -127,9 +141,23 @@ public class Emitter implements IEmitter
         try
         {
             if (!bufferWrite)
+            {
+                int newLineCount = value.length() - value.replace("\n", "").length();
+                currentLine += newLineCount;
+                if (newLineCount > 0)
+                {
+                    currentColumn = value.length() - value.lastIndexOf("\n") - 1;
+                }
+                else
+                {
+                    currentColumn += value.length();
+                }
                 out.write(value);
+            }
             else
+            {
                 builder.append(value);
+            }
         }
         catch (IOException e)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 0320d6a..c34eadb 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -109,6 +109,18 @@ public class ASEmitter implements IASEmitter, IEmitter
 {
     private final FilterWriter out;
 
+    private IEmitter parentEmitter;
+
+    public IEmitter getParentEmitter()
+    {
+        return parentEmitter;
+    }
+
+    public void setParentEmitter(IEmitter value)
+    {
+        parentEmitter = value;
+    }
+
     private boolean bufferWrite;
 
     protected boolean isBufferWrite()
@@ -223,17 +235,24 @@ public class ASEmitter implements IASEmitter, IEmitter
         {
             if (!bufferWrite)
             {
-                int newLineCount = value.length() - value.replace("\n", "").length();
-                currentLine += newLineCount;
-                if (newLineCount > 0)
+                if (parentEmitter != null)
                 {
-                    currentColumn = value.length() - value.lastIndexOf("\n") - 1;
+                    parentEmitter.write(value);
                 }
                 else
                 {
-                    currentColumn += value.length();
+                    int newLineCount = value.length() - value.replace("\n", "").length();
+                    currentLine += newLineCount;
+                    if (newLineCount > 0)
+                    {
+                        currentColumn = value.length() - value.lastIndexOf("\n") - 1;
+                    }
+                    else
+                    {
+                        currentColumn += value.length();
+                    }
+                    out.write(value);
                 }
-                out.write(value);
             }
             else
             {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 5b1f770..db31fa0 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -24,8 +24,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Stack;
 
+import org.apache.flex.compiler.codegen.IEmitter;
 import org.apache.flex.compiler.codegen.ISubEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.common.ASModifier;
 import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.definitions.IDefinition;
@@ -391,6 +393,13 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         {
             return;
         }
+        IEmitter parentEmitter = getParentEmitter();
+        if (parentEmitter != null && parentEmitter instanceof IMappingEmitter)
+        {
+            IMappingEmitter mappingParent = (IMappingEmitter) parentEmitter;
+            mappingParent.startMapping(node, line, column);
+            return;
+        }
         if (lastMapping != null)
         {
             FilePosition sourceStartPosition = lastMapping.sourceStartPosition;
@@ -436,6 +445,13 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         {
             return;
         }
+        IEmitter parentEmitter = getParentEmitter();
+        if (parentEmitter != null && parentEmitter instanceof IMappingEmitter)
+        {
+            IMappingEmitter mappingParent = (IMappingEmitter) parentEmitter;
+            mappingParent.endMapping(node);
+            return;
+        }
         if (lastMapping == null)
         {
             throw new IllegalStateException("Cannot end mapping when a mapping has not been started");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSourceMapEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSourceMapEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSourceMapEmitter.java
index bcdeed5..5b6c26c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSourceMapEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSourceMapEmitter.java
@@ -23,16 +23,16 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.flex.compiler.codegen.ISourceMapEmitter;
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 
 import com.google.debugging.sourcemap.SourceMapGeneratorV3;
 
 public class JSSourceMapEmitter implements ISourceMapEmitter
 {
-    private IJSEmitter emitter;
+    private IMappingEmitter emitter;
     private SourceMapGeneratorV3 sourceMapGenerator;
 
-    public JSSourceMapEmitter(IJSEmitter emitter)
+    public JSSourceMapEmitter(IMappingEmitter emitter)
     {
         this.emitter = emitter;
         sourceMapGenerator = new SourceMapGeneratorV3();
@@ -40,8 +40,8 @@ public class JSSourceMapEmitter implements ISourceMapEmitter
     
     public String emitSourceMap(String fileName, String sourceMapPath, String sourceRoot)
     {
-        List<IJSEmitter.SourceMapMapping> mappings = this.emitter.getSourceMapMappings();
-        for (IJSEmitter.SourceMapMapping mapping : mappings)
+        List<IMappingEmitter.SourceMapMapping> mappings = this.emitter.getSourceMapMappings();
+        for (IMappingEmitter.SourceMapMapping mapping : mappings)
         {
             sourceMapGenerator.addMapping(mapping.sourcePath, mapping.name,
                     mapping.sourceStartPosition,

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
index 0eb6c9b..7076009 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
@@ -31,6 +31,7 @@ import java.util.Stack;
 import org.apache.flex.compiler.codegen.ISourceMapEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.driver.js.IJSBackend;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.problems.ICompilerProblem;
@@ -131,10 +132,10 @@ public class JSWriter implements IJSWriter
         }
     }
     
-    protected void convertMappingSourcePathsToRelative(IJSEmitter emitter, File relativeToFile)
+    protected void convertMappingSourcePathsToRelative(IMappingEmitter emitter, File relativeToFile)
     {
-        List<IJSEmitter.SourceMapMapping> mappings = emitter.getSourceMapMappings();
-        for (IJSEmitter.SourceMapMapping mapping : mappings)
+        List<IMappingEmitter.SourceMapMapping> mappings = emitter.getSourceMapMappings();
+        for (IMappingEmitter.SourceMapMapping mapping : mappings)
         {
             mapping.sourcePath = relativePath(mapping.sourcePath, relativeToFile.getAbsolutePath());
         }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
index 84d9421..c127e7b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
@@ -19,13 +19,18 @@
 
 package org.apache.flex.compiler.internal.codegen.mxml;
 
+import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
+import org.apache.flex.compiler.codegen.ISourceMapEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.driver.js.IJSBackend;
 import org.apache.flex.compiler.internal.codegen.js.JSFilterWriter;
 import org.apache.flex.compiler.internal.codegen.js.JSWriter;
@@ -62,6 +67,7 @@ public class MXMLWriter extends JSWriter
         IMXMLEmitter mxmlEmitter = backend.createMXMLEmitter(writer);
         IMXMLBlockWalker mxmlBlockWalker = backend.createMXMLWalker(
                 project, problems, mxmlEmitter, asEmitter, asBlockWalker);
+        asEmitter.setParentEmitter(mxmlEmitter);
 
         mxmlBlockWalker.visitCompilationUnit(compilationUnit);
 
@@ -76,8 +82,23 @@ public class MXMLWriter extends JSWriter
 
         if (sourceMapOut != null)
         {
-            String fileName = new File(compilationUnit.getAbsoluteFilename()).getName();
-            System.out.println("Source map cannot be generated for '" + fileName + "'.");
+            convertMappingSourcePathsToRelative((IMappingEmitter) mxmlEmitter, sourceMapOut);
+
+            File compilationUnitFile = new File(compilationUnit.getAbsoluteFilename());
+            ISourceMapEmitter sourceMapEmitter = backend.createSourceMapEmitter((IMappingEmitter) mxmlEmitter);
+            try
+            {
+                String fileName = compilationUnitFile.getName();
+                fileName = fileName.replace(".mxml", ".js");
+                String sourceMap = sourceMapEmitter.emitSourceMap(fileName, sourceMapOut.getAbsolutePath(), null);
+                BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(sourceMapOut));
+                outStream.write(sourceMap.getBytes());
+                outStream.flush();
+                outStream.close();
+            } catch (Exception e)
+            {
+                e.printStackTrace();
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 0b87cd6..207e671 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -34,8 +34,10 @@ import org.apache.flex.abc.semantics.MethodInfo;
 import org.apache.flex.abc.semantics.Name;
 import org.apache.flex.abc.semantics.Namespace;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.common.ASModifier;
+import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.constants.IASKeywordConstants;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.definitions.IClassDefinition;
@@ -58,6 +60,7 @@ import org.apache.flex.compiler.internal.codegen.js.jx.BindableEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.PackageFooterEmitter;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
+import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope;
@@ -81,12 +84,13 @@ import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
 import org.apache.flex.swc.ISWC;
 
 import com.google.common.base.Joiner;
+import com.google.debugging.sourcemap.FilePosition;
 
 /**
  * @author Erik de Bruin
  */
 public class MXMLFlexJSEmitter extends MXMLEmitter implements
-        IMXMLFlexJSEmitter
+        IMXMLFlexJSEmitter, IMappingEmitter
 {
 
 	// the instances in a container
@@ -130,10 +134,20 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
      *  deferred instance = local3[ nodeToIndexMap.get(an instance) ]
      */
     protected Map<IMXMLNode, Integer> nodeToIndexMap;
+
+    private SourceMapMapping lastMapping;
+
+    private List<SourceMapMapping> sourceMapMappings;
+
+    public List<SourceMapMapping> getSourceMapMappings()
+    {
+        return sourceMapMappings;
+    }
     
     public MXMLFlexJSEmitter(FilterWriter out)
     {
         super(out);
+        sourceMapMappings = new ArrayList<SourceMapMapping>();
     }
 
     @Override
@@ -163,8 +177,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     	boolean stillSearching = true;
         ArrayList<String> namesToAdd = new ArrayList<String>();
         ArrayList<String> foundRequires = new ArrayList<String>();
-    	for (String line : lines)
-    	{
+        int len = lines.length;
+        for (int i = 0; i < len; i++)
+        {
+            String line = lines[i];
     		if (stillSearching)
     		{
 	            int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
@@ -179,7 +195,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 	    			sawRequires = true;
                     foundRequires.add(s);
 	    			if (!usedNames.contains(s))
-	    				continue;
+                    {
+                        removeLineFromMappings(i);
+                        continue;
+                    }
 	    		}
 	    		else if (sawRequires)
 	    		{
@@ -202,8 +221,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                     }
 
                     for (String nameToAdd : namesToAdd) {
-                        //System.out.println("adding late requires:"+nameToAdd);
                         finalLines.add(createRequireLine(nameToAdd,false));
+                        addLineToMappings(i);
                     }
 
 	    			endRequires = finalLines.size();
@@ -223,7 +242,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
             appendString.append(ASEmitterTokens.SEMICOLON.getToken());
             finalLines.add(endRequires, appendString.toString());
-            // TODO (aharui) addLineToMappings(finalLines.size());
+            addLineToMappings(endRequires);
+            endRequires++;
         }
     	// append info() structure if main CU
         ICompilerProject project = getMXMLWalker().getProject();
@@ -265,12 +285,12 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 		                    appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
 		                    appendString.append(ASEmitterTokens.SEMICOLON.getToken());
 	                        finalLines.add(endRequires, appendString.toString());
-	                        //addLineToMappings(finalLines.size());
+	                        addLineToMappings(endRequires);
+                            endRequires++;
 		            	}
 		            	mixinInject += "]";
 		            	infoInject += mixinInject;
 		            	sep = ",\n";
-	                    //addLineToMappings(finalLines.size());	            	
 	            	}
 	            	boolean isMX = false;
 	            	List<ISWC> swcs = flexJSProject.getLibraries();
@@ -303,11 +323,154 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 	            	}
 	            	infoInject += "}};";
                     finalLines.add(infoInject);
+                    int newLineIndex = 0;
+                    while((newLineIndex = infoInject.indexOf('\n', newLineIndex)) != -1)
+                    {
+                        addLineToMappings(finalLines.size());
+                        newLineIndex++;
+                    }
+                    
+                    String cssInject = "\n\n" + thisDef + ".prototype.cssData = [";
+                    JSCSSCompilationSession cssSession = (JSCSSCompilationSession) flexJSProject.getCSSCompilationSession();
+                    String s = cssSession.getEncodedCSS();
+                    if (s != null)
+                    {
+                        int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                        if (reqidx != -1)
+                        {
+                            String cssRequires = s.substring(reqidx);
+                            s = s.substring(0, reqidx - 1);
+                            String[] cssRequireLines = cssRequires.split("\n");
+                            for(String require : cssRequireLines)
+                            {
+                                finalLines.add(endRequires, require);
+                                addLineToMappings(endRequires);
+                                endRequires++;
+                            }
+                        }
+                        cssInject += s;
+                        finalLines.add(cssInject);
+                        newLineIndex = 0;
+                        while((newLineIndex = cssInject.indexOf('\n', newLineIndex)) != -1)
+                        {
+                            addLineToMappings(finalLines.size());
+                            newLineIndex++;
+                        }
+                    }
 	            }
             }
         }
+
     	return Joiner.on("\n").join(finalLines);
     }
+
+    public void startMapping(ISourceLocation node)
+    {
+        startMapping(node, node.getLine(), node.getColumn());
+    }
+
+    public void startMapping(ISourceLocation node, int line, int column)
+    {
+        if (isBufferWrite())
+        {
+            return;
+        }
+        if (lastMapping != null)
+        {
+            FilePosition sourceStartPosition = lastMapping.sourceStartPosition;
+            throw new IllegalStateException("Cannot start new mapping when another mapping is already started. "
+                    + "Previous mapping at Line " + sourceStartPosition.getLine()
+                    + " and Column " + sourceStartPosition.getColumn()
+                    + " in file " + lastMapping.sourcePath);
+        }
+
+        String sourcePath = node.getSourcePath();
+        if (sourcePath == null)
+        {
+            //if the source path is null, this node may have been generated by
+            //the compiler automatically. for example, an untyped variable will
+            //have a node for the * type.
+            if (node instanceof IASNode)
+            {
+                IASNode parentNode = ((IASNode) node).getParent();
+                if (parentNode != null)
+                {
+                    //try the parent node
+                    startMapping(parentNode, line, column);
+                    return;
+                }
+            }
+        }
+
+        SourceMapMapping mapping = new SourceMapMapping();
+        mapping.sourcePath = sourcePath;
+        mapping.sourceStartPosition = new FilePosition(line, column);
+        mapping.destStartPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
+        lastMapping = mapping;
+    }
+
+    public void startMapping(ISourceLocation node, ISourceLocation afterNode)
+    {
+        startMapping(node, afterNode.getEndLine(), afterNode.getEndColumn());
+    }
+
+    public void endMapping(ISourceLocation node)
+    {
+        if (isBufferWrite())
+        {
+            return;
+        }
+        if (lastMapping == null)
+        {
+            throw new IllegalStateException("Cannot end mapping when a mapping has not been started");
+        }
+
+        lastMapping.destEndPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
+        sourceMapMappings.add(lastMapping);
+        lastMapping = null;
+    }
+
+    /**
+     * Adjusts the line numbers saved in the source map when a line should be
+     * added during post processing.
+     *
+     * @param lineIndex
+     */
+    protected void addLineToMappings(int lineIndex)
+    {
+        for (SourceMapMapping mapping : sourceMapMappings)
+        {
+            FilePosition destStartPosition = mapping.destStartPosition;
+            int startLine = destStartPosition.getLine();
+            if(startLine > lineIndex)
+            {
+                mapping.destStartPosition = new FilePosition(startLine + 1, destStartPosition.getColumn());
+                FilePosition destEndPosition = mapping.destEndPosition;
+                mapping.destEndPosition = new FilePosition(destEndPosition.getLine() + 1, destEndPosition.getColumn());
+            }
+        }
+    }
+
+    /**
+     * Adjusts the line numbers saved in the source map when a line should be
+     * removed during post processing.
+     *
+     * @param lineIndex
+     */
+    protected void removeLineFromMappings(int lineIndex)
+    {
+        for (SourceMapMapping mapping : sourceMapMappings)
+        {
+            FilePosition destStartPosition = mapping.destStartPosition;
+            int startLine = destStartPosition.getLine();
+            if(startLine > lineIndex)
+            {
+                mapping.destStartPosition = new FilePosition(startLine - 1, destStartPosition.getColumn());
+                FilePosition destEndPosition = mapping.destEndPosition;
+                mapping.destEndPosition = new FilePosition(destEndPosition.getLine() - 1, destEndPosition.getColumn());
+            }
+        }
+    }
     
     @Override
     protected String getIndent(int numIndent)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 3b11121..a614592 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -249,10 +249,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         /////////////////////////////////////////////////////////////////////////////////
 
         final File projectIntermediateMainFile = new File(intermediateDir, outputFileName);
-        if (!googConfiguration.getSkipTranspile())
-        {
-            appendEncodedCSS(projectIntermediateMainFile, projectName);
-        }
 
 
         /////////////////////////////////////////////////////////////////////////////////
@@ -381,36 +377,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         return true;
     }
 
-    private void appendEncodedCSS(File targetFile, String projectName) throws IOException
-    {
-        StringBuilder appendString = new StringBuilder();
-        appendString.append("\n\n");
-        appendString.append(projectName);
-        appendString.append(".prototype.cssData = [");
-        JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
-        String s = cssSession.getEncodedCSS();
-        if (s != null)
-        {
-	        int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	        if (reqidx != -1)
-	        {
-	            String reqs = s.substring(reqidx);
-	            s = s.substring(0, reqidx - 1);
-	            String fileData = readCode(targetFile);
-	            reqidx = fileData.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	            String after = fileData.substring(reqidx);
-	            String before = fileData.substring(0, reqidx - 1);
-	            s = before + reqs + after + appendString.toString() + s;
-	            writeFile(targetFile, s, false);
-	        }
-	        else
-	        {
-	            appendString.append(s);
-	            writeFile(targetFile, appendString.toString(), true);
-	        }
-        }
-    }
-
     protected List<SourceFile> closureFilesInOrder(String path, List<SourceFile> files, String entryPoint)
     {
     	ArrayList<String> sortedFiles = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/JSBackend.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/JSBackend.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/JSBackend.java
index 9d6eb66..502609d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/JSBackend.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/JSBackend.java
@@ -29,6 +29,7 @@ import org.apache.flex.compiler.codegen.ISourceMapEmitter;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
 import org.apache.flex.compiler.config.Configuration;
 import org.apache.flex.compiler.config.Configurator;
@@ -139,7 +140,7 @@ public class JSBackend implements IJSBackend
     }
 
     @Override
-    public ISourceMapEmitter createSourceMapEmitter(IJSEmitter emitter)
+    public ISourceMapEmitter createSourceMapEmitter(IMappingEmitter emitter)
     {
         return new JSSourceMapEmitter(emitter);
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8886eb3b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
index 783a340..c8a6cb7 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -21,6 +21,7 @@ package org.apache.flex.compiler.internal.test;
 import java.util.List;
 
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.tree.as.IASNode;
 
 import com.google.debugging.sourcemap.FilePosition;
@@ -48,8 +49,8 @@ public class SourceMapTestBase extends ASTestBase
             sourceStartColumn += node.getColumn();
         }
         boolean foundMapping = false;
-        List<IJSEmitter.SourceMapMapping> mappings = jsEmitter.getSourceMapMappings();
-        for (IJSEmitter.SourceMapMapping mapping : mappings)
+        List<IMappingEmitter.SourceMapMapping> mappings = jsEmitter.getSourceMapMappings();
+        for (IMappingEmitter.SourceMapMapping mapping : mappings)
         {
             FilePosition sourcePosition = mapping.sourceStartPosition;
             FilePosition startPosition = mapping.destStartPosition;


[25/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: test for mxml event source maps

Posted by ah...@apache.org.
compiler-jx: test for mxml event source maps


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

Branch: refs/heads/dual
Commit: 43eae18be6a8263525670aa0a6db223c15c298e1
Parents: 42ce386
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Mar 23 16:17:50 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Mar 23 16:17:50 2017 -0700

----------------------------------------------------------------------
 compiler-jx/pom.xml                             |  1 +
 .../sourcemaps/TestSourceMapMXMLEvents.java     | 44 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/43eae18b/compiler-jx/pom.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/pom.xml b/compiler-jx/pom.xml
index 3166a62..8c451e5 100644
--- a/compiler-jx/pom.xml
+++ b/compiler-jx/pom.xml
@@ -51,6 +51,7 @@
             <exclude>**/TestFlexJSMXMLApplication.java</exclude>
             <exclude>**/TestFlexJSMXMLScript.java</exclude>
             <exclude>**/TestSourceMapMXMLScript.java</exclude>
+            <exclude>**/TestSourceMapMXMLEvents.java</exclude>
           </excludes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/43eae18b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
new file mode 100644
index 0000000..99b88ba
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
@@ -0,0 +1,44 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.flex.compiler.internal.codegen.mxml.sourcemaps;
+
+import org.apache.flex.compiler.internal.test.FlexJSSourceMapTestBase;
+import org.apache.flex.compiler.internal.test.FlexJSTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
+
+import org.junit.Test;
+
+public class TestSourceMapMXMLEvents extends FlexJSSourceMapTestBase
+{
+    @Test
+    public void testEvent()
+    {
+        String code = "<basic:Button click=\"event;\"/>";
+
+        IMXMLEventSpecifierNode node = (IMXMLEventSpecifierNode) getNode(code, IMXMLEventSpecifierNode.class, FlexJSTestBase.WRAP_LEVEL_DOCUMENT);
+        IMXMLDocumentNode dnode = (IMXMLDocumentNode) node
+                .getAncestorOfType(IMXMLDocumentNode.class);
+        mxmlBlockWalker.walk(dnode);
+        ///event
+        assertMapping(node, 0, 6, 68, 2, 68, 7);  // event
+        //the start column in the ActionScript seems to be outside the quote
+        //instead of inside. that seems like a bug. -JT
+    }
+}


[24/50] git commit: [flex-falcon] [refs/heads/dual] - compiler-jx: skip MXML source map tests in Maven build because the depend on asjs like the other excluded tests

Posted by ah...@apache.org.
compiler-jx: skip MXML source map tests in Maven build because the depend on asjs like the other excluded tests


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

Branch: refs/heads/dual
Commit: 42ce3862ab7a707dd8099b95182daa08ed6b6f99
Parents: 379b039
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Mar 23 15:59:37 2017 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Mar 23 15:59:37 2017 -0700

----------------------------------------------------------------------
 compiler-jx/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/42ce3862/compiler-jx/pom.xml
----------------------------------------------------------------------
diff --git a/compiler-jx/pom.xml b/compiler-jx/pom.xml
index 733c8b0..3166a62 100644
--- a/compiler-jx/pom.xml
+++ b/compiler-jx/pom.xml
@@ -50,6 +50,7 @@
             <exclude>**/TestGoogFile.java</exclude>
             <exclude>**/TestFlexJSMXMLApplication.java</exclude>
             <exclude>**/TestFlexJSMXMLScript.java</exclude>
+            <exclude>**/TestSourceMapMXMLScript.java</exclude>
           </excludes>
         </configuration>
       </plugin>