summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Workspace/MetaFileParser.py
diff options
context:
space:
mode:
authorJoey Vagedes <joey.vagedes@gmail.com>2024-07-02 20:27:02 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-08-06 07:55:34 +0300
commitc5aa7e7d94c0e6b3c0202e15dbf7a5c92dd6a01d (patch)
tree1d7e85a52969e327ba6447150ae1add65a437891 /BaseTools/Source/Python/Workspace/MetaFileParser.py
parent909d1db4cb3ba6a3b2d8d239592f388423cbef11 (diff)
downloadedk2-c5aa7e7d94c0e6b3c0202e15dbf7a5c92dd6a01d.tar.xz
BaseTools/Build: Output warning message for library class mismatch
Performs a check that will verify that the library instance implements the library specified in the dsc by ensuring a LIBRARY_CLASS definition exists in the INF [Defines] section and the value matches the library it says it is implementing. As an example, from a platform dsc file: BaseBmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf BaseBmpSupportLib is supposed to be of library class BmpSupportLib, but the dsc defines it incorrectly, the warning message will be displayed during build. Signed-off-by: Aaron Pop <aaronpop@microsoft.com> Co-authored-by: Poncho Figueroa <poncho.figueroa.esqueda@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 1880148a6d..862f4fc436 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1728,6 +1728,26 @@ class DscParser(MetaFileParser):
self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False)
for Value in self._ValueList]
+ ## Find the file a record's line number refers to
+ #
+ # !include'd records are spliced into the including file's record list, so
+ # a record's line number is not necessarily an offset into self.MetaFile.
+ # Callers reporting a line number to the user should report this path with
+ # it rather than assuming the top-level DSC.
+ #
+ # @param RecordId: ID of the record to locate
+ #
+ # @retval: Path of the file the record was parsed from
+ #
+ def GetOriginFile(self, RecordId):
+ for Table in (self._Table, self._RawTable):
+ if Table is None:
+ continue
+ OriginFile = Table.GetOriginFile(RecordId)
+ if OriginFile is not None:
+ return OriginFile
+ return self.MetaFile
+
def DisableOverrideComponent(self,module_id):
for ori_id in self._IdMapping:
if self._IdMapping[ori_id] == module_id: