X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Ffpd%2FFpdParserForThread.java;h=aa0ebe51b64f5553a8240d8505b3e62c87348f7b;hb=bb511931b16d173f20394f19d2b87bd7dbde3182;hp=66d188383bd5e5395e96bd9f51ea96f2c33996f6;hpb=2eb7d78dcd8adfa6670457957c9defd4b2419a0a;p=mirror_edk2.git diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java index 66d188383b..aa0ebe51b6 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java @@ -45,9 +45,9 @@ public class FpdParserForThread extends FpdParserTask { List queueList = new ArrayList(); - public static Object deamonSemaphore = new Object(); + public final static Object deamonSemaphore = new Object(); - static Object countSemaphore = new Object(); + private final static Object countSemaphore = new Object(); public static int STATUS_DEPENDENCY_NOT_READY = 1; @@ -65,6 +65,10 @@ public class FpdParserForThread extends FpdParserTask { public static int remainNumber = 0; + public static ThreadGroup tg = new ThreadGroup("Framework"); + + public static FpdModuleIdentification errorModule = null; + /** Public construct method. It is necessary for ANT task. **/ @@ -159,10 +163,7 @@ public class FpdParserForThread extends FpdParserTask { // Waiting for all thread over, or time out // synchronized (deamonSemaphore) { - // - // Initialize BUGBUG - // - + while (true) { // // If all modules are already built @@ -204,7 +205,7 @@ public class FpdParserForThread extends FpdParserTask { // // Exist ready thread // -// EdkLog.log(this, EdkLog.EDK_ALWAYS, "Exist ready thread"); + EdkLog.log(this, EdkLog.EDK_DEBUG, "Exist ready thread"); } else if (existNoneReady && currentRunNumber == 0) { // @@ -215,18 +216,35 @@ public class FpdParserForThread extends FpdParserTask { // // Current queue build finish, move to next // - EdkLog.log(this, EdkLog.EDK_ALWAYS, "Current queue build finish, move to next"); + EdkLog.log(this, EdkLog.EDK_DEBUG, "Current queue build finish, move to next"); ++currentQueueCode; continue ; } else { // // active thread exist, but no ready thread // - EdkLog.log(this, EdkLog.EDK_ALWAYS, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber); + EdkLog.log(this, EdkLog.EDK_DEBUG, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber); } try { deamonSemaphore.wait(); + + // + // if find error. Waiting running threads to finish + // + if (errorModule != null) { + while (currentRunNumber > 0) { + deamonSemaphore.wait(); + } + + GenBuildLogger.setCacheEnable(false); + + GenBuildLogger.flushErrorModuleLog(errorModule); + + EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log")); + + throw new BuildException(errorModule + " build error. "); + } } catch (InterruptedException ex) { BuildException e = new BuildException("Thread wait Error. \n" + ex.getMessage()); e.setStackTrace(ex.getStackTrace()); @@ -234,6 +252,7 @@ public class FpdParserForThread extends FpdParserTask { } } } + GenBuildLogger.setCacheEnable(false); // // call fvs, postbuild @@ -255,7 +274,6 @@ public class FpdParserForThread extends FpdParserTask { ant.execute(); EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log")); - } @@ -277,10 +295,8 @@ public class FpdParserForThread extends FpdParserTask { // // Generate GenBuildThread // - GenBuildThread genBuildThread = new GenBuildThread(); - genBuildThread.setArch(fpdModuleId.getArch()); + GenBuildThread genBuildThread = new GenBuildThread(fpdModuleId.getModule(), fpdModuleId.getArch()); genBuildThread.setParentModuleId(null); - genBuildThread.setModuleId(fpdModuleId.getModule()); genBuildThread.setProject(getProject()); Set dependencies = new LinkedHashSet(); @@ -305,10 +321,8 @@ public class FpdParserForThread extends FpdParserTask { // // Create thread for library instances // - GenBuildThread liBuildThread = new GenBuildThread(); - liBuildThread.setArch(fpdModuleId.getArch()); + GenBuildThread liBuildThread = new GenBuildThread(libinstances[i], fpdModuleId.getArch()); liBuildThread.setParentModuleId(fpdModuleId.getModule()); - liBuildThread.setModuleId(libinstances[i]); liBuildThread.setProject(getProject()); liBuildThread.setStatus(STATUS_DEPENDENCY_READY); liBuildThread.setHighPriority(true); @@ -317,7 +331,8 @@ public class FpdParserForThread extends FpdParserTask { updateFvs("libqueue", libFpdModuleId); } - genBuildThread.setDependencies(dependencies); + genBuildThread.setDependencies(dependencies); + // if (dependencies.size() == 0) { genBuildThread.setStatus(STATUS_DEPENDENCY_READY); // }