summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java5
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java8
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/GenBuildThread.java15
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java25
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java11
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java35
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java174
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java6
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java137
-rwxr-xr-xTools/bin/build2
-rw-r--r--Tools/bin/build.bat2
13 files changed, 307 insertions, 117 deletions
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
index 84f9176e78..46a0ec6677 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
@@ -42,6 +42,8 @@ public class CompressSection implements Section, FfsTypes{
//
List<Object> SectList = new ArrayList<Object>();
+ public static Object semaphore = new Object();
+
/**
toBuffer
@@ -85,6 +87,8 @@ public class CompressSection implements Section, FfsTypes{
}
Do.close();
+
+ synchronized (semaphore) {
//
// Call compress
//
@@ -144,6 +148,7 @@ public class CompressSection implements Section, FfsTypes{
//
//di.close();
//compressOut.delete();
+ }
}
catch (Exception e){
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
index 702c28fee7..a098719073 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
@@ -154,11 +154,9 @@ public class FfsProcess {
}
Vector<String> sectionList = new Vector<String>();
XmlCursor cursor = null;
- try {
- cursor = ffsXmlObject.newCursor();
- } catch (Exception e) {
- return null;
- }
+
+ cursor = ffsXmlObject.newCursor();
+
int mode = MODE_NONE;
Element genffsfileEle = document.createElement("genffsfile");
genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
index 6d380d9654..45a46b0fe6 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
@@ -420,7 +420,7 @@ public class FrameworkBuildTask extends Task{
if (str != null && str.trim().equalsIgnoreCase("Enable")) {
multithread = true;
}
-
+
str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);
if (str != null ) {
try {
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index da866aaa6e..a541f87779 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
@@ -581,7 +581,7 @@ public class GenBuildTask extends Ant {
//
// Call AutoGen to generate AutoGen.c and AutoGen.h
//
- AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq);
+ AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq, parentId);
autogen.genAutogen();
//
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildThread.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildThread.java
index 08e46500fa..cce4e33135 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildThread.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildThread.java
@@ -131,7 +131,16 @@ public class GenBuildThread implements Runnable {
Iterator listenerIter = project.getBuildListeners().iterator();
while (listenerIter.hasNext()) {
- newProject.addBuildListener((BuildListener) listenerIter.next());
+ BuildListener item = (BuildListener) listenerIter.next();
+
+// if (item instanceof BuildLogger) {
+// BuildLogger newLogger = new GenBuildLogger(newProject);
+// BuildLogger oldLogger = (BuildLogger)item;
+// newLogger.setEmacsMode(true);
+// EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, "########");
+// } else {
+ newProject.addBuildListener(item);
+// }
}
project.initSubProject(newProject);
@@ -145,8 +154,8 @@ public class GenBuildThread implements Runnable {
genBuildTask.perform();
status = FpdParserForThread.STATUS_END_RUN;
-
- EdkLog.log("GenBuildThread", fpdModuleId + " build finished. ");
+
+ EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, fpdModuleId + " build finished. ");
//
//
diff --git a/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java
index f8c78b848e..c02bc1fce8 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java
@@ -14,21 +14,26 @@ package org.tianocore.build;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import org.tianocore.build.exception.GenBuildException;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.FpdModuleIdentification;
@@ -90,7 +95,7 @@ public class ModuleBuildFileGenerator {
@throws BuildException
Error throws during BaseName_build.xml generating.
**/
- public void genBuildFile(String buildFilename) throws BuildException {
+ public void genBuildFile(String buildFilename) throws GenBuildException, EdkException {
FfsProcess fp = new FfsProcess();
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try {
@@ -229,8 +234,22 @@ public class ModuleBuildFileGenerator {
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.transform(source, result);
- } catch (Exception ex) {
- throw new BuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
+ } catch (ParserConfigurationException ex) {
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
+ e.setStackTrace(ex.getStackTrace());
+ throw e;
+ } catch (FileNotFoundException ex) {
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
+ e.setStackTrace(ex.getStackTrace());
+ throw e;
+ } catch (TransformerConfigurationException ex) {
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
+ e.setStackTrace(ex.getStackTrace());
+ throw e;
+ } catch (TransformerException ex) {
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
+ e.setStackTrace(ex.getStackTrace());
+ throw e;
}
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
index cf83a871c5..d867593244 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
@@ -118,6 +118,8 @@ public class AutoGen {
private List<String> exitBootServiceList = new ArrayList<String>();
private SurfaceAreaQuery saq = null;
+
+ private ModuleIdentification parentId = null;
/**
Construct function
@@ -133,12 +135,13 @@ public class AutoGen {
@param arch
Target architecture.
**/
- public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq) {
+ public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq, ModuleIdentification parentId) {
this.outputPath = outputPath;
this.moduleId = moduleId;
this.arch = arch;
this.fvDir = fvDir;
this.saq = saq;
+ this.parentId = parentId;
}
/**
@@ -496,7 +499,8 @@ public class AutoGen {
arch,
false,
null,
- pcdDriverType);
+ pcdDriverType,
+ parentId);
this.myPcdAutogen.execute();
if (this.myPcdAutogen != null) {
@@ -653,7 +657,8 @@ public class AutoGen {
arch,
true,
saq.getModulePcdEntryNameArray(),
- pcdDriverType);
+ pcdDriverType,
+ parentId);
this.myPcdAutogen.execute();
if (this.myPcdAutogen != null) {
fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
index 11e926b251..66d188383b 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
@@ -25,6 +25,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.xmlbeans.XmlObject;
+import org.tianocore.build.global.GenBuildLogger;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.OutputManager;
import org.tianocore.build.id.FpdModuleIdentification;
@@ -60,6 +61,10 @@ public class FpdParserForThread extends FpdParserTask {
public static int currentRunNumber = 0;
+ public static int totalNumber = 0;
+
+ public static int remainNumber = 0;
+
/**
Public construct method. It is necessary for ANT task.
**/
@@ -71,6 +76,8 @@ public class FpdParserForThread extends FpdParserTask {
**/
public void execute() throws BuildException {
+
+ this.setTaskName(".........");
//
// Parse FPD file
//
@@ -93,7 +100,7 @@ public class FpdParserForThread extends FpdParserTask {
// Prepare FV_DIR
//
String ffsCommonDir = buildDir + File.separatorChar
- + targetList[i] + File.separatorChar
+ + targetList[i] + "_"
+ toolchainList[j];
File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
fvDir.mkdirs();
@@ -144,8 +151,10 @@ public class FpdParserForThread extends FpdParserTask {
ant.init();
ant.execute();
- EdkLog.log(this, "Task number is " + allThreads.size());
+ remainNumber = totalNumber = allThreads.size();
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Total thread number is " + totalNumber);
+ GenBuildLogger.setCacheEnable(true);
//
// Waiting for all thread over, or time out
//
@@ -161,6 +170,9 @@ public class FpdParserForThread extends FpdParserTask {
if (currentQueueCode >= queueList.size()) {
break ;
}
+
+ int percentage = (totalNumber - remainNumber) * 100 / totalNumber;
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, percentage + "% finished. Has built " + (totalNumber - remainNumber) + " modules of " + totalNumber + " total. ");
Set<FpdModuleIdentification> currentQueueModules = fvs.get(queueList.get(currentQueueCode));
@@ -192,35 +204,37 @@ public class FpdParserForThread extends FpdParserTask {
//
// Exist ready thread
//
- EdkLog.log(this, "## Exist ready thread");
+// EdkLog.log(this, EdkLog.EDK_ALWAYS, "Exist ready thread");
} else if (existNoneReady && currentRunNumber == 0) {
//
// No active thread, but still have dependency not read thread
//
- throw new BuildException("Found can't resolve dependencies. ");
+ throw new BuildException("Existing some modules can't resolve depedencies. ");
} else if (!existNoneReady && currentRunNumber == 0) {
//
// Current queue build finish, move to next
//
- EdkLog.log(this, "## Current queue build finish, move to next");
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Current queue build finish, move to next");
++currentQueueCode;
continue ;
} else {
//
// active thread exist, but no ready thread
//
- EdkLog.log(this, "## active thread exist, but no ready thread" + currentRunNumber);
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber);
}
try {
deamonSemaphore.wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
+ } catch (InterruptedException ex) {
+ BuildException e = new BuildException("Thread wait Error. \n" + ex.getMessage());
+ e.setStackTrace(ex.getStackTrace());
+ throw e;
}
}
}
-
+ GenBuildLogger.setCacheEnable(false);
//
// call fvs, postbuild
//
@@ -240,6 +254,8 @@ public class FpdParserForThread extends FpdParserTask {
ant.init();
ant.execute();
+ EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log"));
+
}
@@ -358,6 +374,7 @@ public class FpdParserForThread extends FpdParserTask {
public synchronized static void subCount() {
synchronized (countSemaphore) {
--currentRunNumber;
+ --remainNumber;
}
}
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
index 5b16c6d674..0af9d9f1e8 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
@@ -18,52 +18,63 @@
package org.tianocore.build.global;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.StringUtils;
+import org.tianocore.build.id.Identification;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.common.logger.LogMethod;
-public class GenBuildLogger implements LogMethod {
+public class GenBuildLogger extends DefaultLogger implements LogMethod {
+
private Project project = null;
///
/// flag to present whether cache all msg or not
- /// true means not to cache.
+ /// true means to cache.
///
- private boolean flag = true;
+ private static boolean flag = false;
- private List<String> v = null;
+ private static Map<Identification, List<String>> map = new HashMap<Identification, List<String> >(256);
+
+ private Identification id = null;
+
+ public GenBuildLogger () {
+
+ }
public GenBuildLogger (Project project) {
this.project = project;
}
- public GenBuildLogger (Project project, boolean flag) {
+ public GenBuildLogger (Project project, Identification id) {
this.project = project;
- this.flag = flag;
-
- //
- // Only flag is false, v will be initialized and used.
- //
- if (!flag) {
- v = new Vector<String>(2048);
- }
+ this.id = id;
}
/**
- Rules: flag = true: means no cache Action: Print it to console
+ Rules: flag = false: means no cache Action: Print it to console
- flag = false: mean cache all msg exception some special Action: loglevel
+ flag = true: mean cache all msg exception some special Action: loglevel
is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and
cache the msg others -- No print and cache the msg
**/
- public synchronized void putMessage(Object msgSource, int msgLevel,
- String msg) {
+ public synchronized void putMessage(Object msgSource, int msgLevel, String msg) {
if (this.project == null) {
return;
}
@@ -73,61 +84,56 @@ public class GenBuildLogger implements LogMethod {
//
switch (msgLevel) {
case EdkLog.EDK_ALWAYS:
- log(msgSource, msg, Project.MSG_INFO);
+ //
+ // Do some special
+ //
+ log(msgSource, msg, Project.MSG_ERR);
break;
case EdkLog.EDK_ERROR:
- if (flag) {
- log(msgSource, msg, Project.MSG_ERR);
- } else {
- log(msgSource, msg, Project.MSG_ERR);
- v.add(msg);
- }
+ log(msgSource, msg, Project.MSG_ERR);
break;
case EdkLog.EDK_WARNING:
- if (flag) {
- log(msgSource, msg, Project.MSG_WARN);
- } else {
- v.add(msg);
- }
+ log(msgSource, msg, Project.MSG_WARN);
break;
case EdkLog.EDK_INFO:
- if (flag) {
- log(msgSource, msg, Project.MSG_INFO);
- } else {
- v.add(msg);
- }
+ log(msgSource, msg, Project.MSG_INFO);
break;
case EdkLog.EDK_VERBOSE:
- if (flag) {
- log(msgSource, msg, Project.MSG_VERBOSE);
- } else {
- v.add(msg);
- }
+ log(msgSource, msg, Project.MSG_VERBOSE);
break;
case EdkLog.EDK_DEBUG:
- if (flag) {
- log(msgSource, msg, Project.MSG_DEBUG);
- } else {
- v.add(msg);
- }
+ log(msgSource, msg, Project.MSG_DEBUG);
break;
}
}
public void flushToFile(File file) {
//
- // Sort msg and store to the file (TBD)
+ // Put all messages in map to file
//
-
+ String msg = "Writing log to file [" + file.getPath() + "]";
+ log("Logging", msg, Project.MSG_INFO);
+ try {
+ BufferedWriter bw = new BufferedWriter(new FileWriter(file));
+ List<String> allMessages = map.get(null);
+ for(int i = 0; i < allMessages.size(); i++) {
+ bw.write(allMessages.get(i));
+ bw.newLine();
+ }
+ bw.flush();
+ bw.close();
+ } catch (IOException e) {
+ new BuildException("Writing log error. " + e.getMessage());
+ }
+
}
private void log(Object msgSource, String msg, int level) {
if (msgSource instanceof Task) {
this.project.log((Task)msgSource, msg, level);
} else if (msgSource instanceof String){
-
//
- // Pad 12 space to keep message
+ // Pad 12 space to keep message in unify format
//
msg = msg.replaceAll("\n", "\n ");
this.project.log(String.format("%12s", "[" + msgSource + "] ") + msg, level);
@@ -135,4 +141,76 @@ public class GenBuildLogger implements LogMethod {
this.project.log(msg, level);
}
}
+ public void targetStarted(BuildEvent event) {
+ if (!flag) {
+ super.targetStarted(event);
+ }
+ }
+
+ public void messageLogged(BuildEvent event) {
+ int currentLevel = event.getPriority();
+ //
+ // If current level is upper than Ant Level, skip it
+ //
+ if (currentLevel <= this.msgOutputLevel) {
+ String originalMessage = event.getMessage();
+
+ StringBuffer message = new StringBuffer();
+ if (!emacsMode && event.getTask() != null) {
+ String label = String.format("%12s", "[" + event.getTask().getTaskName() + "] ");
+ //
+ // Append label first
+ //
+ message.append(label);
+
+ //
+ // Format all output message's line separator
+ //
+ try {
+ BufferedReader r = new BufferedReader(new StringReader(originalMessage));
+ boolean ifFirstLine = true;
+ String line = null;
+ while ((line = r.readLine()) != null) {
+ if (!ifFirstLine) {
+ message.append(StringUtils.LINE_SEP);
+ }
+ ifFirstLine = false;
+ message.append(line);
+ }
+ } catch (IOException e) {
+ message.append(originalMessage);
+ }
+ } else {
+ message.append(originalMessage);
+ }
+
+ String msg = message.toString();
+ if (currentLevel == Project.MSG_ERR) {
+ printMessage(msg, err, currentLevel);
+ } else if(currentLevel == Project.MSG_WARN) {
+ printMessage(msg, out, currentLevel);
+ } else if(!flag) {
+ printMessage(msg, out, currentLevel);
+ }
+
+ log(msg);
+ }
+ }
+
+ public static void setCacheEnable(boolean enable) {
+ flag = enable;
+ }
+
+ protected synchronized void log(String message) {
+ //
+ // cache log
+ //
+ if (map.containsKey(this.id)) {
+ map.get(this.id).add(message);
+ } else {
+ List<String> list = new Vector<String>(1024);
+ list.add(message);
+ map.put(this.id, list);
+ }
+ }
} \ No newline at end of file
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
index 52ba681f55..715e0ce34e 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
@@ -162,7 +162,7 @@ public class GlobalData {
// CONF dir + tools definition file name
//
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);
- EdkLog.log("Init", "Using tool definition file [" + toolsDefFile.getPath() + "].");
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Using tool definition file [" + toolsDefFile.getPath() + "].");
toolsDef = new ToolChainConfig(toolsDefFile);
@@ -686,8 +686,8 @@ public class GlobalData {
}
toolChainInfo.addCommands(toolsDef.getConfigInfo().getCommands());
toolChainInfo.normalize();
- EdkLog.log("Init", "Current build tool chain information summary: ");
- EdkLog.log("Init", toolChainInfo + "");
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Current build tool chain information summary: ");
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, toolChainInfo + "");
}
return toolChainInfo;
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
index f3213c8079..312e5e2136 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
@@ -21,6 +21,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.tianocore.build.FrameworkBuildTask;
import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.id.ModuleIdentification;
@@ -72,6 +73,7 @@ public class PCDAutoGenAction extends BuildAction {
///
private String[] pcdNameArrayInMsa;
+ private UsageIdentification parentId = null;
/**
Set parameter moduleId
@@ -142,7 +144,8 @@ public class PCDAutoGenAction extends BuildAction {
String arch,
boolean isBuildUsedLibrary,
String[] pcdNameArrayInMsa,
- CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {
+ CommonDefinition.PCD_DRIVER_TYPE pcdDriverType,
+ ModuleIdentification parentId) {
dbManager = null;
hAutoGenString = "";
cAutoGenString = "";
@@ -154,6 +157,15 @@ public class PCDAutoGenAction extends BuildAction {
arch,
moduleId.getVersion(),
moduleId.getModuleType()));
+ if (parentId != null) {
+ this.parentId = new UsageIdentification(parentId.getName(),
+ parentId.getGuid(),
+ parentId.getPackage().getName(),
+ parentId.getPackage().getGuid(),
+ arch,
+ parentId.getVersion(),
+ parentId.getModuleType());
+ }
setIsBuildUsedLibrary(isBuildUsedLibrary);
setPcdNameArrayInMsa(pcdNameArrayInMsa);
setPcdDriverType(pcdDriverType);
@@ -211,53 +223,100 @@ public class PCDAutoGenAction extends BuildAction {
boolean found = false;
usageInstanceArray = null;
- if (!isBuildUsedLibrary) {
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;
- MemoryDatabaseManager.CurrentModuleName = moduleName;
- } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
- usageContext = MemoryDatabaseManager.UsageInstanceContext;
- //
- // For building library package, although all module are library, but PCD entries of
- // these library should be used to autogen.
- //
- if (usageContext == null) {
+
+ if (FrameworkBuildTask.multithread) {
+ if (parentId == null) {
usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- } else {
- usageInstanceArray = new ArrayList<UsageInstance>();
-
+ } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
+ usageContext = dbManager.getUsageInstanceArrayById(parentId);
//
- // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's
- // <ModuleSA> in FPD file.
+ // For building library package, although all module are library, but PCD entries of
+ // these library should be used to autogen.
//
- for (index = 0; index < pcdNameArrayInMsa.length; index++) {
- found = false;
- for (index2 = 0; index2 < usageContext.size(); index2 ++) {
- if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {
- usageInstanceArray.add(usageContext.get(index2));
- found = true;
- break;
+ if (usageContext == null) {
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
+ } else {
+ usageInstanceArray = new ArrayList<UsageInstance>();
+
+ //
+ // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's
+ // <ModuleSA> in FPD file.
+ //
+ for (index = 0; index < pcdNameArrayInMsa.length; index++) {
+ found = false;
+ for (index2 = 0; index2 < usageContext.size(); index2 ++) {
+ if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {
+ usageInstanceArray.add(usageContext.get(index2));
+ found = true;
+ break;
+ }
}
- }
- if (!found) {
- //
- // All library's PCD should instanted in module's <ModuleSA> who
- // use this library instance. If not, give errors.
- //
- throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +
- "is required by this library instance, but can not be found " +
- "in the %s's <ModuleSA> in the FPD file!",
- MemoryDatabaseManager.CurrentModuleName,
- moduleName,
- pcdNameArrayInMsa[index],
- MemoryDatabaseManager.CurrentModuleName
- ));
+ if (!found) {
+ //
+ // All library's PCD should instanted in module's <ModuleSA> who
+ // use this library instance. If not, give errors.
+ //
+ throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +
+ "is required by this library instance, but can not be found " +
+ "in the %s's <ModuleSA> in the FPD file!",
+ MemoryDatabaseManager.CurrentModuleName,
+ moduleName,
+ pcdNameArrayInMsa[index],
+ MemoryDatabaseManager.CurrentModuleName
+ ));
+ }
+ }
+ }
+ }
+ } else {
+ if (!isBuildUsedLibrary) {
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
+ MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;
+ MemoryDatabaseManager.CurrentModuleName = moduleName;
+ } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
+ usageContext = MemoryDatabaseManager.UsageInstanceContext;
+ //
+ // For building library package, although all module are library, but PCD entries of
+ // these library should be used to autogen.
+ //
+ if (usageContext == null) {
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
+ } else {
+ usageInstanceArray = new ArrayList<UsageInstance>();
+
+ //
+ // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's
+ // <ModuleSA> in FPD file.
+ //
+ for (index = 0; index < pcdNameArrayInMsa.length; index++) {
+ found = false;
+ for (index2 = 0; index2 < usageContext.size(); index2 ++) {
+ if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {
+ usageInstanceArray.add(usageContext.get(index2));
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ //
+ // All library's PCD should instanted in module's <ModuleSA> who
+ // use this library instance. If not, give errors.
+ //
+ throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +
+ "is required by this library instance, but can not be found " +
+ "in the %s's <ModuleSA> in the FPD file!",
+ MemoryDatabaseManager.CurrentModuleName,
+ moduleName,
+ pcdNameArrayInMsa[index],
+ MemoryDatabaseManager.CurrentModuleName
+ ));
+ }
}
}
}
}
-
if (usageInstanceArray == null) {
return;
}
diff --git a/Tools/bin/build b/Tools/bin/build
index 91341cbee4..fb9d78eb95 100755
--- a/Tools/bin/build
+++ b/Tools/bin/build
@@ -9,4 +9,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
-ant -f $WORKSPACE/build.xml $*
+ant -logger org.tianocore.build.global.GenBuildLogger -f $WORKSPACE/build.xml $*
diff --git a/Tools/bin/build.bat b/Tools/bin/build.bat
index ac9759625d..3f15bb6775 100644
--- a/Tools/bin/build.bat
+++ b/Tools/bin/build.bat
@@ -9,4 +9,4 @@
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM
-ant -f %WORKSPACE%/build.xml %*
+ant -logger org.tianocore.build.global.GenBuildLogger -f %WORKSPACE%/build.xml %*