Disp dependencies in error in case of circular dependency
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / autogen / AutogenLibOrder.java
index 37c54f5..042f044 100644 (file)
@@ -231,17 +231,28 @@ public class AutogenLibOrder {
         //\r
         // Append the remaining library instance to the end of sorted list\r
         //\r
+       boolean HasError = false;\r
         for (int i = 0; i < libInstanceList.length; ++i) {\r
-            if (libInstanceConsumedBy.get(libInstanceList[i]).size() > 0 && libInstanceList[i].hasConstructor()) {\r
+           HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(libInstanceList[i]);\r
+            if (consumedBy.size() > 0 && libInstanceList[i].hasConstructor()) {\r
                 EdkLog.log(EdkLog.EDK_ERROR, libInstanceList[i].getName()\r
                            + " with constructor has a circular dependency!");\r
-                throw new AutoGenException("Circular dependency in library instances is found!");\r
+               ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);\r
+               for (int j = 0; j < consumedByList.length; ++j) {\r
+                   EdkLog.log(EdkLog.EDK_ERROR,\r
+                              " consumed by " + consumedByList[j].getName());\r
+               }\r
+               HasError = true;\r
             }\r
 \r
             if (!orderList.contains(libInstanceList[i])) {\r
                 orderList.add(libInstanceList[i]);\r
             }\r
         }\r
+       if (HasError) {\r
+           throw new AutoGenException("Circular dependency in library instances is found!");\r
+       }\r
+\r
         return orderList;\r
     }\r
 }\r