# but the path (self.MetaFile.Path) is the real path\r
for key in self.FdfProfile.InfDict:\r
if key == 'ArchTBD':\r
- Platform_cache = {}\r
MetaFile_cache = {}\r
for Arch in self.ArchList:\r
- Platform_cache[Arch] = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
+ Current_Platform_cache = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
MetaFile_cache[Arch] = set()\r
- for Pkey in Platform_cache[Arch].Modules:\r
- MetaFile_cache[Arch].add(Platform_cache[Arch].Modules[Pkey].MetaFile)\r
+ for Pkey in Current_Platform_cache.Modules:\r
+ MetaFile_cache[Arch].add(Current_Platform_cache.Modules[Pkey].MetaFile)\r
for Inf in self.FdfProfile.InfDict[key]:\r
ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)\r
for Arch in self.ArchList:\r
# apply SKU and inject PCDs from Flash Definition file\r
for Arch in self.ArchList:\r
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
-\r
+ PlatformPcds = Platform.Pcds\r
+ self._GuidDict = Platform._GuidDict\r
SourcePcdDict = {'DynamicEx':set(), 'PatchableInModule':set(),'Dynamic':set(),'FixedAtBuild':set()}\r
BinaryPcdDict = {'DynamicEx':set(), 'PatchableInModule':set()}\r
SourcePcdDict_Keys = SourcePcdDict.keys()\r
if DscPcd.Type != "FixedAtBuild":\r
continue\r
if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtBuildPcdsSameValue[key]: \r
- LibAuto.ConstPcd[key] = Pcd.DefaultValue\r
+ LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]\r
\r
def CollectVariables(self, DynamicPcdSet):\r
\r
\r
# for gathering error information\r
NoDatumTypePcdList = set()\r
- PcdNotInDb = []\r
- self._GuidValue = {}\r
FdfModuleList = []\r
for InfName in self._AsBuildInfList:\r
InfName = mws.join(self.WorkspaceDir, InfName)\r
if PcdFromModule.Type in GenC.gDynamicPcd and \\r
PcdFromModule.IsFromBinaryInf == False:\r
# Print warning message to let the developer make a determine.\r
- if PcdFromModule not in PcdNotInDb:\r
- PcdNotInDb.append(PcdFromModule)\r
continue\r
# If one of the Source built modules listed in the DSC is not listed in \r
# FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx \r
# PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the \r
# PCD to the Platform's PCD Database.\r
if PcdFromModule.Type in GenC.gDynamicExPcd:\r
- if PcdFromModule not in PcdNotInDb:\r
- PcdNotInDb.append(PcdFromModule)\r
continue\r
#\r
# If a dynamic PCD used by a PEM module/PEI module & DXE module,\r
self._ToolDefinitions[Tool][Attr] = Value\r
\r
ToolsDef = ''\r
- MakePath = ''\r
if GlobalData.gOptions.SilentMode and "MAKE" in self._ToolDefinitions:\r
if "FLAGS" not in self._ToolDefinitions["MAKE"]:\r
self._ToolDefinitions["MAKE"]["FLAGS"] = ""\r
\r
if Attr == "PATH":\r
# Don't put MAKE definition in the file\r
- if Tool == "MAKE":\r
- MakePath = Value\r
- else:\r
+ if Tool != "MAKE":\r
ToolsDef += "%s = %s\n" % (Tool, Value)\r
elif Attr != "DLL":\r
# Don't put MAKE definition in the file\r
ToPcd.Type, Module, FromPcd.Type),\r
File=self.MetaFile)\r
\r
- if FromPcd.MaxDatumSize not in [None, '']:\r
+ if FromPcd.MaxDatumSize:\r
ToPcd.MaxDatumSize = FromPcd.MaxDatumSize\r
- if FromPcd.DefaultValue not in [None, '']:\r
+ ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize\r
+ if FromPcd.DefaultValue:\r
ToPcd.DefaultValue = FromPcd.DefaultValue\r
- if FromPcd.TokenValue not in [None, '']:\r
+ if FromPcd.TokenValue:\r
ToPcd.TokenValue = FromPcd.TokenValue\r
- if FromPcd.MaxDatumSize not in [None, '']:\r
- ToPcd.MaxDatumSize = FromPcd.MaxDatumSize\r
- if FromPcd.DatumType not in [None, '']:\r
+ if FromPcd.DatumType:\r
ToPcd.DatumType = FromPcd.DatumType\r
- if FromPcd.SkuInfoList not in [None, '', []]:\r
+ if FromPcd.SkuInfoList:\r
ToPcd.SkuInfoList = FromPcd.SkuInfoList\r
# Add Flexible PCD format parse\r
if ToPcd.DefaultValue:\r
for Name, Guid in Pcds:\r
Pcd = Pcds[Name, Guid]\r
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:\r
+ Pcd.MaxSizeUserSet = None\r
Value = Pcd.DefaultValue\r
if Value in [None, '']:\r
Pcd.MaxDatumSize = '1'\r
AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() +\r
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +\r
self.ToolDefinition.keys())\r
- BuildOptions = {}\r
+ BuildOptions = defaultdict(lambda: defaultdict(str))\r
for Tool in AllTools:\r
- if Tool not in BuildOptions:\r
- BuildOptions[Tool] = {}\r
-\r
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:\r
if Tool not in Options:\r
continue\r
for Attr in Options[Tool]:\r
- Value = Options[Tool][Attr]\r
#\r
# Do not generate it in Makefile\r
#\r
if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:\r
continue\r
- if Attr not in BuildOptions[Tool]:\r
- BuildOptions[Tool][Attr] = ""\r
+ Value = Options[Tool][Attr]\r
# check if override is indicated\r
if Value.startswith('='):\r
- ToolPath = Value[1:]\r
- ToolPath = mws.handleWsMacro(ToolPath)\r
- BuildOptions[Tool][Attr] = ToolPath\r
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])\r
else:\r
- Value = mws.handleWsMacro(Value)\r
if Attr != 'PATH':\r
- BuildOptions[Tool][Attr] += " " + Value\r
+ BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)\r
else:\r
- BuildOptions[Tool][Attr] = Value\r
+ BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)\r
+\r
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:\r
#\r
# Override UNI flag only for EDK module.\r
#\r
- if 'BUILD' not in BuildOptions:\r
- BuildOptions['BUILD'] = {}\r
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag\r
return BuildOptions, BuildRuleOrder\r
\r
\r
self.Workspace = Workspace\r
self.WorkspaceDir = Workspace.WorkspaceDir\r
-\r
+ self._GuidDict = Workspace._GuidDict\r
self.MetaFile = ModuleFile\r
self.PlatformInfo = PlatformAutoGen(Workspace, PlatformFile, Target, Toolchain, Arch)\r
\r
if not self.SourceFileList:\r
return []\r
\r
- NameGuids = []\r
+ NameGuids = set()\r
for SrcFile in self.SourceFileList:\r
if SrcFile.Ext.lower() != '.vfr':\r
continue\r
if not Guid:\r
break\r
NameArray = ConvertStringToByteArray('L"' + Name.group(1) + '"')\r
- NameGuids.append((NameArray, GuidStructureStringToGuidString(Guid.group(1))))\r
+ NameGuids.add((NameArray, GuidStructureStringToGuidString(Guid.group(1))))\r
Pos = Content.find('efivarstore', Name.end())\r
if not NameGuids:\r
return []\r
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]\r
VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]\r
fStringIO.write(''.join(VfrGuid)) \r
- type (Item[1]) \r
VfrValue = pack ('Q', int (Item[1], 16))\r
fStringIO.write (VfrValue)\r
#\r
## Create AsBuilt INF file the module\r
#\r
def CreateAsBuiltInf(self, IsOnlyCopy = False):\r
- self.OutputFile = []\r
+ self.OutputFile = set()\r
if IsOnlyCopy:\r
if GlobalData.gBinCacheDest:\r
self.CopyModuleToCache()\r
return\r
\r
# Skip the following code for modules with no source files\r
- if self.SourceFileList is None or self.SourceFileList == []:\r
+ if not self.SourceFileList:\r
return\r
\r
# Skip the following code for modules without any binary files\r
- if self.BinaryFileList <> None and self.BinaryFileList <> []:\r
+ if not self.BinaryFileList:\r
return\r
\r
### TODO: How to handles mixed source and binary modules\r
DebugDir = self.DebugDir.replace('\\', '/').strip('/')\r
for Item in self.CodaTargetList:\r
File = Item.Target.Path.replace('\\', '/').strip('/').replace(DebugDir, '').replace(OutputDir, '').strip('/')\r
- if File not in self.OutputFile:\r
- self.OutputFile.append(File)\r
+ self.OutputFile.add(File)\r
if os.path.isabs(File):\r
File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')\r
if Item.Target.Ext.lower() == '.aml':\r
else:\r
AsBuiltInfDict['binary_item'] += ['BIN|' + File]\r
if self.DepexGenerated:\r
- if self.Name + '.depex' not in self.OutputFile:\r
- self.OutputFile.append(self.Name + '.depex')\r
+ self.OutputFile.add(self.Name + '.depex')\r
if self.ModuleType in ['PEIM']:\r
AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex']\r
if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'UEFI_DRIVER']:\r
Bin = self._GenOffsetBin()\r
if Bin:\r
AsBuiltInfDict['binary_item'] += ['BIN|%s' % Bin]\r
- if Bin not in self.OutputFile:\r
- self.OutputFile.append(Bin)\r
+ self.OutputFile.add(Bin)\r
\r
for Root, Dirs, Files in os.walk(OutputDir):\r
for File in Files:\r
if File.lower().endswith('.pdb'):\r
AsBuiltInfDict['binary_item'] += ['DISPOSABLE|' + File]\r
- if File not in self.OutputFile:\r
- self.OutputFile.append(File)\r
+ self.OutputFile.add(File)\r
HeaderComments = self.Module.HeaderComments\r
StartPos = 0\r
for Index in range(len(HeaderComments)):\r
Padding = Padding * 2\r
ArraySize = ArraySize / 2\r
if ArraySize < (len(PcdValue) + 1):\r
- EdkLogger.error("build", AUTOGEN_ERROR,\r
+ if Pcd.MaxSizeUserSet:\r
+ EdkLogger.error("build", AUTOGEN_ERROR,\r
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)\r
)\r
+ else:\r
+ ArraySize = len(PcdValue) + 1\r
if ArraySize > len(PcdValue) + 1:\r
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)\r
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'\r
PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))\r
PcdValue += '}'\r
else:\r
- EdkLogger.error("build", AUTOGEN_ERROR,\r
+ if Pcd.MaxSizeUserSet:\r
+ EdkLogger.error("build", AUTOGEN_ERROR,\r
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)\r
)\r
+ else:\r
+ ArraySize = len(PcdValue) + 1\r
PcdItem = '%s.%s|%s|0x%X' % \\r
(Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1])\r
PcdComments = ''\r
PcdItem = PcdComments + '\n ' + PcdItem\r
AsBuiltInfDict['patchablepcd_item'].append(PcdItem)\r
\r
- HiiPcds = []\r
+ HiiPcds = set()\r
for Pcd in Pcds + VfrPcds:\r
PcdComments = ''\r
PcdCommentList = []\r
#\r
if (SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in HiiPcds:\r
continue\r
- else:\r
- HiiPcds.append((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
+ HiiPcds.add((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:\r
PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:]\r
if HiiInfo:\r