public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "yi1 li" <yi1.li@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Feng, Bob C" <bob.c.feng@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>,
	"Luo, Heng" <heng.luo@intel.com>
Subject: Re: [PATCH V2 2/2] BaseTools:Add the FeatureFlagExpression usage to the Source Section
Date: Tue, 8 Mar 2022 13:44:46 +0000	[thread overview]
Message-ID: <MWHPR11MB15979CB1F48F1C2E719FC1A0C5099@MWHPR11MB1597.namprd11.prod.outlook.com> (raw)
In-Reply-To: <964dee97e12793125d8c6cb486cf4d6498c05570.1646746598.git.yi1.li@intel.com>

Sorry for a typo and Cc wrong email, Re-send patch sequence,
Please review new patches.

Thanks,
Yi
-----Original Message-----
From: Li, Yi1 <yi1.li@intel.com> 
Sent: Tuesday, March 8, 2022 9:42 PM
To: devel@edk2.groups.io
Cc: Li, Yi1 <yi1.li@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Luo, Heng <heng.luo@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.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Heng Luo <heng.luo@intel.com>
Signed-off-by: yi1 li <yi1.li@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


      reply	other threads:[~2022-03-08 13:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 13:42 [PATCH V2 0/2] BaseTools:Add the FeatureFlagExpression usage to the InfBuildData yi1 li
2022-03-08 13:42 ` [PATCH V2 1/2] " yi1 li
2022-03-08 13:42 ` [PATCH V2 2/2] BaseTools:Add the FeatureFlagExpression usage to the Source Section yi1 li
2022-03-08 13:44   ` yi1 li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB15979CB1F48F1C2E719FC1A0C5099@MWHPR11MB1597.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox