diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-05-10 17:58:26 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-05-18 08:59:30 +0800 |
commit | c28d2e1047816164ffec552e4a3375122cbcc6b6 (patch) | |
tree | 20c8ba16e7f4ed1a8ef4f135ef82e79f83ae3580 /BaseTools/Source/Python/Workspace/MetaFileParser.py | |
parent | bba734ab4c7c9b4386d39420983bf61484f65dda (diff) | |
download | edk2-c28d2e1047816164ffec552e4a3375122cbcc6b6.tar.gz edk2-c28d2e1047816164ffec552e4a3375122cbcc6b6.tar.bz2 edk2-c28d2e1047816164ffec552e4a3375122cbcc6b6.zip |
BaseTools: support private package definition
EDKII build spec and DEC spec updated to support private package
definition.
If GUID, Protocol or PPI is listed in a DEC file, where the Private
modifier is used in the section tag ([Guids.common.Private] for example),
only modules within the package are permitted to use the GUID, Protocol
or PPI. If a module or library instance outside of the package attempts
to use the item, the build must fail with an appropriate error message.
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
-rw-r--r-- | BaseTools/Source/Python/Workspace/MetaFileParser.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 209f47c9eb..82d874f8dd 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1722,6 +1722,7 @@ class DecParser(MetaFileParser): self._SectionName = ''
self._SectionType = []
ArchList = set()
+ PrivateList = set()
Line = self._CurrentLine.replace("%s%s" % (TAB_COMMA_SPLIT, TAB_SPACE_SPLIT), TAB_COMMA_SPLIT)
for Item in Line[1:-1].split(TAB_COMMA_SPLIT):
if Item == '':
@@ -1757,8 +1758,14 @@ class DecParser(MetaFileParser): # S2 may be Platform or ModuleType
if len(ItemList) > 2:
S2 = ItemList[2].upper()
+ # only Includes, GUIDs, PPIs, Protocols section have Private tag
+ if self._SectionName in [TAB_INCLUDES.upper(), TAB_GUIDS.upper(), TAB_PROTOCOLS.upper(), TAB_PPIS.upper()]:
+ if S2 != 'PRIVATE':
+ EdkLogger.error("Parser", FORMAT_INVALID, 'Please use keyword "Private" as section tag modifier.',
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
else:
S2 = 'COMMON'
+ PrivateList.add(S2)
if [S1, S2, self.DataType[self._SectionName]] not in self._Scope:
self._Scope.append([S1, S2, self.DataType[self._SectionName]])
@@ -1767,6 +1774,11 @@ class DecParser(MetaFileParser): EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+ # It is not permissible to mix section tags without the Private attribute with section tags with the Private attribute
+ if 'COMMON' in PrivateList and len(PrivateList) > 1:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Can't mix section tags without the Private attribute with section tags with the Private attribute",
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
+
## [guids], [ppis] and [protocols] section parser
@ParseMacro
def _GuidParser(self):
|