You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/12/17 07:41:14 UTC

[royale-compiler] branch develop updated (978b6ed -> 89c4826)

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git.


    from 978b6ed  prevent rename on info structure
     new 316b7ef  fix link-report option
     new f0f8d6a  fix the externs report
     new 595e1a1  modules may have some classes marked as extern so their goog.requires need to be removed
     new bdce8a2  only force QName, XML, XMLList to be not external if they came from playerglobal or airglobal
     new 35be261  get link reports to include CSS dependencies
     new 0381826  try suppressing duplicates to get externs to work
     new 89c4826  more diagnostics

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../config/CompilerDiagnosticsConstants.java       |  1 +
 .../royale/compiler/clients/MXMLJSCRoyale.java     | 43 +++++++++--
 .../driver/js/goog/JSGoogConfiguration.java        |  2 +-
 .../compiler/internal/graph/GoogDepsWriter.java    | 86 +++++++++++++++++++---
 .../internal/projects/RoyaleJSProject.java         | 26 ++++++-
 .../royale/compiler/internal/targets/JSTarget.java |  2 +-
 .../compiler/internal/targets/RoyaleJSTarget.java  | 11 +++
 .../internal/config/RoyaleTargetSettings.java      | 10 +++
 .../compiler/internal/projects/RoyaleProject.java  |  5 ++
 .../internal/targets/RoyaleAppSWFTarget.java       | 12 +++
 .../royale/compiler/projects/IRoyaleProject.java   |  6 ++
 11 files changed, 184 insertions(+), 20 deletions(-)


[royale-compiler] 03/07: modules may have some classes marked as extern so their goog.requires need to be removed

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 595e1a1d554dc2ce00fffe4a4212717acbd4face
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Dec 13 17:19:02 2018 -0800

    modules may have some classes marked as extern so their goog.requires need to be removed
---
 .../compiler/internal/graph/GoogDepsWriter.java    | 56 +++++++++++++++++-----
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
index 0018cc3..0ce93dc 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
@@ -180,9 +180,19 @@ public class GoogDepsWriter {
 			mainDeps.append("goog.addDependency('").append(relativePath(mainDep.filePath)).append("', ['")
 								.append(mainDep.className).append("'], [");
 			ArrayList<String> restOfDeps = new ArrayList<String>();
-			restOfDeps.addAll(mainDep.deps);
+			for (String dep: mainDep.deps)
+			{
+				if (!isExternal(dep))
+					restOfDeps.add(dep);
+			}
 			if (mainDep.fileInfo.impls != null)
-				restOfDeps.addAll(mainDep.fileInfo.impls);
+			{
+				for (String dep: mainDep.fileInfo.impls)
+				{
+					if (!isExternal(dep))
+						restOfDeps.add(dep);
+				}				
+			}
 	        DependencyTypeSet dependencyTypes = DependencyTypeSet.allOf();
 			// get the list of all units not referenced by other units
 			for (GoogDep gd : depMap.values())
@@ -353,13 +363,17 @@ public class GoogDepsWriter {
 				GoogDep dep = depMap.get(name);
 				if (dep == null)
 				{
-					System.out.println("No GoogDep for " + name);
-					//added this to prevent a NullPointerException when the
-					//GoogDep is null. -JT
-					problems.add(new FileNotFoundProblem(name));
-					continue;
+					if (!isExternal(name))
+					{
+						System.out.println("No GoogDep for " + name);
+						//added this to prevent a NullPointerException when the
+						//GoogDep is null. -JT
+						problems.add(new FileNotFoundProblem(name));
+						continue;
+					}
 				}
-				depsInOrder.add(dep);
+				else
+					depsInOrder.add(dep);
 			}
 			return depsInOrder;
 		}
