String guidStringCName = null;\r
String guidString = null;\r
UsageInstance usageInstance = null;\r
+ boolean found = false;\r
\r
+ usageInstanceArray = null;\r
if (!isBuildUsedLibrary) {\r
usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(moduleName,\r
moduleGuid,\r
version);\r
dbManager.UsageInstanceContext = usageInstanceArray;\r
dbManager.CurrentModuleName = moduleName; \r
- } else {\r
+ } else if ((pcdNameArray != null) && (pcdNameArray.length > 0)) {\r
usageContext = dbManager.UsageInstanceContext;\r
//\r
- // For building MDE package, although all module are library, but PCD entries of \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
version);\r
} else {\r
usageInstanceArray = new ArrayList<UsageInstance>();\r
+\r
//\r
- // Remove PCD entries which are not belong to this library.\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 < usageContext.size(); index++) {\r
- if ((pcdNameArray == null) || (pcdNameArray.length == 0)){\r
- break;\r
- }\r
-\r
- for (index2 = 0; index2 < pcdNameArray.length; index2 ++) {\r
- if (pcdNameArray[index2].equalsIgnoreCase(usageContext.get(index).parentToken.cName)) {\r
- usageInstanceArray.add(usageContext.get(index));\r
+ for (index = 0; index < pcdNameArray.length; index++) {\r
+ found = false;\r
+ for (index2 = 0; index2 < usageContext.size(); index2 ++) {\r
+ if (pcdNameArray[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("[PCD Autogen Error] Module %s use library instance %s, the PCD %s " +\r
+ "is required by this library instance, but can not find " +\r
+ "it in the %s's <ModuleSA> in FPD file!",\r
+ dbManager.CurrentModuleName,\r
+ moduleName,\r
+ pcdNameArray[index],\r
+ dbManager.CurrentModuleName\r
+ ));\r
+ }\r
}\r
}\r
}\r
\r
+ if (usageInstanceArray == null) {\r
+ return;\r
+ }\r
+\r
//\r
// Generate all PCD entry for a module.\r
// \r