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:49 UTC
[18/50] git commit: [flex-falcon] [refs/heads/dual] - change to use
FlexJS Dependency List
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*/