//\r
List<Object> SectList = new ArrayList<Object>();\r
\r
+ public static Object semaphore = new Object();\r
+ \r
/**\r
toBuffer\r
\r
}\r
Do.close(); \r
\r
+ \r
+ synchronized (semaphore) {\r
//\r
// Call compress\r
//\r
//\r
//di.close();\r
//compressOut.delete();\r
+ }\r
\r
}\r
catch (Exception e){\r
}\r
Vector<String> sectionList = new Vector<String>();\r
XmlCursor cursor = null;\r
- try {\r
- cursor = ffsXmlObject.newCursor();\r
- } catch (Exception e) {\r
- return null;\r
- }\r
+\r
+ cursor = ffsXmlObject.newCursor();\r
+\r
int mode = MODE_NONE;\r
Element genffsfileEle = document.createElement("genffsfile");\r
genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");\r
if (str != null && str.trim().equalsIgnoreCase("Enable")) {\r
multithread = true;\r
}\r
- \r
+\r
str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);\r
if (str != null ) {\r
try {\r
//\r
// Call AutoGen to generate AutoGen.c and AutoGen.h\r
//\r
- AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq);\r
+ AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq, parentId);\r
autogen.genAutogen();\r
\r
//\r
\r
Iterator listenerIter = project.getBuildListeners().iterator();\r
while (listenerIter.hasNext()) {\r
- newProject.addBuildListener((BuildListener) listenerIter.next());\r
+ BuildListener item = (BuildListener) listenerIter.next();\r
+ \r
+// if (item instanceof BuildLogger) {\r
+// BuildLogger newLogger = new GenBuildLogger(newProject);\r
+// BuildLogger oldLogger = (BuildLogger)item;\r
+// newLogger.setEmacsMode(true);\r
+// EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, "########");\r
+// } else {\r
+ newProject.addBuildListener(item);\r
+// }\r
}\r
\r
project.initSubProject(newProject);\r
genBuildTask.perform();\r
\r
status = FpdParserForThread.STATUS_END_RUN;\r
- \r
- EdkLog.log("GenBuildThread", fpdModuleId + " build finished. ");\r
+\r
+ EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, fpdModuleId + " build finished. ");\r
\r
//\r
// \r
import java.io.File;\r
import java.util.LinkedHashMap;\r
import java.util.Map;\r
+import java.io.FileNotFoundException;\r
import java.io.FileOutputStream;\r
import java.io.OutputStreamWriter;\r
\r
import javax.xml.parsers.DocumentBuilder;\r
import javax.xml.parsers.DocumentBuilderFactory;\r
+import javax.xml.parsers.ParserConfigurationException;\r
import javax.xml.transform.OutputKeys;\r
import javax.xml.transform.Result;\r
import javax.xml.transform.Source;\r
import javax.xml.transform.Transformer;\r
+import javax.xml.transform.TransformerConfigurationException;\r
+import javax.xml.transform.TransformerException;\r
import javax.xml.transform.TransformerFactory;\r
import javax.xml.transform.dom.DOMSource;\r
import javax.xml.transform.stream.StreamResult;\r
\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Project;\r
+import org.tianocore.build.exception.GenBuildException;\r
import org.tianocore.build.fpd.FpdParserTask;\r
import org.tianocore.build.global.SurfaceAreaQuery;\r
import org.tianocore.build.id.FpdModuleIdentification;\r
@throws BuildException\r
Error throws during BaseName_build.xml generating. \r
**/\r
- public void genBuildFile(String buildFilename) throws BuildException {\r
+ public void genBuildFile(String buildFilename) throws GenBuildException, EdkException {\r
FfsProcess fp = new FfsProcess();\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
try {\r
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");\r
xformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
xformer.transform(source, result);\r
- } catch (Exception ex) {\r
- throw new BuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
+ } catch (ParserConfigurationException ex) {\r
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
+ } catch (FileNotFoundException ex) {\r
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
+ } catch (TransformerConfigurationException ex) {\r
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
+ } catch (TransformerException ex) {\r
+ GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
}\r
}\r
\r
private List<String> exitBootServiceList = new ArrayList<String>();\r
\r
private SurfaceAreaQuery saq = null;\r
+ \r
+ private ModuleIdentification parentId = null;\r
\r
/**\r
Construct function\r
@param arch\r
Target architecture.\r
**/\r
- public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq) {\r
+ public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq, ModuleIdentification parentId) {\r
this.outputPath = outputPath;\r
this.moduleId = moduleId;\r
this.arch = arch;\r
this.fvDir = fvDir;\r
this.saq = saq;\r
+ this.parentId = parentId;\r
}\r
\r
/**\r
arch, \r
false, \r
null,\r
- pcdDriverType);\r
+ pcdDriverType, \r
+ parentId);\r
\r
this.myPcdAutogen.execute();\r
if (this.myPcdAutogen != null) {\r
arch,\r
true,\r
saq.getModulePcdEntryNameArray(),\r
- pcdDriverType);\r
+ pcdDriverType, \r
+ parentId);\r
this.myPcdAutogen.execute();\r
if (this.myPcdAutogen != null) {\r
fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
import org.apache.tools.ant.taskdefs.Ant;\r
import org.apache.xmlbeans.XmlObject;\r
\r
+import org.tianocore.build.global.GenBuildLogger;\r
import org.tianocore.build.global.GlobalData;\r
import org.tianocore.build.global.OutputManager;\r
import org.tianocore.build.id.FpdModuleIdentification;\r
\r
public static int currentRunNumber = 0;\r
\r
+ public static int totalNumber = 0;\r
+ \r
+ public static int remainNumber = 0;\r
+ \r
/**\r
Public construct method. It is necessary for ANT task.\r
**/\r
\r
**/\r
public void execute() throws BuildException {\r
+ \r
+ this.setTaskName(".........");\r
//\r
// Parse FPD file\r
//\r
// Prepare FV_DIR\r
//\r
String ffsCommonDir = buildDir + File.separatorChar\r
- + targetList[i] + File.separatorChar\r
+ + targetList[i] + "_"\r
+ toolchainList[j];\r
File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");\r
fvDir.mkdirs();\r
ant.init();\r
ant.execute();\r
\r
- EdkLog.log(this, "Task number is " + allThreads.size());\r
+ remainNumber = totalNumber = allThreads.size();\r
\r
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Total thread number is " + totalNumber);\r
+ GenBuildLogger.setCacheEnable(true);\r
//\r
// Waiting for all thread over, or time out\r
//\r
if (currentQueueCode >= queueList.size()) {\r
break ;\r
}\r
+ \r
+ int percentage = (totalNumber - remainNumber) * 100 / totalNumber;\r
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, percentage + "% finished. Has built " + (totalNumber - remainNumber) + " modules of " + totalNumber + " total. ");\r
\r
Set<FpdModuleIdentification> currentQueueModules = fvs.get(queueList.get(currentQueueCode));\r
\r
//\r
// Exist ready thread\r
//\r
- EdkLog.log(this, "## Exist ready thread");\r
+// EdkLog.log(this, EdkLog.EDK_ALWAYS, "Exist ready thread");\r
\r
} else if (existNoneReady && currentRunNumber == 0) {\r
//\r
// No active thread, but still have dependency not read thread\r
//\r
- throw new BuildException("Found can't resolve dependencies. ");\r
+ throw new BuildException("Existing some modules can't resolve depedencies. ");\r
} else if (!existNoneReady && currentRunNumber == 0) {\r
//\r
// Current queue build finish, move to next\r
//\r
- EdkLog.log(this, "## Current queue build finish, move to next");\r
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Current queue build finish, move to next");\r
++currentQueueCode;\r
continue ;\r
} else {\r
//\r
// active thread exist, but no ready thread\r
//\r
- EdkLog.log(this, "## active thread exist, but no ready thread" + currentRunNumber);\r
+ EdkLog.log(this, EdkLog.EDK_ALWAYS, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber);\r
}\r
\r
try {\r
deamonSemaphore.wait();\r
- } catch (InterruptedException e) {\r
- e.printStackTrace();\r
+ } catch (InterruptedException ex) {\r
+ BuildException e = new BuildException("Thread wait Error. \n" + ex.getMessage());\r
+ e.setStackTrace(ex.getStackTrace());\r
+ throw e;\r
}\r
}\r
}\r
- \r
+ GenBuildLogger.setCacheEnable(false);\r
//\r
// call fvs, postbuild\r
//\r
ant.init();\r
ant.execute();\r
\r
+ EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log"));\r
+ \r
}\r
\r
\r
public synchronized static void subCount() {\r
synchronized (countSemaphore) {\r
--currentRunNumber;\r
+ --remainNumber;\r
}\r
}\r
}\r
\r
package org.tianocore.build.global;\r
\r
+import java.io.BufferedReader;\r
+import java.io.BufferedWriter;\r
import java.io.File;\r
+import java.io.FileWriter;\r
+import java.io.IOException;\r
+import java.io.StringReader;\r
+import java.util.HashMap;\r
import java.util.List;\r
+import java.util.Map;\r
import java.util.Vector;\r
\r
+import org.apache.tools.ant.BuildEvent;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.DefaultLogger;\r
import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.util.StringUtils;\r
\r
+import org.tianocore.build.id.Identification;\r
import org.tianocore.common.logger.EdkLog;\r
import org.tianocore.common.logger.LogMethod;\r
\r
-public class GenBuildLogger implements LogMethod {\r
+public class GenBuildLogger extends DefaultLogger implements LogMethod {\r
+ \r
private Project project = null;\r
\r
///\r
/// flag to present whether cache all msg or not\r
- /// true means not to cache.\r
+ /// true means to cache.\r
///\r
- private boolean flag = true;\r
+ private static boolean flag = false;\r
\r
- private List<String> v = null;\r
+ private static Map<Identification, List<String>> map = new HashMap<Identification, List<String> >(256);\r
+ \r
+ private Identification id = null;\r
+ \r
+ public GenBuildLogger () {\r
+ \r
+ }\r
\r
public GenBuildLogger (Project project) {\r
this.project = project;\r
}\r
\r
- public GenBuildLogger (Project project, boolean flag) {\r
+ public GenBuildLogger (Project project, Identification id) {\r
this.project = project;\r
- this.flag = flag;\r
-\r
- //\r
- // Only flag is false, v will be initialized and used.\r
- //\r
- if (!flag) {\r
- v = new Vector<String>(2048);\r
- }\r
+ this.id = id;\r
}\r
\r
/**\r
- Rules: flag = true: means no cache Action: Print it to console\r
+ Rules: flag = false: means no cache Action: Print it to console\r
\r
- flag = false: mean cache all msg exception some special Action: loglevel\r
+ flag = true: mean cache all msg exception some special Action: loglevel\r
is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and\r
cache the msg others -- No print and cache the msg\r
**/\r
- public synchronized void putMessage(Object msgSource, int msgLevel,\r
- String msg) {\r
+ public synchronized void putMessage(Object msgSource, int msgLevel, String msg) {\r
if (this.project == null) {\r
return;\r
}\r
//\r
switch (msgLevel) {\r
case EdkLog.EDK_ALWAYS:\r
- log(msgSource, msg, Project.MSG_INFO);\r
+ //\r
+ // Do some special\r
+ //\r
+ log(msgSource, msg, Project.MSG_ERR);\r
break;\r
case EdkLog.EDK_ERROR:\r
- if (flag) {\r
- log(msgSource, msg, Project.MSG_ERR);\r
- } else {\r
- log(msgSource, msg, Project.MSG_ERR);\r
- v.add(msg);\r
- }\r
+ log(msgSource, msg, Project.MSG_ERR);\r
break;\r
case EdkLog.EDK_WARNING:\r
- if (flag) {\r
- log(msgSource, msg, Project.MSG_WARN);\r
- } else {\r
- v.add(msg);\r
- }\r
+ log(msgSource, msg, Project.MSG_WARN);\r
break;\r
case EdkLog.EDK_INFO:\r
- if (flag) {\r
- log(msgSource, msg, Project.MSG_INFO);\r
- } else {\r
- v.add(msg);\r
- }\r
+ log(msgSource, msg, Project.MSG_INFO);\r
break;\r
case EdkLog.EDK_VERBOSE:\r
- if (flag) {\r
- log(msgSource, msg, Project.MSG_VERBOSE);\r
- } else {\r
- v.add(msg);\r
- }\r
+ log(msgSource, msg, Project.MSG_VERBOSE);\r
break;\r
case EdkLog.EDK_DEBUG:\r
- if (flag) {\r
- log(msgSource, msg, Project.MSG_DEBUG);\r
- } else {\r
- v.add(msg);\r
- }\r
+ log(msgSource, msg, Project.MSG_DEBUG);\r
break;\r
}\r
}\r
\r
public void flushToFile(File file) {\r
//\r
- // Sort msg and store to the file (TBD)\r
+ // Put all messages in map to file\r
//\r
-\r
+ String msg = "Writing log to file [" + file.getPath() + "]";\r
+ log("Logging", msg, Project.MSG_INFO);\r
+ try {\r
+ BufferedWriter bw = new BufferedWriter(new FileWriter(file));\r
+ List<String> allMessages = map.get(null);\r
+ for(int i = 0; i < allMessages.size(); i++) {\r
+ bw.write(allMessages.get(i));\r
+ bw.newLine();\r
+ }\r
+ bw.flush();\r
+ bw.close();\r
+ } catch (IOException e) {\r
+ new BuildException("Writing log error. " + e.getMessage());\r
+ }\r
+ \r
}\r
\r
private void log(Object msgSource, String msg, int level) {\r
if (msgSource instanceof Task) {\r
this.project.log((Task)msgSource, msg, level);\r
} else if (msgSource instanceof String){\r
- \r
//\r
- // Pad 12 space to keep message \r
+ // Pad 12 space to keep message in unify format\r
//\r
msg = msg.replaceAll("\n", "\n ");\r
this.project.log(String.format("%12s", "[" + msgSource + "] ") + msg, level);\r
this.project.log(msg, level);\r
}\r
}\r
+ public void targetStarted(BuildEvent event) {\r
+ if (!flag) {\r
+ super.targetStarted(event);\r
+ }\r
+ }\r
+ \r
+ public void messageLogged(BuildEvent event) {\r
+ int currentLevel = event.getPriority();\r
+ //\r
+ // If current level is upper than Ant Level, skip it\r
+ //\r
+ if (currentLevel <= this.msgOutputLevel) {\r
+ String originalMessage = event.getMessage();\r
+\r
+ StringBuffer message = new StringBuffer();\r
+ if (!emacsMode && event.getTask() != null) {\r
+ String label = String.format("%12s", "[" + event.getTask().getTaskName() + "] ");\r
+ //\r
+ // Append label first\r
+ //\r
+ message.append(label);\r
+ \r
+ //\r
+ // Format all output message's line separator\r
+ //\r
+ try {\r
+ BufferedReader r = new BufferedReader(new StringReader(originalMessage));\r
+ boolean ifFirstLine = true;\r
+ String line = null;\r
+ while ((line = r.readLine()) != null) {\r
+ if (!ifFirstLine) {\r
+ message.append(StringUtils.LINE_SEP);\r
+ }\r
+ ifFirstLine = false;\r
+ message.append(line);\r
+ }\r
+ } catch (IOException e) {\r
+ message.append(originalMessage);\r
+ }\r
+ } else {\r
+ message.append(originalMessage);\r
+ }\r
+\r
+ String msg = message.toString();\r
+ if (currentLevel == Project.MSG_ERR) {\r
+ printMessage(msg, err, currentLevel);\r
+ } else if(currentLevel == Project.MSG_WARN) {\r
+ printMessage(msg, out, currentLevel);\r
+ } else if(!flag) {\r
+ printMessage(msg, out, currentLevel);\r
+ } \r
+ \r
+ log(msg);\r
+ }\r
+ }\r
+ \r
+ public static void setCacheEnable(boolean enable) {\r
+ flag = enable;\r
+ }\r
+ \r
+ protected synchronized void log(String message) {\r
+ //\r
+ // cache log\r
+ //\r
+ if (map.containsKey(this.id)) {\r
+ map.get(this.id).add(message);\r
+ } else {\r
+ List<String> list = new Vector<String>(1024);\r
+ list.add(message);\r
+ map.put(this.id, list);\r
+ }\r
+ }\r
}
\ No newline at end of file
// CONF dir + tools definition file name\r
//\r
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);\r
- EdkLog.log("Init", "Using tool definition file [" + toolsDefFile.getPath() + "].");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Using tool definition file [" + toolsDefFile.getPath() + "].");\r
toolsDef = new ToolChainConfig(toolsDefFile);\r
\r
\r
}\r
toolChainInfo.addCommands(toolsDef.getConfigInfo().getCommands());\r
toolChainInfo.normalize();\r
- EdkLog.log("Init", "Current build tool chain information summary: ");\r
- EdkLog.log("Init", toolChainInfo + "");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Current build tool chain information summary: ");\r
+ EdkLog.log("Init", EdkLog.EDK_ALWAYS, toolChainInfo + "");\r
}\r
return toolChainInfo;\r
}\r
import java.util.regex.Matcher;\r
import java.util.regex.Pattern;\r
\r
+import org.tianocore.build.FrameworkBuildTask;\r
import org.tianocore.build.autogen.CommonDefinition;\r
import org.tianocore.build.global.GlobalData;\r
import org.tianocore.build.id.ModuleIdentification;\r
///\r
private String[] pcdNameArrayInMsa;\r
\r
+ private UsageIdentification parentId = null;\r
/**\r
Set parameter moduleId\r
\r
String arch,\r
boolean isBuildUsedLibrary,\r
String[] pcdNameArrayInMsa,\r
- CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {\r
+ CommonDefinition.PCD_DRIVER_TYPE pcdDriverType,\r
+ ModuleIdentification parentId) {\r
dbManager = null;\r
hAutoGenString = "";\r
cAutoGenString = "";\r
arch,\r
moduleId.getVersion(),\r
moduleId.getModuleType()));\r
+ if (parentId != null) {\r
+ this.parentId = new UsageIdentification(parentId.getName(),\r
+ parentId.getGuid(),\r
+ parentId.getPackage().getName(),\r
+ parentId.getPackage().getGuid(),\r
+ arch,\r
+ parentId.getVersion(),\r
+ parentId.getModuleType());\r
+ }\r
setIsBuildUsedLibrary(isBuildUsedLibrary);\r
setPcdNameArrayInMsa(pcdNameArrayInMsa);\r
setPcdDriverType(pcdDriverType);\r
boolean found = false;\r
\r
usageInstanceArray = null;\r
- if (!isBuildUsedLibrary) {\r
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);\r
- MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;\r
- MemoryDatabaseManager.CurrentModuleName = moduleName;\r
- } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {\r
- usageContext = MemoryDatabaseManager.UsageInstanceContext;\r
- //\r
- // For building library package, although all module are library, but PCD entries of\r
- // these library should be used to autogen.\r
- //\r
- if (usageContext == null) {\r
+ \r
+ if (FrameworkBuildTask.multithread) {\r
+ if (parentId == null) {\r
usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);\r
- } else {\r
- usageInstanceArray = new ArrayList<UsageInstance>();\r
-\r
+ } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {\r
+ usageContext = dbManager.getUsageInstanceArrayById(parentId);\r
//\r
- // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's\r
- // <ModuleSA> in FPD file.\r
+ // For building library package, although all module are library, but PCD entries of\r
+ // these library should be used to autogen.\r
//\r
- for (index = 0; index < pcdNameArrayInMsa.length; index++) {\r
- found = false;\r
- for (index2 = 0; index2 < usageContext.size(); index2 ++) {\r
- if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {\r
- usageInstanceArray.add(usageContext.get(index2));\r
- found = true;\r
- break;\r
+ if (usageContext == null) {\r
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);\r
+ } else {\r
+ usageInstanceArray = new ArrayList<UsageInstance>();\r
+\r
+ //\r
+ // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's\r
+ // <ModuleSA> in FPD file.\r
+ //\r
+ for (index = 0; index < pcdNameArrayInMsa.length; index++) {\r
+ found = false;\r
+ for (index2 = 0; index2 < usageContext.size(); index2 ++) {\r
+ if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {\r
+ usageInstanceArray.add(usageContext.get(index2));\r
+ found = true;\r
+ break;\r
+ }\r
}\r
- }\r
\r
- if (!found) {\r
- //\r
- // All library's PCD should instanted in module's <ModuleSA> who\r
- // use this library instance. If not, give errors.\r
- //\r
- throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +\r
- "is required by this library instance, but can not be found " +\r
- "in the %s's <ModuleSA> in the FPD file!",\r
- MemoryDatabaseManager.CurrentModuleName,\r
- moduleName,\r
- pcdNameArrayInMsa[index],\r
- MemoryDatabaseManager.CurrentModuleName\r
- ));\r
+ if (!found) {\r
+ //\r
+ // All library's PCD should instanted in module's <ModuleSA> who\r
+ // use this library instance. If not, give errors.\r
+ //\r
+ throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +\r
+ "is required by this library instance, but can not be found " +\r
+ "in the %s's <ModuleSA> in the FPD file!",\r
+ MemoryDatabaseManager.CurrentModuleName,\r
+ moduleName,\r
+ pcdNameArrayInMsa[index],\r
+ MemoryDatabaseManager.CurrentModuleName\r
+ ));\r
+ }\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ if (!isBuildUsedLibrary) {\r
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);\r
+ MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;\r
+ MemoryDatabaseManager.CurrentModuleName = moduleName;\r
+ } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {\r
+ usageContext = MemoryDatabaseManager.UsageInstanceContext;\r
+ //\r
+ // For building library package, although all module are library, but PCD entries of\r
+ // these library should be used to autogen.\r
+ //\r
+ if (usageContext == null) {\r
+ usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);\r
+ } else {\r
+ usageInstanceArray = new ArrayList<UsageInstance>();\r
+ \r
+ //\r
+ // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's\r
+ // <ModuleSA> in FPD file.\r
+ //\r
+ for (index = 0; index < pcdNameArrayInMsa.length; index++) {\r
+ found = false;\r
+ for (index2 = 0; index2 < usageContext.size(); index2 ++) {\r
+ if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {\r
+ usageInstanceArray.add(usageContext.get(index2));\r
+ found = true;\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if (!found) {\r
+ //\r
+ // All library's PCD should instanted in module's <ModuleSA> who\r
+ // use this library instance. If not, give errors.\r
+ //\r
+ throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +\r
+ "is required by this library instance, but can not be found " +\r
+ "in the %s's <ModuleSA> in the FPD file!",\r
+ MemoryDatabaseManager.CurrentModuleName,\r
+ moduleName,\r
+ pcdNameArrayInMsa[index],\r
+ MemoryDatabaseManager.CurrentModuleName\r
+ ));\r
+ }\r
}\r
}\r
}\r
}\r
-\r
if (usageInstanceArray == null) {\r
return;\r
}\r
# 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 $*
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@REM\r
\r
-ant -f %WORKSPACE%/build.xml %*\r
+ant -logger org.tianocore.build.global.GenBuildLogger -f %WORKSPACE%/build.xml %*\r