@@ -442,7 +456,7 @@ public class GoogDepsWriter {
 		ArrayList<String> deps = current.deps;
 		for (String className : deps)
 		{
-			if (!isGoogClass(className))
+			if (!isGoogClass(className) && !isExternal(className))
 			{
 				GoogDep gd = depMap.get(className);
 				if (gd == null)
@@ -486,6 +500,25 @@ public class GoogDepsWriter {
 				}
 			}
 
+			// first scan requires in case this is a module and some have been externed
+			int j = main.fileInfo.googProvideLine + 1;
+			while (!fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
+				j++;
+			while (fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
+			{
+				String line = fileLines.get(j);
+				int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+				int c2 = line.indexOf(")");
+                String s = line.substring(c + 14, c2 - 1);
+                if (isExternal(s))
+                {
+                	fileLines.remove(j);
+					sourceMapConsumer = removeLineFromSourceMap(sourceMapConsumer, mainFile.getName(), j);
+                }
+                else
+                	j++;
+			}
+			
 			int n = restOfDeps.size();
 			for (int i = n - 1; i >= 0; i--)
 			{
@@ -632,8 +665,9 @@ 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)) &&
-                        		(gd.fileInfo.staticDeps == null || !gd.fileInfo.staticDeps.contains(s)))
+                        if (((gd.fileInfo.impls == null || !gd.fileInfo.impls.contains(s)) &&
+                        		(gd.fileInfo.staticDeps == null || !gd.fileInfo.staticDeps.contains(s))) ||
+                        		isExternal(s))
                         {
                         	// don't remove the require if some class needs it at static initialization
                         	// time


[royale-compiler] 02/07: fix the externs report

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit f0f8d6ada07737052abfdc2fa0d0d575eb48f996
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Dec 13 17:17:00 2018 -0800

    fix the externs report
---
 .../royale/compiler/clients/MXMLJSCRoyale.java     | 39 +++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
index 2e9686d..96f1430 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
@@ -461,6 +461,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
         System.out.println("Generating externs report: " + externsReportFile.getAbsolutePath());
         
     	ArrayList<String> packageNames = new ArrayList<String>();
+    	ArrayList<String> partNames = new ArrayList<String>();
     	
     	StringBuilder sb = new StringBuilder();
         sb.append("/**\n");
@@ -485,6 +486,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
 
             IDefinition def = dp.get(0);
             IDefinition actualDef = ((DefinitionPromise) def).getActualDefinition();
+            if (actualDef.getPackageName().contains("goog")) continue;
             if (actualDef instanceof ClassDefinition)
             {
             	sb.append("\n\n");
@@ -499,6 +501,13 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             		for (String part : parts)
             		{
             			current += part;
+            			if (partNames.contains(current))
+            			{
+            				firstOne = false;
+        	                current += ".";
+            				continue;
+            			}            			
+            			partNames.add(current);
         				sb.append("/** @const */\n");
             			if (firstOne)
             			{
@@ -521,7 +530,10 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             	for (String iface : ifaces)
             		sb.append(" * @implements {" + iface + "}\n");
             	sb.append(" */\n");
-                sb.append("function " + cdef.getQualifiedName() + "() {}\n");
+            	if (pkgName.length() == 0)
+                    sb.append("function " + cdef.getQualifiedName() + "() {}\n");
+            	else
+            		sb.append(cdef.getQualifiedName() + " = function() {}\n");
                 
             	ASScope cscope = cdef.getContainedScope();
             	Collection<IDefinitionSet> defSets = cscope.getAllLocalDefinitionSets();
@@ -533,6 +545,8 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             		for (int i = 0; i < n; i++)
             		{
             			IDefinition api = defSet.getDefinition(i);
+            			String apiName = api.getBaseName();
+            			if (apiName.startsWith("#")) continue; // invalid in externs
             			if (!api.isOverride() && (api.isProtected() || api.isPublic()))
             			{
             				if (!(api instanceof FunctionDefinition) ||
@@ -554,7 +568,12 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
                             	sb.append("\n\n");
                             	sb.append("/**\n");
                             	for (ParameterDefinition param : params)
-                            		sb.append(" * @param {" + getJSType(param.getTypeAsDisplayString()) + "} " + param.getBaseName() + "\n");
+                            	{
+                            		if (param.getBaseName().isEmpty())
+                            			sb.append(" * @param {*=} opt_rest\n");
+                            		else
+                            			sb.append(" * @param {" + getJSType(param.getTypeAsDisplayString()) + "} " + param.getBaseName() + "\n");
+                            	}
                             	String ret = getJSType(method.getReturnTypeAsDisplayString());
                             	if (!ret.equals("void"))
                             		sb.append(" * @returns {" + ret + "}\n");
@@ -569,7 +588,10 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
                             	{
                             		if (j > 0)
                             			sb.append(",");
-                            		sb.append(params[j].getBaseName());
+                            		if (params[j].getBaseName().isEmpty())
+                            			sb.append("opt_rest");
+                            		else
+                            			sb.append(params[j].getBaseName());
                             	}
                             	sb.append(") {");
                             	if (!ret.equals("void"))
@@ -601,6 +623,13 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             		for (String part : parts)
             		{
             			current += part;
+            			if (partNames.contains(current))
+            			{
+            				firstOne = false;
+        	                current += ".";
+            				continue;
+            			}            			
+            			partNames.add(current);
         				sb.append("/** @const */\n");
             			if (firstOne)
             			{
@@ -620,7 +649,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             	for (String iface : ifaces)
             		sb.append(" * @extends {" + iface + "}\n");
             	sb.append(" */\n");
-                sb.append("function " + cdef.getQualifiedName() + "() {}\n");
+                sb.append(cdef.getQualifiedName() + " = function() {}\n");
             }
     	}
         System.out.println("Writing externs report: " + externsReportFile.getAbsolutePath());
@@ -637,6 +666,8 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
     
     private String getJSType(String s)
     {
+    	if (s.contains("__AS3__.vec.Vector"))
+    		return "Array";
     	return JSGoogDocEmitter.convertASTypeToJSType(s, "");
     }
 


[royale-compiler] 04/07: only force QName, XML, XMLList to be not external if they came from playerglobal or airglobal

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit bdce8a2bec0f994105a723c77da8b049f83bf03f
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Dec 13 17:20:17 2018 -0800

    only force QName, XML, XMLList to be not external if they came from playerglobal or airglobal
---
 .../internal/projects/RoyaleJSProject.java         | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
index b1d6c62..74039a3 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
@@ -18,6 +18,7 @@
  */
 package org.apache.royale.compiler.internal.projects;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -301,7 +302,11 @@ public class RoyaleJSProject extends RoyaleProject
         try {
             qnames = cu.getQualifiedNames();
             String qname = qnames.get(0);
-            if (qname.equals("QName") || qname.equals("XML") || qname.equals("XMLList"))
+            // if compiling against airglobal/playerglobal, we have to keep QName, XML, XMLList from being seens
+            // as external otherwise theJS implementations won't get added to the output.  But if the definitions
+            // come from XML.SWC assume the linkage is right in case these files get excluded from modules
+            if ((cu.getAbsoluteFilename().contains("airglobal") || cu.getAbsoluteFilename().contains("playerglobal")) &&
+            		(qname.equals("QName") || qname.equals("XML") || qname.equals("XMLList")))
                 return false;
         } catch (InterruptedException e1) {
             // TODO Auto-generated catch block
@@ -537,4 +542,23 @@ public class RoyaleJSProject extends RoyaleProject
         return list;
     }
 
+
+	@Override
+	public File getLinkReport(Configuration config) {
+		File f = config.getLinkReport();
+		if (f != null)
+		{
+			String baseName = f.getName();
+			String suffix = "";
+			int c = baseName.indexOf(".");
+			if (c != -1)
+			{
+				suffix = baseName.substring(c);
+				baseName = baseName.substring(0, c);
+			}
+			baseName += "-js" + suffix;
+			f = new File(f.getParentFile(), baseName);
+		}
+		return f;
+	}
 }


[royale-compiler] 01/07: fix link-report option

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 316b7ef7366d168109974f6d62ffe6cff4b65009
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 11 23:06:26 2018 -0800

    fix link-report option
---
 .../royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
index 8a08379..9a18c51 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java
@@ -464,7 +464,7 @@ public class JSGoogConfiguration extends JSConfiguration
     @Config(advanced = true)
     @Mapping("externs-report")
     @Arguments("filename")
-    public void setLinkReport(ConfigurationValue cv, String filename)
+    public void setExternsReport(ConfigurationValue cv, String filename)
     {
         this.externsReportFileName = getOutputPath(cv, filename);
     }


[royale-compiler] 05/07: get link reports to include CSS dependencies

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 35be261afd559d8037b6d098d9c80c738a7ed058
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Dec 13 17:24:26 2018 -0800

    get link reports to include CSS dependencies
---
 .../apache/royale/compiler/internal/targets/JSTarget.java    |  2 +-
 .../royale/compiler/internal/targets/RoyaleJSTarget.java     | 11 +++++++++++
 .../compiler/internal/config/RoyaleTargetSettings.java       | 10 ++++++++++
 .../royale/compiler/internal/projects/RoyaleProject.java     |  5 +++++
 .../royale/compiler/internal/targets/RoyaleAppSWFTarget.java | 12 ++++++++++++
 .../org/apache/royale/compiler/projects/IRoyaleProject.java  |  6 ++++++
 6 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/JSTarget.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/JSTarget.java
index 1297aa1..2525bd8 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/JSTarget.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/JSTarget.java
@@ -149,7 +149,7 @@ public class JSTarget extends Target implements IJSTarget
             //                }
             //            }
             //
-            //            createLinkReport(problems);
+            createLinkReport(problems);
 
             return application;
         }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleJSTarget.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleJSTarget.java
index 22cddfd..d218b95 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleJSTarget.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleJSTarget.java
@@ -28,11 +28,14 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.css.ICSSDocument;
 import org.apache.royale.compiler.css.ICSSManager;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.internal.css.semantics.ActivatedStyleSheets;
+import org.apache.royale.compiler.internal.definitions.ClassDefinition;
 import org.apache.royale.compiler.internal.driver.js.royale.JSCSSCompilationSession;
+import org.apache.royale.compiler.internal.projects.DependencyGraph;
 import org.apache.royale.compiler.internal.projects.RoyaleJSProject;
 import org.apache.royale.compiler.internal.units.SWCCompilationUnit;
 import org.apache.royale.compiler.problems.FileNotFoundProblem;
@@ -234,6 +237,14 @@ public class RoyaleJSTarget extends JSTarget implements IJSTarget
 
             // If there's more dependencies introduced by CSS, the loop continues.
             done = !allCompilationUnitsInTarget.addAll(cssDependencies);
+            if (done)
+            {
+	            DependencyGraph graph = royaleProject.getDependencyGraph();
+	            for (ICompilationUnit cu : cssDependencies)
+	            {
+	            	graph.addDependency(mainCU, cu, DependencyType.EXPRESSION);
+	            }
+            }
         }
 
         // add to front so user specified css overrides defaults
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/config/RoyaleTargetSettings.java b/compiler/src/main/java/org/apache/royale/compiler/internal/config/RoyaleTargetSettings.java
index e3d966c..70e34cc 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/config/RoyaleTargetSettings.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/config/RoyaleTargetSettings.java
@@ -72,4 +72,14 @@ public class RoyaleTargetSettings extends TargetSettings
 
         return externalLibraryPath;
     }
+    
+    @Override
+    public File getLinkReport()
+    {
+    	if (project != null)
+    		return ((IRoyaleProject)project).getLinkReport(configuration);
+    	
+        return super.getLinkReport();
+    }
+
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
index e787d6c..14d37b6 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
@@ -2520,4 +2520,9 @@ public class RoyaleProject extends ASProject implements IRoyaleProject, ICompile
         return false;
 	}
 
+	@Override
+	public File getLinkReport(Configuration config) {
+		return config.getLinkReport();
+	}
+
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
index 06fe9c2..c6ba409 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/RoyaleAppSWFTarget.java
@@ -47,6 +47,7 @@ import org.apache.royale.abc.semantics.Name;
 import org.apache.royale.abc.visitors.IMethodBodyVisitor;
 import org.apache.royale.abc.visitors.IMethodVisitor;
 import org.apache.royale.abc.visitors.ITraitVisitor;
+import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.common.IEmbedResolver;
 import org.apache.royale.compiler.config.Configuration;
 import org.apache.royale.compiler.config.RSLSettings;
@@ -70,6 +71,7 @@ import org.apache.royale.compiler.internal.css.semantics.CSSSemanticAnalyzer;
 import org.apache.royale.compiler.internal.definitions.ClassDefinition;
 import org.apache.royale.compiler.internal.definitions.DefinitionBase;
 import org.apache.royale.compiler.internal.definitions.NamespaceDefinition;
+import org.apache.royale.compiler.internal.projects.DependencyGraph;
 import org.apache.royale.compiler.internal.projects.RoyaleProject;
 import org.apache.royale.compiler.internal.scopes.ASProjectScope;
 import org.apache.royale.compiler.internal.tree.mxml.MXMLFileNode;
@@ -544,6 +546,16 @@ public class RoyaleAppSWFTarget extends AppSWFTarget
 
             // If there's more dependencies introduced by CSS, the loop continues.
             done = !allCompilationUnitsInTarget.addAll(cssDependencies);
+            if (done)
+            {
+            	ClassDefinition rootDef = getRootClassDefinition();
+	            ICompilationUnit rootClassCompilationUnit = project.getScope().getCompilationUnitForDefinition(rootDef);
+	            DependencyGraph graph = royaleProject.getDependencyGraph();
+	            for (ICompilationUnit cu : cssDependencies)
+	            {
+	            	graph.addDependency(rootClassCompilationUnit, cu, DependencyType.EXPRESSION);
+	            }
+            }
         }
 
         delegate.cssCompilationSession.cssDocuments.addAll(activatedStyleSheets.sort());
diff --git a/compiler/src/main/java/org/apache/royale/compiler/projects/IRoyaleProject.java b/compiler/src/main/java/org/apache/royale/compiler/projects/IRoyaleProject.java
index c1c206a..f1a63db 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/projects/IRoyaleProject.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/projects/IRoyaleProject.java
@@ -233,4 +233,10 @@ public interface IRoyaleProject extends IASProject, IXMLNameResolver, IWriteOnly
      * List of defined variables so it can be overridden
      */
     Map<String, String> getCompilerDefine(Configuration config);
+    
+    /**
+     * The File for the link report
+     */
+    File getLinkReport(Configuration config);
+
 }


[royale-compiler] 06/07: try suppressing duplicates to get externs to work

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 03818268fcaf79b627a1f55183fea3fb1439512b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Dec 16 23:09:59 2018 -0800

    try suppressing duplicates to get externs to work
---
 .../main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
index 96f1430..fa92700 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
@@ -508,9 +508,9 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             				continue;
             			}            			
             			partNames.add(current);
-        				sb.append("/** @const */\n");
             			if (firstOne)
             			{
+            				sb.append("/**\n * @suppress {duplicate}\n * @const\n */\n");
             				sb.append("var ");
             				firstOne = false;
             			}
@@ -630,9 +630,9 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
             				continue;
             			}            			
             			partNames.add(current);
-        				sb.append("/** @const */\n");
             			if (firstOne)
             			{
+            				sb.append("/**\n * @suppress {duplicate}\n * @const\n */\n");
             				sb.append("var ");
             				firstOne = false;
             			}


[royale-compiler] 07/07: more diagnostics

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 89c4826b85654988d88a719500feaa412e3643e2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Dec 16 23:10:19 2018 -0800

    more diagnostics
---
 .../config/CompilerDiagnosticsConstants.java       |  1 +
 .../compiler/internal/graph/GoogDepsWriter.java    | 34 ++++++++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java b/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java
index 9b6ce58..76eb483 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java
@@ -40,5 +40,6 @@ public class CompilerDiagnosticsConstants
     public static final int FILE_UTILS = 4096;
     public static final int ROYALEJSPROJECT = 8192;
     public static final int COMPC_PHASES = 16384;
+    public static final int GOOG_DEPS = 32768;
 
 }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
index 0ce93dc..d81c594 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
@@ -28,6 +28,7 @@ import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,6 +38,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.royale.compiler.clients.problems.ProblemQuery;
 import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.common.DependencyTypeSet;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.royale.compiler.internal.driver.js.JSCompilationUnit;
 import org.apache.royale.compiler.internal.driver.js.goog.JSGoogConfiguration;
@@ -354,7 +356,35 @@ public class GoogDepsWriter {
 			roots.add(mainUnit);
 			requireMap.remove(mainName);
 			
+			if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.GOOG_DEPS) == CompilerDiagnosticsConstants.GOOG_DEPS)
+			{
+				Collection<ICompilationUnit> units = graph.getCompilationUnits();
+				System.out.println("Contents of graph:");
+				for (ICompilationUnit unit : units)
+				{
+					try {
+						System.out.println(unit.getQualifiedNames().toString());
+					} catch (InterruptedException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}					
+				}
+			}
 			List<ICompilationUnit> order = graph.topologicalSort(requireMap.values());
+			if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.GOOG_DEPS) == CompilerDiagnosticsConstants.GOOG_DEPS)
+			{
+				Collection<ICompilationUnit> units = graph.getCompilationUnits();
+				System.out.println("Contents of graph in order:");
+				for (ICompilationUnit unit : order)
+				{
+					try {
+						System.out.println(unit.getQualifiedNames().toString());
+					} catch (InterruptedException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}					
+				}
+			}
 			ArrayList<GoogDep> depsInOrder = new ArrayList<GoogDep>();
 			for (ICompilationUnit unit : order)
 			{
@@ -502,9 +532,9 @@ public class GoogDepsWriter {
 
 			// first scan requires in case this is a module and some have been externed
 			int j = main.fileInfo.googProvideLine + 1;
-			while (!fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
+			while (j < fileLines.size() && !fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
 				j++;
-			while (fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
+			while (j < fileLines.size() && fileLines.get(j).contains(JSGoogEmitterTokens.GOOG_REQUIRE.getToken()))
 			{
 				String line = fileLines.get(j);
 				int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());