#\r
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
\r
from __future__ import absolute_import\r
self._PcdComments = None\r
self._BuildOptions = None\r
self._DependencyFileList = None\r
+ self.LibInstances = []\r
+ self.ReferenceModules = set()\r
+\r
+ def SetReferenceModule(self,Module):\r
+ self.ReferenceModules.add(Module)\r
+ return self\r
\r
## XXX[key] = value\r
def __setitem__(self, key, value):\r
RetVal[CName] = Value\r
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Record[5]]\r
self._GuidComments[CName] = [a[0] for a in CommentRecords]\r
+\r
+ for Type in [MODEL_PCD_FIXED_AT_BUILD,MODEL_PCD_PATCHABLE_IN_MODULE,MODEL_PCD_FEATURE_FLAG,MODEL_PCD_DYNAMIC,MODEL_PCD_DYNAMIC_EX]:\r
+ RecordList = self._RawData[Type, self._Arch, self._Platform]\r
+ for TokenSpaceGuid, _, _, _, _, _, LineNo in RecordList:\r
+ # get the guid value\r
+ if TokenSpaceGuid not in RetVal:\r
+ Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path)\r
+ if Value is None:\r
+ PackageList = "\n\t".join(str(P) for P in self.Packages)\r
+ EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
+ "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid,\r
+ ExtraData=PackageList, File=self.MetaFile, Line=LineNo)\r
+ RetVal[TokenSpaceGuid] = Value\r
+ self._GuidsUsedByPcd[TokenSpaceGuid] = Value\r
return RetVal\r
\r
## Retrieve include paths necessary for this module (for Edk.x style of modules)\r
return RetVal\r
\r
@cached_property\r
+ def ModulePcdList(self):\r
+ RetVal = self.Pcds\r
+ return RetVal\r
+ @cached_property\r
+ def LibraryPcdList(self):\r
+ if bool(self.LibraryClass):\r
+ return []\r
+ RetVal = {}\r
+ Pcds = set()\r
+ for Library in self.LibInstances:\r
+ PcdsInLibrary = OrderedDict()\r
+ for Key in Library.Pcds:\r
+ if Key in self.Pcds or Key in Pcds:\r
+ continue\r
+ Pcds.add(Key)\r
+ PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])\r
+ RetVal[Library] = PcdsInLibrary\r
+ return RetVal\r
+ @cached_property\r
def PcdsName(self):\r
PcdsName = set()\r
for Type in (MODEL_PCD_FIXED_AT_BUILD,MODEL_PCD_PATCHABLE_IN_MODULE,MODEL_PCD_FEATURE_FLAG,MODEL_PCD_DYNAMIC,MODEL_PCD_DYNAMIC_EX):\r
EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \\r
% self.ModuleType, File=self.MetaFile)\r
\r
- if len(RecordList) != 0 and self.ModuleType == SUP_MODULE_USER_DEFINED:\r
+ if len(RecordList) != 0 and (self.ModuleType == SUP_MODULE_USER_DEFINED or self.ModuleType == SUP_MODULE_HOST_APPLICATION):\r
for Record in RecordList:\r
if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:\r
EdkLogger.error('build', FORMAT_INVALID,\r
for Arch, ModuleType in TemporaryDictionary:\r
RetVal[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType]\r
return RetVal\r
-\r
+ def LocalPkg(self):\r
+ module_path = self.MetaFile.File\r
+ subdir = os.path.split(module_path)[0]\r
+ TopDir = ""\r
+ while subdir:\r
+ subdir,TopDir = os.path.split(subdir)\r
+\r
+ for file_name in os.listdir(os.path.join(self.MetaFile.Root,TopDir)):\r
+ if file_name.upper().endswith("DEC"):\r
+ pkg = os.path.join(TopDir,file_name)\r
+ return pkg\r
@cached_class_function\r
def GetGuidsUsedByPcd(self):\r
- self.Pcds\r
+ self.Guid\r
return self._GuidsUsedByPcd\r
\r
## Retrieve PCD for given type\r
for TokenSpaceGuid, PcdCName, Setting, Arch, Platform, Id, LineNo in RecordList:\r
PcdDict[Arch, Platform, PcdCName, TokenSpaceGuid] = (Setting, LineNo)\r
PcdList.append((PcdCName, TokenSpaceGuid))\r
- # get the guid value\r
- if TokenSpaceGuid not in self.Guids:\r
- Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path)\r
- if Value is None:\r
- PackageList = "\n\t".join(str(P) for P in self.Packages)\r
- EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
- "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid,\r
- ExtraData=PackageList, File=self.MetaFile, Line=LineNo)\r
- self.Guids[TokenSpaceGuid] = Value\r
- self._GuidsUsedByPcd[TokenSpaceGuid] = Value\r
CommentRecords = self._RawData[MODEL_META_DATA_COMMENT, self._Arch, self._Platform, Id]\r
Comments = []\r
for CmtRec in CommentRecords:\r
if (self.Binaries and not self.Sources) or GlobalData.gIgnoreSource:\r
return True\r
return False\r
+def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict):\r
+ for Key in CopyFromDict:\r
+ CopyToDict[Key].extend(CopyFromDict[Key])\r