Sorry for a typo and Cc wrong email, Re-send patch sequence, Please review new patches.
Thanks, Yi -----Original Message----- From: Li, Yi1 <yi1...@intel.com> Sent: Tuesday, March 8, 2022 9:42 PM To: devel@edk2.groups.io Cc: Li, Yi1 <yi1...@intel.com>; Feng, Bob C <bob.c.f...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn>; Luo, Heng <heng....@intel.com> Subject: [PATCH V2 2/2] BaseTools:Add the FeatureFlagExpression usage to the Source Section REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1446 FeatureFlagExpression Support in Source section of INF file. The Pcd value in the expression is from INF or DEC. When a FeatureFlagExpression is present,if the expression evaluates to TRUE,then the entry is valid. If the expression evaluates to FALSE, then the EDK II build tools must ignore the entry. This patch is going to add this feature. Cc: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Heng Luo <heng....@intel.com> Signed-off-by: yi1 li <yi1...@intel.com> --- BaseTools/Source/Python/Workspace/InfBuildData.py | 14 ++++++++++---- .../Source/Python/Workspace/MetaFileParser.py | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 91d986d8cb1b..cb58e612cbd0 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -529,11 +529,17 @@ class InfBuildData(ModuleBuildClassObject): for Record in RecordList: LineNo = Record[-1] ToolChainFamily = Record[1] - TagName = Record[2] - ToolCode = Record[3] - + # OptionsList := [TagName, ToolCode, FeatureFlag] + OptionsList = ['','',''] + TokenList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT) + for Index in range(len(TokenList)): + OptionsList[Index] = TokenList[Index] + if OptionsList[2]: + FeaturePcdExpression = self.CheckFeatureFlagPcd(OptionsList[2]) + if not FeaturePcdExpression: + continue File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '', - '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode) + '', False, self._Arch, ToolChainFamily, + '', OptionsList[0], OptionsList[1]) # check the file validation ErrorCode, ErrorInfo = File.Validate() if ErrorCode != 0: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index a3b6edbd15ee..3508591b281e 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -736,6 +736,10 @@ class InfParser(MetaFileParser): @ParseMacro def _SourceFileParser(self): TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + # Let TokenList[2] be TagName|ToolCode|FeatureFlag + if len(TokenList) > 3: + for extraToken in range(3, len(TokenList)): + TokenList[2] = TokenList[2] + '|' + + TokenList[extraToken] self._ValueList[0:len(TokenList)] = TokenList Macros = self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' -- 2.33.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87358): https://edk2.groups.io/g/devel/message/87358 Mute This Topic: https://groups.io/mt/89636890/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-