]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
Adding new Logger instead of Ant's.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / fpd / FpdParserForThread.java
index 11e926b251a9e27f7f9c6311dfd6ba7254e07d7b..66d188383bd5e5395e96bd9f51ea96f2c33996f6 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.Ant;\r
 import org.apache.xmlbeans.XmlObject;\r
 \r
+import org.tianocore.build.global.GenBuildLogger;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.OutputManager;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
@@ -60,6 +61,10 @@ public class FpdParserForThread extends FpdParserTask {
     \r
     public static int currentRunNumber = 0;\r
     \r
+    public static int totalNumber = 0;\r
+    \r
+    public static int remainNumber = 0;\r
+    \r
     /**\r
       Public construct method. It is necessary for ANT task.\r
     **/\r
@@ -71,6 +76,8 @@ public class FpdParserForThread extends FpdParserTask {
 \r
     **/\r
     public void execute() throws BuildException {\r
+        \r
+        this.setTaskName(".........");\r
         //\r
         // Parse FPD file\r
         //\r
@@ -93,7 +100,7 @@ public class FpdParserForThread extends FpdParserTask {
                 // Prepare FV_DIR\r
                 //\r
                 String ffsCommonDir = buildDir + File.separatorChar\r
-                                + targetList[i] + File.separatorChar\r
+                                + targetList[i] + "_"\r
                                 + toolchainList[j];\r
                 File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");\r
                 fvDir.mkdirs();\r
@@ -144,8 +151,10 @@ public class FpdParserForThread extends FpdParserTask {
         ant.init();\r
         ant.execute();\r
         \r
-        EdkLog.log(this, "Task number is " + allThreads.size());\r
+        remainNumber = totalNumber = allThreads.size();\r
         \r
+        EdkLog.log(this, EdkLog.EDK_ALWAYS, "Total thread number is " + totalNumber);\r
+        GenBuildLogger.setCacheEnable(true);\r
         //\r
         // Waiting for all thread over, or time out\r
         //\r
@@ -161,6 +170,9 @@ public class FpdParserForThread extends FpdParserTask {
                 if (currentQueueCode >= queueList.size()) {\r
                     break ;\r
                 }\r
+                \r
+                int percentage = (totalNumber - remainNumber) * 100 / totalNumber;\r
+                EdkLog.log(this, EdkLog.EDK_ALWAYS, percentage + "% finished. Has built " + (totalNumber - remainNumber) + " modules of " + totalNumber + " total. ");\r
 \r
                 Set<FpdModuleIdentification> currentQueueModules = fvs.get(queueList.get(currentQueueCode));\r
                 \r
@@ -192,35 +204,37 @@ public class FpdParserForThread extends FpdParserTask {
                     //\r
                     // Exist ready thread\r
                     //\r
-                    EdkLog.log(this, "## Exist ready thread");\r
+//                    EdkLog.log(this, EdkLog.EDK_ALWAYS, "Exist ready thread");\r
 \r
                 } else if (existNoneReady && currentRunNumber == 0) {\r
                     //\r
                     // No active thread, but still have dependency not read thread\r
                     //\r
-                    throw new BuildException("Found can't resolve dependencies. ");\r
+                    throw new BuildException("Existing some modules can't resolve depedencies. ");\r
                 } else if (!existNoneReady && currentRunNumber == 0) {\r
                     //\r
                     // Current queue build finish, move to next\r
                     //\r
-                    EdkLog.log(this, "## Current queue build finish, move to next");\r
+                    EdkLog.log(this, EdkLog.EDK_ALWAYS, "Current queue build finish, move to next");\r
                     ++currentQueueCode;\r
                     continue ;\r
                 } else {\r
                     //\r
                     // active thread exist, but no ready thread\r
                     //\r
-                    EdkLog.log(this, "## active thread exist, but no ready thread" + currentRunNumber);\r
+                    EdkLog.log(this, EdkLog.EDK_ALWAYS, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber);\r
                 }\r
 \r
                 try {\r
                     deamonSemaphore.wait();\r
-                } catch (InterruptedException e) {\r
-                   e.printStackTrace();\r
+                } catch (InterruptedException ex) {\r
+                    BuildException e = new BuildException("Thread wait Error. \n" + ex.getMessage());\r
+                    e.setStackTrace(ex.getStackTrace());\r
+                    throw e;\r
                 }\r
             }\r
         }\r
-        \r
+        GenBuildLogger.setCacheEnable(false);\r
         //\r
         // call fvs, postbuild\r
         //\r
@@ -240,6 +254,8 @@ public class FpdParserForThread extends FpdParserTask {
         ant.init();\r
         ant.execute();\r
         \r
+        EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log"));\r
+        \r
     }\r
 \r
     \r
@@ -358,6 +374,7 @@ public class FpdParserForThread extends FpdParserTask {
     public synchronized static void subCount() {\r
         synchronized (countSemaphore) {\r
             --currentRunNumber;\r
+            --remainNumber;\r
         }\r
     }\r
 }\r