BaseTools: Fix New Target/ToolChain/Arch in DSC [BuildOptions] issues
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> Acked-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Andrew Fish <afish@apple.com>
This commit is contained in:
		
				
					committed by
					
						
						mergify[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							1e6b0394d6
						
					
				
				
					commit
					8c8f49f0dc
				
			@@ -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]
 | 
			
		||||
                    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[Tool][Attr] = mws.handleWsMacro(Value[1:])
 | 
			
		||||
                            BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:])
 | 
			
		||||
                        else:
 | 
			
		||||
                            if Attr != 'PATH':
 | 
			
		||||
                            BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
 | 
			
		||||
                                BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
 | 
			
		||||
                            else:
 | 
			
		||||
                            BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
 | 
			
		||||
                                BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value)
 | 
			
		||||
 | 
			
		||||
        return BuildOptions, BuildRuleOrder
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1391,14 +1391,19 @@ class PlatformAutoGen(AutoGen):
 | 
			
		||||
                    if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
 | 
			
		||||
                        continue
 | 
			
		||||
                    Value = Options[Tool][Attr]
 | 
			
		||||
                    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[Tool][Attr] = mws.handleWsMacro(Value[1:])
 | 
			
		||||
                            BuildOptions[ExpandedTool][Attr] = mws.handleWsMacro(Value[1:])
 | 
			
		||||
                        else:
 | 
			
		||||
                            if Attr != 'PATH':
 | 
			
		||||
                            BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
 | 
			
		||||
                                BuildOptions[ExpandedTool][Attr] += " " + mws.handleWsMacro(Value)
 | 
			
		||||
                            else:
 | 
			
		||||
                            BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
 | 
			
		||||
                                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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
    #
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user