* [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType [not found] <cover.1535128260.git.jaben.carsey@intel.com> @ 2018-08-24 16:33 ` Jaben Carsey 2018-08-29 7:30 ` Zhu, Yonghong 0 siblings, 1 reply; 2+ messages in thread From: Jaben Carsey @ 2018-08-24 16:33 UTC (permalink / raw) To: edk2-devel; +Cc: Bob Feng, Yonghong Zhu, Liming Gao I see lots of 'MSFT' throughout code and this can reduce them. Cc: Bob Feng <Bob.c.Feng@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/AutoGen/AutoGen.py | 8 ++++---- BaseTools/Source/Python/AutoGen/BuildEngine.py | 8 ++++---- BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++- BaseTools/Source/Python/Common/DataType.py | 2 ++ BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 2 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++-- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- BaseTools/Source/Python/Workspace/InfBuildData.py | 14 +++++++------- BaseTools/Source/Python/build/build.py | 2 +- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index eb1b28388967..cb302189d2a3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -80,7 +80,7 @@ gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)") gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})") ## Mapping Makefile type -gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"} +gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"} ## Build rule configuration file @@ -1843,7 +1843,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]: EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \ % self.ToolChain) - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT else: self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain] return self._ToolChainFamily @@ -1856,7 +1856,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]: EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \ % self.ToolChain) - self._BuildRuleFamily = "MSFT" + self._BuildRuleFamily = TAB_COMPILER_MSFT else: self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain] return self._BuildRuleFamily @@ -2978,7 +2978,7 @@ class ModuleAutoGen(AutoGen): # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT # is the former use /I , the Latter used -I to specify include directories # - if self.PlatformInfo.ToolChainFamily in ('MSFT'): + if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT): BuildOptIncludeRegEx = gBuildOptIncludePatternMsft elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'): BuildOptIncludeRegEx = gBuildOptIncludePatternOther diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index 4291da9001b8..ac7a6687552c 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -318,7 +318,7 @@ class BuildRule: # @param LineIndex The line number from which the parsing will begin # @param SupportedFamily The list of supported tool chain families # - def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]): + def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]): self.RuleFile = File # Read build rules from file if it's not none if File is not None: @@ -596,17 +596,17 @@ if __name__ == '__main__': EdkLogger.Initialize() if len(sys.argv) > 1: Br = BuildRule(sys.argv[1]) - print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1])) + print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", TAB_COMPILER_MSFT][1])) print() print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])) print() print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])) print() - print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])) + print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1])) print() print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1])) print() - print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])) + print(str(Br[".ac", "ACPI_TABLE", "IA32", TAB_COMPILER_MSFT][1])) print() print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])) print() diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 55081acbd822..35ee98c82bb1 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -27,6 +27,7 @@ from Common.StringUtils import * from .BuildEngine import * import Common.GlobalData as GlobalData from collections import OrderedDict +from Common.DataType import TAB_COMPILER_MSFT ## Regular expression for finding header file inclusions gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) @@ -166,7 +167,7 @@ class BuildFile(object): "gmake" : "include" } - _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} + _INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} ## Constructor of BuildFile # diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index 473fb7473a5a..8f9a50732547 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -554,3 +554,5 @@ PACK_CODE_BY_SIZE = {8:'=Q', 1:'=B', 0:'=B', 16:""} + +TAB_COMPILER_MSFT = 'MSFT' \ No newline at end of file diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index a2cd30d3d910..52a78bcbb813 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -1111,7 +1111,7 @@ class DscParser(MetaFileParser): ## Override parent's method since we'll do all macro replacements in parser def _GetMacros(self): - Macros = dict( [('ARCH', 'IA32'), ('FAMILY', 'MSFT'), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')]) + Macros = dict( [('ARCH', 'IA32'), ('FAMILY', TAB_COMPILER_MSFT), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')]) Macros.update(self._FileLocalMacros) Macros.update(self._GetApplicableSectionMacro()) Macros.update(GlobalData.gEdkGlobal) diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 9936498c5158..eb106b574420 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -66,8 +66,8 @@ class GenFdsGlobalVariable: FixedLoadAddress = False PlatformName = '' - BuildRuleFamily = "MSFT" - ToolChainFamily = "MSFT" + BuildRuleFamily = DataType.TAB_COMPILER_MSFT + ToolChainFamily = DataType.TAB_COMPILER_MSFT __BuildRuleDatabase = None GuidToolDefinition = {} FfsCmdDict = {} diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index a4ad53ee1558..aafdd0ab93b7 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2784,7 +2784,7 @@ class DscBuildData(PlatformBuildClassObject): self.Modules.append(Module) def _GetToolChainFamily(self): - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt")) if os.path.isfile(BuildConfigurationFile) == True: TargetTxt = TargetTxtClassObject() @@ -2800,7 +2800,7 @@ class DscBuildData(PlatformBuildClassObject): if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \ or self._Toolchain not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain]: - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT else: self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain] return self._ToolChainFamily diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 7c3d712efe63..1325b4f0295a 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -252,10 +252,10 @@ class InfBuildData(ModuleBuildClassObject): if self._CustomMakefile is None: self._CustomMakefile = {} if len(TokenList) < 2: - self._CustomMakefile['MSFT'] = TokenList[0] + self._CustomMakefile[TAB_COMPILER_MSFT] = TokenList[0] self._CustomMakefile['GCC'] = TokenList[0] else: - if TokenList[0] not in ['MSFT', 'GCC']: + if TokenList[0] not in [TAB_COMPILER_MSFT, 'GCC']: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No supported family [%s]" % TokenList[0], File=self.MetaFile, Line=Record[-1]) @@ -353,7 +353,7 @@ class InfBuildData(ModuleBuildClassObject): else: Tool = ToolList[0] ToolChain = "*_*_*_%s_FLAGS" % Tool - ToolChainFamily = 'MSFT' # Edk.x only support MSFT tool chain + # Edk.x only support MSFT tool chain # ignore not replaced macros in value ValueList = GetSplitList(' ' + Value, '/D') Dummy = ValueList[0] @@ -362,11 +362,11 @@ class InfBuildData(ModuleBuildClassObject): continue Dummy = Dummy + ' /D ' + ValueList[Index] Value = Dummy.strip() - if (ToolChainFamily, ToolChain) not in self._BuildOptions: - self._BuildOptions[ToolChainFamily, ToolChain] = Value + if (TAB_COMPILER_MSFT, ToolChain) not in self._BuildOptions: + self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = Value else: - OptionString = self._BuildOptions[ToolChainFamily, ToolChain] - self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Value + OptionString = self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] + self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = OptionString + " " + Value # set _Header to non-None in order to avoid database re-querying self._Header_ = 'DUMMY' diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 6ad0e389687c..e6a9c6ef7199 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -933,7 +933,7 @@ class Build(): if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]: EdkLogger.warn("build", "No tool chain family found in configuration for %s. Default to MSFT." % Tool) - ToolChainFamily.append("MSFT") + ToolChainFamily.append(TAB_COMPILER_MSFT) else: ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]) self.ToolChainFamily = ToolChainFamily -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType 2018-08-24 16:33 ` [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType Jaben Carsey @ 2018-08-29 7:30 ` Zhu, Yonghong 0 siblings, 0 replies; 2+ messages in thread From: Zhu, Yonghong @ 2018-08-29 7:30 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org Cc: Feng, Bob C, Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Saturday, August 25, 2018 12:33 AM To: edk2-devel@lists.01.org Cc: Feng, Bob C <bob.c.feng@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com> Subject: [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType I see lots of 'MSFT' throughout code and this can reduce them. Cc: Bob Feng <Bob.c.Feng@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/AutoGen/AutoGen.py | 8 ++++---- BaseTools/Source/Python/AutoGen/BuildEngine.py | 8 ++++---- BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++- BaseTools/Source/Python/Common/DataType.py | 2 ++ BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 2 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++-- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- BaseTools/Source/Python/Workspace/InfBuildData.py | 14 +++++++------- BaseTools/Source/Python/build/build.py | 2 +- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index eb1b28388967..cb302189d2a3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -80,7 +80,7 @@ gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)") gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})") ## Mapping Makefile type -gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"} +gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"} ## Build rule configuration file @@ -1843,7 +1843,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]: EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \ % self.ToolChain) - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT else: self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain] return self._ToolChainFamily @@ -1856,7 +1856,7 @@ class PlatformAutoGen(AutoGen): or not ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]: EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \ % self.ToolChain) - self._BuildRuleFamily = "MSFT" + self._BuildRuleFamily = TAB_COMPILER_MSFT else: self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain] return self._BuildRuleFamily @@ -2978,7 +2978,7 @@ class ModuleAutoGen(AutoGen): # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT # is the former use /I , the Latter used -I to specify include directories # - if self.PlatformInfo.ToolChainFamily in ('MSFT'): + if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT): BuildOptIncludeRegEx = gBuildOptIncludePatternMsft elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'): BuildOptIncludeRegEx = gBuildOptIncludePatternOther diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index 4291da9001b8..ac7a6687552c 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -318,7 +318,7 @@ class BuildRule: # @param LineIndex The line number from which the parsing will begin # @param SupportedFamily The list of supported tool chain families # - def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]): + def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]): self.RuleFile = File # Read build rules from file if it's not none if File is not None: @@ -596,17 +596,17 @@ if __name__ == '__main__': EdkLogger.Initialize() if len(sys.argv) > 1: Br = BuildRule(sys.argv[1]) - print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1])) + print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", + TAB_COMPILER_MSFT][1])) print() print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])) print() print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])) print() - print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])) + print(str(Br[".ac", "ACPI_TABLE", "IA32", + TAB_COMPILER_MSFT][1])) print() print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1])) print() - print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])) + print(str(Br[".ac", "ACPI_TABLE", "IA32", + TAB_COMPILER_MSFT][1])) print() print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])) print() diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 55081acbd822..35ee98c82bb1 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -27,6 +27,7 @@ from Common.StringUtils import * from .BuildEngine import * import Common.GlobalData as GlobalData from collections import OrderedDict +from Common.DataType import TAB_COMPILER_MSFT ## Regular expression for finding header file inclusions gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) @@ -166,7 +167,7 @@ class BuildFile(object): "gmake" : "include" } - _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} + _INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : + "-I", "RVCT" : "-I"} ## Constructor of BuildFile # diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index 473fb7473a5a..8f9a50732547 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -554,3 +554,5 @@ PACK_CODE_BY_SIZE = {8:'=Q', 1:'=B', 0:'=B', 16:""} + +TAB_COMPILER_MSFT = 'MSFT' \ No newline at end of file diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index a2cd30d3d910..52a78bcbb813 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -1111,7 +1111,7 @@ class DscParser(MetaFileParser): ## Override parent's method since we'll do all macro replacements in parser def _GetMacros(self): - Macros = dict( [('ARCH', 'IA32'), ('FAMILY', 'MSFT'), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')]) + Macros = dict( [('ARCH', 'IA32'), ('FAMILY', + TAB_COMPILER_MSFT), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', + 'DEBUG')]) Macros.update(self._FileLocalMacros) Macros.update(self._GetApplicableSectionMacro()) Macros.update(GlobalData.gEdkGlobal) diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 9936498c5158..eb106b574420 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -66,8 +66,8 @@ class GenFdsGlobalVariable: FixedLoadAddress = False PlatformName = '' - BuildRuleFamily = "MSFT" - ToolChainFamily = "MSFT" + BuildRuleFamily = DataType.TAB_COMPILER_MSFT + ToolChainFamily = DataType.TAB_COMPILER_MSFT __BuildRuleDatabase = None GuidToolDefinition = {} FfsCmdDict = {} diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index a4ad53ee1558..aafdd0ab93b7 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2784,7 +2784,7 @@ class DscBuildData(PlatformBuildClassObject): self.Modules.append(Module) def _GetToolChainFamily(self): - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt")) if os.path.isfile(BuildConfigurationFile) == True: TargetTxt = TargetTxtClassObject() @@ -2800,7 +2800,7 @@ class DscBuildData(PlatformBuildClassObject): if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \ or self._Toolchain not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain]: - self._ToolChainFamily = "MSFT" + self._ToolChainFamily = TAB_COMPILER_MSFT else: self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._Toolchain] return self._ToolChainFamily diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 7c3d712efe63..1325b4f0295a 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -252,10 +252,10 @@ class InfBuildData(ModuleBuildClassObject): if self._CustomMakefile is None: self._CustomMakefile = {} if len(TokenList) < 2: - self._CustomMakefile['MSFT'] = TokenList[0] + self._CustomMakefile[TAB_COMPILER_MSFT] = + TokenList[0] self._CustomMakefile['GCC'] = TokenList[0] else: - if TokenList[0] not in ['MSFT', 'GCC']: + if TokenList[0] not in [TAB_COMPILER_MSFT, 'GCC']: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No supported family [%s]" % TokenList[0], File=self.MetaFile, Line=Record[-1]) @@ -353,7 +353,7 @@ class InfBuildData(ModuleBuildClassObject): else: Tool = ToolList[0] ToolChain = "*_*_*_%s_FLAGS" % Tool - ToolChainFamily = 'MSFT' # Edk.x only support MSFT tool chain + # Edk.x only support MSFT tool chain # ignore not replaced macros in value ValueList = GetSplitList(' ' + Value, '/D') Dummy = ValueList[0] @@ -362,11 +362,11 @@ class InfBuildData(ModuleBuildClassObject): continue Dummy = Dummy + ' /D ' + ValueList[Index] Value = Dummy.strip() - if (ToolChainFamily, ToolChain) not in self._BuildOptions: - self._BuildOptions[ToolChainFamily, ToolChain] = Value + if (TAB_COMPILER_MSFT, ToolChain) not in self._BuildOptions: + self._BuildOptions[TAB_COMPILER_MSFT, + ToolChain] = Value else: - OptionString = self._BuildOptions[ToolChainFamily, ToolChain] - self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Value + OptionString = self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] + self._BuildOptions[TAB_COMPILER_MSFT, + ToolChain] = OptionString + " " + Value # set _Header to non-None in order to avoid database re-querying self._Header_ = 'DUMMY' diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 6ad0e389687c..e6a9c6ef7199 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -933,7 +933,7 @@ class Build(): if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \ or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]: EdkLogger.warn("build", "No tool chain family found in configuration for %s. Default to MSFT." % Tool) - ToolChainFamily.append("MSFT") + ToolChainFamily.append(TAB_COMPILER_MSFT) else: ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]) self.ToolChainFamily = ToolChainFamily -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-29 7:30 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1535128260.git.jaben.carsey@intel.com> 2018-08-24 16:33 ` [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType Jaben Carsey 2018-08-29 7:30 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox