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/18 07:56:10 UTC

[royale-compiler] branch develop updated: report circulars to console

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


The following commit(s) were added to refs/heads/develop by this push:
     new 10be2e8  report circulars to console
10be2e8 is described below

commit 10be2e88f31aa37b573612eb21a82105ea3df307
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Dec 17 23:55:50 2018 -0800

    report circulars to console
---
 .../compiler/internal/projects/DependencyGraph.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/DependencyGraph.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/DependencyGraph.java
index a7fa031..3c38fb0 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/DependencyGraph.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/DependencyGraph.java
@@ -33,6 +33,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 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.exceptions.CircularDependencyException;
 import org.apache.royale.compiler.internal.graph.Graph;
 import org.apache.royale.compiler.internal.graph.GraphEdge;
@@ -43,6 +44,7 @@ import org.apache.royale.compiler.internal.units.InvisibleCompilationUnit;
 import org.apache.royale.compiler.units.ICompilationUnit;
 import com.google.common.base.Function;
 import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Class to track dependencies in a {@link CompilerProject}.
@@ -549,6 +551,22 @@ public final class DependencyGraph
             }
             catch (CircularDependencyException e1)
             {
+    			if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.GOOG_DEPS) == CompilerDiagnosticsConstants.GOOG_DEPS)
+    			{
+    				System.out.println("Circular Dependency Found");
+    				@SuppressWarnings("unchecked")
+					ImmutableList<ICompilationUnit> nodes = (ImmutableList<ICompilationUnit>) e1.getCircularDependency();
+    				for (ICompilationUnit node : nodes)
+    				{
+    					try {
+							System.out.println(node.getQualifiedNames().toString());
+						} catch (InterruptedException e2) {
+							// TODO Auto-generated catch block
+							e2.printStackTrace();
+						}
+    				}
+    				System.out.println("End of Circular Dependency");
+    			}
                 assert false : "CircularDependencyException";
             }
             return sortedList;