diff options
| author | Joey Vagedes <joey.vagedes@gmail.com> | 2024-07-02 20:27:02 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-08-06 07:55:34 +0300 |
| commit | c5aa7e7d94c0e6b3c0202e15dbf7a5c92dd6a01d (patch) | |
| tree | 1d7e85a52969e327ba6447150ae1add65a437891 /BaseTools/Source/Python/Workspace/MetaFileTable.py | |
| parent | 909d1db4cb3ba6a3b2d8d239592f388423cbef11 (diff) | |
| download | edk2-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/MetaFileTable.py')
| -rw-r--r-- | BaseTools/Source/Python/Workspace/MetaFileTable.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py index 7ff5f2011d..3b9060b465 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py @@ -23,6 +23,11 @@ class MetaFileTable(): _ID_STEP_ = 1
_ID_MAX_ = 99999999
+ # Column offsets into the rows this class appends to DB.TblFile. Keep in
+ # sync with the list built in __init__.
+ _FILE_PATH_ = 3
+ _FILE_FROM_ITEM_ = 6
+
## Constructor
def __init__(self, DB, MetaFile, FileType, Temporary, FromItem=None):
self.MetaFile = MetaFile
@@ -30,6 +35,7 @@ class MetaFileTable(): self.DB = DB
self.CurrentContent = []
+ # Columns here are addressed by the _FILE_*_ offsets above.
DB.TblFile.append([MetaFile.Name,
MetaFile.Ext,
MetaFile.Dir,
@@ -297,6 +303,10 @@ class PlatformTable(MetaFileTable): # used as table end flag, in case the changes to database is not committed to db file
_DUMMY_ = [-1, -1, '====', '====', '====', '====', '====','====', -1, -1, -1, -1, -1, -1, -1]
+ # Column offsets into the rows built by Insert(), matching _COLUMN_ above.
+ _ID_ = 0
+ _FROM_ITEM_ = 9
+
## Constructor
def __init__(self, Cursor, MetaFile, Temporary, FromItem=0):
MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
@@ -386,6 +396,35 @@ class PlatformTable(MetaFileTable): if item[0] == comp_id or item[8] == comp_id:
item[-1] = -1
+ ## Find the file a record's line number refers to
+ #
+ # Records brought in by !include are spliced into the including file's
+ # record list, so this table's MetaFile is not necessarily the file the
+ # record's StartLine counts against. Such a record keeps the ID of the
+ # !include statement that pulled it in as its FromItem, and the table
+ # built for the included file stored that same ID, so FromItem maps back
+ # to the included file's path.
+ #
+ # @param RecordId: ID of the record to locate
+ #
+ # @retval: Path of the file the record was parsed from, or None if
+ # this table holds no such record
+ #
+ def GetOriginFile(self, RecordId):
+ for Record in self.CurrentContent:
+ if Record[self._ID_] != RecordId:
+ continue
+ FromItem = Record[self._FROM_ITEM_]
+ # A record parsed straight out of this file has no originating
+ # !include statement to resolve.
+ if not FromItem or FromItem < 0:
+ return self.MetaFile
+ for File in self.DB.TblFile:
+ if File[self._FILE_FROM_ITEM_] == FromItem:
+ return File[self._FILE_PATH_]
+ return self.MetaFile
+ return None
+
## Factory class to produce different storage for different type of meta-file
class MetaFileStorage(object):
_FILE_TABLE_ = {
|
