public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: devel@edk2.groups.io, michael.d.kinney@intel.com
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>, Ray Ni <ray.ni@intel.com>,
	Steven Shi <steven.shi@intel.com>
Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Fix New Target/ToolChain/Arch in DSC [BuildOptions] issues
Date: Mon, 3 May 2021 10:59:20 -0600	[thread overview]
Message-ID: <2ac2282f-d43c-3c74-670b-658c0f0d7afa@bsdio.com> (raw)
In-Reply-To: <20210501170241.1185-1-michael.d.kinney@intel.com>

Acked-by: Rebecca Cran <rebecca@bsdio.com>

-- 
Rebecca Cran

On 5/1/21 11:02 AM, Michael D Kinney wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359
>
> * Save/Restore global state in GetToolChainAndFamilyFromDsc()
>   This resolves an issue where the multi-arch build for
>   UefiPayloadPkg would skip the autogen and build of IA32
>   components.
> * Expand tools wildcard.
>   This resolves the issue where autogen makefile contents
>   would have a BUIDLRULEFAMILY tools definitions with an
>   '*' in the tool field that breaks the build from invalid
>   makefile syntax.
> * Build rule family higher priority than Family.
>   This resolves the issue where flags were appended from
>   both the BUILDRULEFAMILY and FAMILY when only
>   BUILDRULEFAMILY should be appended when present.
>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Steven Shi <steven.shi@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Python/AutoGen/ModuleAutoGenHelper.py     | 27 +++++++++----------
>  .../Source/Python/AutoGen/PlatformAutoGen.py  | 27 +++++++++----------
>  BaseTools/Source/Python/build/build.py        |  2 ++
>  3 files changed, 26 insertions(+), 30 deletions(-)
>
> diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
> index 167bb59d2315..036fdac3d7df 100644
> --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
> +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
> @@ -181,20 +181,12 @@ class AutoGenInfo(object):
>                          if Family == ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
>                              FamilyMatch = True
>                              Found = True
> -                    if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]:
> -                        if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
> -                            FamilyMatch = True
> -                            Found = True
>                  if TAB_STAR in ToolDef:
>                      FamilyIsNull = False
>                      if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[TAB_STAR]:
>                          if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
>                              FamilyMatch = True
>                              Found = True
> -                    if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]:
> -                        if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]:
> -                            FamilyMatch = True
> -                            Found = True
>                  if not Found:
>                      continue
>              # expand any wildcard
> @@ -640,14 +632,19 @@ class PlatformInfo(AutoGenInfo):
>                      if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
>                          continue
>                      Value = Options[Tool][Attr]
> -                    # check if override is indicated
> -                    if Value.startswith('='):
> -                        BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
> -                    else:
> -                        if Attr != 'PATH':
> -                            BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
> +                    ToolList = [Tool]
> +                    if Tool == TAB_STAR:
> +                        ToolList = list(AllTools)
> +                        ToolList.remove(TAB_STAR)
> +                    for ExpandedTool in ToolList:
> +                        # check if override is indicated
> +                        if Value.startswith('='):
> +                            BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:])
>                          else:
> -                            BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
> +                            if Attr != 'PATH':
> +                                BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
> +                            else:
> +                                BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)
>  
>          return BuildOptions, BuildRuleOrder
>  
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index 21e72438e59e..832c0da86bb7 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -1391,14 +1391,19 @@ class PlatformAutoGen(AutoGen):
>                      if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
>                          continue
>                      Value = Options[Tool][Attr]
> -                    # check if override is indicated
> -                    if Value.startswith('='):
> -                        BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
> -                    else:
> -                        if Attr != 'PATH':
> -                            BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
> +                    ToolList = [Tool]
> +                    if Tool == TAB_STAR:
> +                        ToolList = list(AllTools)
> +                        ToolList.remove(TAB_STAR)
> +                    for ExpandedTool in ToolList:
> +                        # check if override is indicated
> +                        if Value.startswith('='):
> +                            BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:])
>                          else:
> -                            BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
> +                            if Attr != 'PATH':
> +                                BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
> +                            else:
> +                                BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)
>  
>          return BuildOptions, BuildRuleOrder
>  
> @@ -1529,20 +1534,12 @@ class PlatformAutoGen(AutoGen):
>                          if Family == ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
>                              FamilyMatch = True
>                              Found = True
> -                    if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]:
> -                        if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:
> -                            FamilyMatch = True
> -                            Found = True
>                  if TAB_STAR in ToolDef:
>                      FamilyIsNull = False
>                      if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[TAB_STAR]:
>                          if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
>                              FamilyMatch = True
>                              Found = True
> -                    if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]:
> -                        if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]:
> -                            FamilyMatch = True
> -                            Found = True
>                  if not Found:
>                      continue
>  
> diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
> index 0570c29f1ada..e5693c0d27a2 100755
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -897,6 +897,7 @@ class Build():
>      # $(TARGET), $(TOOLCHAIN), $(TOOLCHAIN_TAG), or $(ARCH) operands.
>      #
>      def GetToolChainAndFamilyFromDsc (self, File):
> +        SavedGlobalDefines = GlobalData.gGlobalDefines.copy()
>          for BuildTarget in self.BuildTargetList:
>              GlobalData.gGlobalDefines['TARGET'] = BuildTarget
>              for BuildToolChain in self.ToolChainList:
> @@ -929,6 +930,7 @@ class Build():
>                              self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = []
>                          if ToolChain not in self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]:
>                              self.ToolDef.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG].append(ToolChain)
> +        GlobalData.gGlobalDefines = SavedGlobalDefines
>  
>      ## Load configuration
>      #




  reply	other threads:[~2021-05-03 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 17:02 [Patch 1/1] BaseTools: Fix New Target/ToolChain/Arch in DSC [BuildOptions] issues Michael D Kinney
2021-05-03 16:59 ` Rebecca Cran [this message]
2021-05-03 17:15 ` [edk2-devel] " Andrew Fish

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=2ac2282f-d43c-3c74-670b-658c0f0d7afa@bsdio.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