From a1eb640176c7a3b9d9981272c49824cbdb5ac15a Mon Sep 17 00:00:00 2001 From: klu2 Date: Fri, 28 Jul 2006 16:44:52 +0000 Subject: [PATCH] There is a rule here: If a module link a library instance, all pcds defined by library instance should be instanted in module's 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 --- .../build/pcd/action/PCDAutoGenAction.java | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) 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 7f955ff040..ad4ebe78af 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java @@ -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(); + // - // Remove PCD entries which are not belong to this library. + // Try to find all PCD defined in library's PCD in all in module's + // in FPD file. // - 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)); + 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 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 in FPD file!", + dbManager.CurrentModuleName, + moduleName, + pcdNameArray[index], + dbManager.CurrentModuleName + )); + } } } } + if (usageInstanceArray == null) { + return; + } + // // Generate all PCD entry for a module. // -- 2.39.2