diff options
author | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-04 03:49:31 +0000 |
---|---|---|
committer | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-04 03:49:31 +0000 |
commit | 19bf6b15d0dd0a61a0835714c09a4e707e7cd518 (patch) | |
tree | 7f6c0664a656b6a4dc90b0429c78b8fa2b1c8956 /Tools/Source/GenBuild | |
parent | 534089527b1bbaf45305bec95c2c2a263a9ae424 (diff) | |
download | edk2-platforms-19bf6b15d0dd0a61a0835714c09a4e707e7cd518.tar.xz |
Add thread control classes. (2)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1433 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/GenBuild')
7 files changed, 70 insertions, 26 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index 66ad11ab55..ed94da38ed 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -84,12 +84,6 @@ public class FfsProcess { ///
public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions;
- private SurfaceAreaQuery saq = null;
-
- public FfsProcess(SurfaceAreaQuery saq) {
- this.saq = saq;
- }
-
/**
search in the type, if componentType is listed in type, return true;
otherwise return false.
@@ -121,9 +115,8 @@ public class FfsProcess { //
// Try to find Ffs layout from FPD file
//
- saq.push(GlobalData.getFpdBuildOptions());
+ SurfaceAreaQuery saq = new SurfaceAreaQuery(GlobalData.getFpdBuildOptionsMap());
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs();
- saq.pop();
for (int i = 0; i < ffsArray.length; i++) {
if (isMatch(ffsArray[i].getFfsKey(), buildType)) {
ffsXmlObject = ffsArray[i];
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java index dc12f6e23e..07da77c2bc 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java @@ -23,6 +23,7 @@ import java.util.Set; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
+import org.tianocore.build.fpd.FpdParserForThread;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.PropertyManager;
@@ -82,6 +83,16 @@ public class FrameworkBuildTask extends Task{ String activePlatform = null;
///
+ /// The flag to present current is multi-thread enabled
+ ///
+ public static boolean multithread = false;
+
+ ///
+ /// The concurrent thread number
+ ///
+ public static int MAX_CONCURRENT_THREAD_NUMBER = 1;
+
+ ///
/// there are three type: all (build), clean and cleanall
///
private String type = "all";
@@ -175,6 +186,19 @@ public class FrameworkBuildTask extends Task{ //
if (buildFile.getName().endsWith(ToolDefinitions.FPD_EXTENSION)) {
System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> ");
+ //
+ // Iff for platform build will enable the multi-thread if set in target.txt
+ //
+ if (multithread && type.equalsIgnoreCase("all")) {
+ System.out.println("Multi-thread build is enabled. ");
+ FpdParserForThread fpdParserForThread = new FpdParserForThread();
+ fpdParserForThread.setType(type);
+ fpdParserForThread.setProject(getProject());
+ fpdParserForThread.setFpdFile(buildFile);
+ fpdParserForThread.execute();
+ return ;
+ }
+
FpdParserTask fpdParserTask = new FpdParserTask();
fpdParserTask.setType(type);
fpdParserTask.setProject(getProject());
@@ -330,6 +354,23 @@ public class FrameworkBuildTask extends Task{ }
activePlatform = str;
}
+
+ str = getValue("MULTIPLE_THREAD", targetFileInfo);
+ if (str != null && str.trim().equalsIgnoreCase("Enable")) {
+ multithread = true;
+ }
+
+ str = getValue("MAX_CONCURRENT_THREAD_NUMBER", targetFileInfo);
+ if (str != null ) {
+ try {
+ int threadNum = Integer.parseInt(str);
+ if (threadNum > 0) {
+ MAX_CONCURRENT_THREAD_NUMBER = threadNum;
+ }
+ } catch (Exception enuma) {
+
+ }
+ }
}
catch (Exception ex) {
throw new BuildException(ex.getMessage());
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java index c5fb00b3e0..6230477445 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java @@ -97,7 +97,9 @@ public class GenBuildTask extends Ant { /// Module surface area file.
///
File msaFile;
-
+
+ public ModuleIdentification parentId;
+
private String type = "all";
///
@@ -783,5 +785,10 @@ public class GenBuildTask extends Ant { .replaceFirst("IA32", "Ia32")
.replaceFirst("ARM", "Arm")
.replaceFirst("EBC", "Ebc");
- }
+ }
+
+
+ public void setExternalProperties(Vector<Property> v) {
+ this.properties = v;
+ }
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java index 1bdae21245..122f04f3d3 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java +++ b/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java @@ -91,7 +91,7 @@ public class ModuleBuildFileGenerator { Error throws during BaseName_build.xml generating.
**/
public void genBuildFile(String buildFilename) throws BuildException {
- FfsProcess fp = new FfsProcess(saq);
+ FfsProcess fp = new FfsProcess();
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder dombuilder = domfac.newDocumentBuilder();
@@ -143,7 +143,9 @@ public class ModuleBuildFileGenerator { //
// Parse all sourfiles but files specified in sections
//
- applyLibraryInstance(document, ele);
+ if (!FrameworkBuildTask.multithread) {
+ applyLibraryInstance(document, ele);
+ }
root.appendChild(ele);
//
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java index 8a90ea563d..c044856de3 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java @@ -77,19 +77,19 @@ public class FpdParserTask extends Task { private File fpdFile = null;
- private PlatformIdentification platformId;
+ PlatformIdentification platformId;
private String type;
///
/// Mapping from modules identification to out put file name
///
- private Map<FpdModuleIdentification, String> outfiles = new LinkedHashMap<FpdModuleIdentification, String>();
+ Map<FpdModuleIdentification, String> outfiles = new LinkedHashMap<FpdModuleIdentification, String>();
///
/// Mapping from FV name to its modules
///
- private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
+ Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
///
/// FpdParserTask can specify some ANT properties.
@@ -98,7 +98,7 @@ public class FpdParserTask extends Task { SurfaceAreaQuery saq = null;
- private boolean isUnified = true;
+ boolean isUnified = true;
/**
Public construct method. It is necessary for ANT task.
@@ -195,7 +195,7 @@ public class FpdParserTask extends Task { @throws BuildException
File write FV.inf files error.
**/
- private void genFvInfFiles(String ffsCommonDir) throws BuildException {
+ void genFvInfFiles(String ffsCommonDir) throws BuildException {
String[] validFv = saq.getFpdValidImageNames();
for (int i = 0; i < validFv.length; i++) {
//
@@ -318,7 +318,7 @@ public class FpdParserTask extends Task { @throws BuildException
FPD file is not valid.
**/
- private void parseFpdFile() throws BuildException {
+ void parseFpdFile() throws BuildException {
try {
XmlObject doc = XmlObject.Factory.parse(fpdFile);
@@ -381,7 +381,7 @@ public class FpdParserTask extends Task { /**
Parse all modules listed in FPD file.
**/
- private void parseModuleSAFiles() throws EdkException{
+ void parseModuleSAFiles() throws EdkException{
Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();
//
@@ -429,7 +429,7 @@ public class FpdParserTask extends Task { }
}
- private ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
+ ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);
if (options == null || options.length == 0) {
return new ToolChainMap();
@@ -475,7 +475,7 @@ public class FpdParserTask extends Task { @param fvName current FV name
@param moduleName current module identification
**/
- private void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {
+ void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {
if (fvName == null || fvName.trim().length() == 0) {
fvName = "NULL";
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index 7e1e2c6852..45f36ee1fa 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -87,6 +87,8 @@ public class GlobalData { private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
+ private static Map<String, XmlObject> fpdBuildOptionsMap = new HashMap<String, XmlObject>();
+
private static XmlObject fpdBuildOptions;
private static XmlObject fpdDynamicPcds;
@@ -416,14 +418,13 @@ public class GlobalData { }
}
- public static Map<String, XmlObject> getFpdBuildOptions() {
- Map<String, XmlObject> map = new HashMap<String, XmlObject>();
- map.put("BuildOptions", fpdBuildOptions);
- return map;
+ public static Map<String, XmlObject> getFpdBuildOptionsMap() {
+ return fpdBuildOptionsMap;
}
public static void setFpdBuildOptions(XmlObject fpdBuildOptions) {
GlobalData.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);
+ fpdBuildOptionsMap.put("BuildOptions", GlobalData.fpdBuildOptions);
}
public static XmlObject getFpdDynamicPcds() {
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/OnDependency.java b/Tools/Source/GenBuild/org/tianocore/build/global/OnDependency.java index 4177b50466..6f845ea371 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/OnDependency.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/OnDependency.java @@ -31,7 +31,7 @@ public class OnDependency extends Task { ///
/// cache the modified timestamp of files accessed, to speed up the depencey check
///
- private static Map<String, Long> timeStampCache = new HashMap<String, Long>();
+ private Map<String, Long> timeStampCache = new HashMap<String, Long>();
///
/// source files list
///
|