There is a rule here:

If a module link a library instance, all pcds defined by library instance should be instanted in module's <ModuleSA> in FPD file.

I add more checking code follows above rules.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1141 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-07-28 16:44:52 +00:00
parent fd16c6d5d4
commit a1eb640176
1 changed files with 33 additions and 12 deletions

View File

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