X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fpcd%2Faction%2FPCDAutoGenAction.java;h=ad4ebe78af01487d9a0f0ebad4f8ad33caa807d7;hp=7f955ff0402cb384287c74993df22e8e5be4f7ae;hb=a1eb640176c7a3b9d9981272c49824cbdb5ac15a;hpb=fd16c6d5d404091051d010fe52a69196c9b89f1e 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. //