- 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 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
- 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