git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1433
6f19259b-4bc3-4df7-8a09-
765794883524
///\r
public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions;\r
\r
///\r
public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions;\r
\r
- private SurfaceAreaQuery saq = null;\r
- \r
- public FfsProcess(SurfaceAreaQuery saq) {\r
- this.saq = saq;\r
- }\r
- \r
/**\r
search in the type, if componentType is listed in type, return true; \r
otherwise return false.\r
/**\r
search in the type, if componentType is listed in type, return true; \r
otherwise return false.\r
//\r
// Try to find Ffs layout from FPD file\r
//\r
//\r
// Try to find Ffs layout from FPD file\r
//\r
- saq.push(GlobalData.getFpdBuildOptions());\r
+ SurfaceAreaQuery saq = new SurfaceAreaQuery(GlobalData.getFpdBuildOptionsMap());\r
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs();\r
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs();\r
for (int i = 0; i < ffsArray.length; i++) {\r
if (isMatch(ffsArray[i].getFfsKey(), buildType)) {\r
ffsXmlObject = ffsArray[i];\r
for (int i = 0; i < ffsArray.length; i++) {\r
if (isMatch(ffsArray[i].getFfsKey(), buildType)) {\r
ffsXmlObject = ffsArray[i];\r
\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Task;\r
\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
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
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
/// 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
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
FpdParserTask fpdParserTask = new FpdParserTask();\r
fpdParserTask.setType(type);\r
fpdParserTask.setProject(getProject());\r
}\r
activePlatform = str;\r
}\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
}\r
catch (Exception ex) {\r
throw new BuildException(ex.getMessage());\r
/// Module surface area file.\r
///\r
File msaFile;\r
/// Module surface area file.\r
///\r
File msaFile;\r
+ \r
+ public ModuleIdentification parentId;\r
+ \r
private String type = "all"; \r
\r
///\r
private String type = "all"; \r
\r
///\r
.replaceFirst("IA32", "Ia32")\r
.replaceFirst("ARM", "Arm")\r
.replaceFirst("EBC", "Ebc");\r
.replaceFirst("IA32", "Ia32")\r
.replaceFirst("ARM", "Arm")\r
.replaceFirst("EBC", "Ebc");\r
+ }\r
+ \r
+ \r
+ public void setExternalProperties(Vector<Property> v) {\r
+ this.properties = v;\r
+ }\r
Error throws during BaseName_build.xml generating. \r
**/\r
public void genBuildFile(String buildFilename) throws BuildException {\r
Error throws during BaseName_build.xml generating. \r
**/\r
public void genBuildFile(String buildFilename) throws BuildException {\r
- FfsProcess fp = new FfsProcess(saq);\r
+ FfsProcess fp = new FfsProcess();\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
try {\r
DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
try {\r
DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
//\r
// Parse all sourfiles but files specified in sections\r
//\r
//\r
// Parse all sourfiles but files specified in sections\r
//\r
- applyLibraryInstance(document, ele);\r
+ if (!FrameworkBuildTask.multithread) {\r
+ applyLibraryInstance(document, ele);\r
+ }\r
root.appendChild(ele);\r
\r
//\r
root.appendChild(ele);\r
\r
//\r
\r
private File fpdFile = null;\r
\r
\r
private File fpdFile = null;\r
\r
- private PlatformIdentification platformId;\r
+ PlatformIdentification platformId;\r
\r
private String type;\r
\r
///\r
/// Mapping from modules identification to out put file name\r
///\r
\r
private String type;\r
\r
///\r
/// Mapping from modules identification to out put file name\r
///\r
- private Map<FpdModuleIdentification, String> outfiles = new LinkedHashMap<FpdModuleIdentification, String>();\r
+ Map<FpdModuleIdentification, String> outfiles = new LinkedHashMap<FpdModuleIdentification, String>();\r
\r
///\r
/// Mapping from FV name to its modules\r
///\r
\r
///\r
/// Mapping from FV name to its modules\r
///\r
- private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();\r
+ Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();\r
\r
///\r
/// FpdParserTask can specify some ANT properties.\r
\r
///\r
/// FpdParserTask can specify some ANT properties.\r
\r
SurfaceAreaQuery saq = null;\r
\r
\r
SurfaceAreaQuery saq = null;\r
\r
- private boolean isUnified = true;\r
+ boolean isUnified = true;\r
\r
/**\r
Public construct method. It is necessary for ANT task.\r
\r
/**\r
Public construct method. It is necessary for ANT task.\r
@throws BuildException\r
File write FV.inf files error.\r
**/\r
@throws BuildException\r
File write FV.inf files error.\r
**/\r
- private void genFvInfFiles(String ffsCommonDir) throws BuildException {\r
+ void genFvInfFiles(String ffsCommonDir) throws BuildException {\r
String[] validFv = saq.getFpdValidImageNames();\r
for (int i = 0; i < validFv.length; i++) {\r
//\r
String[] validFv = saq.getFpdValidImageNames();\r
for (int i = 0; i < validFv.length; i++) {\r
//\r
@throws BuildException\r
FPD file is not valid.\r
**/\r
@throws BuildException\r
FPD file is not valid.\r
**/\r
- private void parseFpdFile() throws BuildException {\r
+ void parseFpdFile() throws BuildException {\r
try {\r
XmlObject doc = XmlObject.Factory.parse(fpdFile);\r
\r
try {\r
XmlObject doc = XmlObject.Factory.parse(fpdFile);\r
\r
/**\r
Parse all modules listed in FPD file.\r
**/\r
/**\r
Parse all modules listed in FPD file.\r
**/\r
- private void parseModuleSAFiles() throws EdkException{\r
+ void parseModuleSAFiles() throws EdkException{\r
Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();\r
\r
//\r
Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();\r
\r
//\r
- private ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {\r
+ ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {\r
String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);\r
if (options == null || options.length == 0) {\r
return new ToolChainMap();\r
String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);\r
if (options == null || options.length == 0) {\r
return new ToolChainMap();\r
@param fvName current FV name\r
@param moduleName current module identification\r
**/\r
@param fvName current FV name\r
@param moduleName current module identification\r
**/\r
- private void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {\r
+ void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {\r
if (fvName == null || fvName.trim().length() == 0) {\r
fvName = "NULL";\r
}\r
if (fvName == null || fvName.trim().length() == 0) {\r
fvName = "NULL";\r
}\r
\r
private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
\r
\r
private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
\r
+ private static Map<String, XmlObject> fpdBuildOptionsMap = new HashMap<String, XmlObject>();\r
+ \r
private static XmlObject fpdBuildOptions;\r
\r
private static XmlObject fpdDynamicPcds;\r
private static XmlObject fpdBuildOptions;\r
\r
private static XmlObject fpdDynamicPcds;\r
- public static Map<String, XmlObject> getFpdBuildOptions() {\r
- Map<String, XmlObject> map = new HashMap<String, XmlObject>();\r
- map.put("BuildOptions", fpdBuildOptions);\r
- return map;\r
+ public static Map<String, XmlObject> getFpdBuildOptionsMap() {\r
+ return fpdBuildOptionsMap;\r
}\r
\r
public static void setFpdBuildOptions(XmlObject fpdBuildOptions) {\r
GlobalData.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);\r
}\r
\r
public static void setFpdBuildOptions(XmlObject fpdBuildOptions) {\r
GlobalData.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);\r
+ fpdBuildOptionsMap.put("BuildOptions", GlobalData.fpdBuildOptions);\r
}\r
\r
public static XmlObject getFpdDynamicPcds() {\r
}\r
\r
public static XmlObject getFpdDynamicPcds() {\r
///\r
/// cache the modified timestamp of files accessed, to speed up the depencey check\r
/// \r
///\r
/// cache the modified timestamp of files accessed, to speed up the depencey check\r
/// \r
- private static Map<String, Long> timeStampCache = new HashMap<String, Long>();\r
+ private Map<String, Long> timeStampCache = new HashMap<String, Long>();\r
///\r
/// source files list\r
///\r
///\r
/// source files list\r
///\r