\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Task;\r
+import org.tianocore.build.fpd.FpdParserForThread;\r
import org.tianocore.build.fpd.FpdParserTask;\r
import org.tianocore.build.global.GlobalData;\r
import org.tianocore.build.global.PropertyManager;\r
\r
String activePlatform = null;\r
\r
+ ///\r
+ /// The flag to present current is multi-thread enabled\r
+ ///\r
+ public static boolean multithread = false;\r
+ \r
+ ///\r
+ /// The concurrent thread number\r
+ ///\r
+ public static int MAX_CONCURRENT_THREAD_NUMBER = 1;\r
+ \r
///\r
/// there are three type: all (build), clean and cleanall\r
///\r
//\r
if (buildFile.getName().endsWith(ToolDefinitions.FPD_EXTENSION)) {\r
System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> ");\r
+ //\r
+ // Iff for platform build will enable the multi-thread if set in target.txt\r
+ //\r
+ if (multithread && type.equalsIgnoreCase("all")) {\r
+ System.out.println("Multi-thread build is enabled. ");\r
+ FpdParserForThread fpdParserForThread = new FpdParserForThread();\r
+ fpdParserForThread.setType(type);\r
+ fpdParserForThread.setProject(getProject());\r
+ fpdParserForThread.setFpdFile(buildFile);\r
+ fpdParserForThread.execute();\r
+ return ;\r
+ }\r
+ \r
FpdParserTask fpdParserTask = new FpdParserTask();\r
fpdParserTask.setType(type);\r
fpdParserTask.setProject(getProject());\r
}\r
activePlatform = str;\r
}\r
+ \r
+ str = getValue("MULTIPLE_THREAD", targetFileInfo);\r
+ if (str != null && str.trim().equalsIgnoreCase("Enable")) {\r
+ multithread = true;\r
+ }\r
+ \r
+ str = getValue("MAX_CONCURRENT_THREAD_NUMBER", targetFileInfo);\r
+ if (str != null ) {\r
+ try {\r
+ int threadNum = Integer.parseInt(str);\r
+ if (threadNum > 0) {\r
+ MAX_CONCURRENT_THREAD_NUMBER = threadNum;\r
+ }\r
+ } catch (Exception enuma) {\r
+ \r
+ }\r
+ }\r
}\r
catch (Exception ex) {\r
throw new BuildException(ex.getMessage());\r