From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: bob.c.feng@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Thu, 11 Jul 2019 02:26:57 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2019 02:26:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,478,1557212400"; d="scan'208";a="177111714" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 11 Jul 2019 02:26:49 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jul 2019 02:26:49 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jul 2019 02:26:48 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by shsmsx102.ccr.corp.intel.com ([169.254.2.3]) with mapi id 14.03.0439.000; Thu, 11 Jul 2019 17:26:46 +0800 From: "Bob Feng" To: "Gao, Liming" , "devel@edk2.groups.io" Subject: Re: [Patch 1/1] BaseTools: Singleton the object to handle build conf file Thread-Topic: [Patch 1/1] BaseTools: Singleton the object to handle build conf file Thread-Index: AQHVLYAmRtqITLoqbEObuMv2expNvqbEsBKAgACJu6A= Date: Thu, 11 Jul 2019 09:26:45 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160B3DB27@SHSMSX105.ccr.corp.intel.com> References: <20190628070703.17224-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A6513@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A6513@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Liming, Thanks for your comments. I'll test the cases you mentioned. Thanks, Bob -----Original Message----- From: Gao, Liming=20 Sent: Thursday, July 11, 2019 5:11 PM To: Feng, Bob C ; devel@edk2.groups.io Subject: RE: [Patch 1/1] BaseTools: Singleton the object to handle build co= nf file Bob: target.txt is from Conf directory. build_rule.txt and tools_def.txt are s= pecified in target.txt. Please take care this case that they may have the d= ifferent file name.=20 And, Conf directory is relative to WORKSPACE and PACKAGES_PATH. Does this= patch support it? Thanks Liming >-----Original Message----- >From: Feng, Bob C >Sent: Friday, June 28, 2019 3:07 PM >To: devel@edk2.groups.io >Cc: Gao, Liming ; Feng, Bob C=20 > >Subject: [Patch 1/1] BaseTools: Singleton the object to handle build=20 >conf file > >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1875 > >The build config files are target.txt, build rule, tooldef During a=20 >build, the config is not changed, so the object to handle them need to=20 >be singleton. > >Cc: Liming Gao >Signed-off-by: Bob Feng >--- > BaseTools/Source/Python/AutoGen/AutoGen.py | 33 ++---------- > .../Source/Python/AutoGen/BuildEngine.py | 22 ++++++++ > .../Python/Common/TargetTxtClassObject.py | 2 + > .../Python/Common/ToolDefClassObject.py | 6 ++- > BaseTools/Source/Python/GenFds/GenFds.py | 4 +- > .../Python/GenFds/GenFdsGlobalVariable.py | 54 ++++++++----------- > .../Source/Python/Workspace/DscBuildData.py | 8 +-- > BaseTools/Source/Python/build/build.py | 29 +++------- > 8 files changed, 62 insertions(+), 96 deletions(-) > >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >b/BaseTools/Source/Python/AutoGen/AutoGen.py >index e8e09dc8a366..a1f7f5641e09 100644 >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >@@ -22,11 +22,12 @@ from . import GenC > from . import GenMake > from . import GenDepex > from io import BytesIO > > from .StrGather import * >-from .BuildEngine import BuildRule >+from .BuildEngine import BuildRuleObj as BuildRule from .BuildEngine=20 >+import >gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum > import shutil > from Common.LongFilePathSupport import CopyLongFilePath from=20 >Common.BuildToolError import * from Common.DataType import * from=20 >Common.Misc import * @@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =3D >re.compile("\s*guid\s*=3D\s*({.*?{.*?}\s*})") > > ## Mapping Makefile type > gMakeTypeMap =3D {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"} > > >-## Build rule configuration file >-gDefaultBuildRuleFile =3D 'build_rule.txt' >- >-## Build rule default version >-AutoGenReqBuildRuleVerNum =3D "0.1" >- > ## default file name for AutoGen > gAutoGenCodeFileName =3D "AutoGen.c" > gAutoGenHeaderFileName =3D "AutoGen.h" > gAutoGenStringFileName =3D "%(module_name)sStrDefs.h" > gAutoGenStringFormFileName =3D "%(module_name)sStrDefs.hpk" >@@ -1964,32 +1959,10 @@ class PlatformAutoGen(AutoGen): > ## Return the build options specific for EDKII modules in this platfo= rm > @cached_property > def EdkIIBuildOption(self): > return self._ExpandBuildOption(self.Platform.BuildOptions,=20 >EDKII_NAME) > >- ## Parse build_rule.txt in Conf Directory. >- # >- # @retval BuildRule object >- # >- @cached_property >- def BuildRule(self): >- BuildRuleFile =3D None >- if TAB_TAT_DEFINES_BUILD_RULE_CONF in >self.Workspace.TargetTxt.TargetTxtDictionary: >- BuildRuleFile =3D >self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RUL >E_CONF] >- if not BuildRuleFile: >- BuildRuleFile =3D gDefaultBuildRuleFile >- RetVal =3D BuildRule(BuildRuleFile) >- if RetVal._FileVersion =3D=3D "": >- RetVal._FileVersion =3D AutoGenReqBuildRuleVerNum >- else: >- if RetVal._FileVersion < AutoGenReqBuildRuleVerNum : >- # If Build Rule's version is less than the version number= required by >the tools, halting the build. >- EdkLogger.error("build", AUTOGEN_ERROR, >- ExtraData=3D"The version number [%s] of b= uild_rule.txt is less >than the version number required by the AutoGen.(the minimum required=20 >version number is [%s])"\ >- % (RetVal._FileVersion, AutoGenReqBuildR= uleVerNum)) >- return RetVal >- > ## Summarize the packages used by modules in this platform > @cached_property > def PackageList(self): > RetVal =3D set() > for La in self.LibraryAutoGenList: >@@ -3143,11 +3116,11 @@ class ModuleAutoGen(AutoGen): > return RetVal > > @cached_property > def BuildRules(self): > RetVal =3D {} >- BuildRuleDatabase =3D self.PlatformInfo.BuildRule >+ BuildRuleDatabase =3D BuildRule > for Type in BuildRuleDatabase.FileTypeList: > #first try getting build rule by BuildRuleFamily > RuleObject =3D BuildRuleDatabase[Type, self.BuildType,=20 >self.Arch, self.BuildRuleFamily] > if not RuleObject: > # build type is always module type, but ... >diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py >b/BaseTools/Source/Python/AutoGen/BuildEngine.py >index 14e61140e7ba..bb9153447793 100644 >--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py >+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py >@@ -18,10 +18,13 @@ from Common.LongFilePathSupport import=20 >OpenLongFilePath as open from Common.GlobalData import * from=20 >Common.BuildToolError import * from Common.Misc import tdict,=20 >PathClass from Common.StringUtils import NormPath from=20 >Common.DataType import * >+from Common.TargetTxtClassObject import TargetTxt=20 >+gDefaultBuildRuleFile =3D 'build_rule.txt' >+AutoGenReqBuildRuleVerNum =3D '0.1' > > import Common.EdkLogger as EdkLogger > > ## Convert file type to file list macro name # @@ -581,10 +584,29 @@=20 >class BuildRule: > _ExtraDependency : ParseCommonSubSection, > _Command : ParseCommonSubSection, > _UnknownSection : SkipSection, > } > >+def GetBuildRule(): >+ BuildRuleFile =3D None >+ if TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.TargetTxtDictionary: >+ BuildRuleFile =3D >TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF] >+ if not BuildRuleFile: >+ BuildRuleFile =3D gDefaultBuildRuleFile >+ RetVal =3D BuildRule(BuildRuleFile) >+ if RetVal._FileVersion =3D=3D "": >+ RetVal._FileVersion =3D AutoGenReqBuildRuleVerNum >+ else: >+ if RetVal._FileVersion < AutoGenReqBuildRuleVerNum : >+ # If Build Rule's version is less than the version number=20 >+ required by the >tools, halting the build. >+ EdkLogger.error("build", AUTOGEN_ERROR, >+ ExtraData=3D"The version number [%s] of=20 >+ build_rule.txt is less >than the version number required by the AutoGen.(the minimum required=20 >version number is [%s])"\ >+ % (RetVal._FileVersion, AutoGenReqBuildRuleV= erNum)) >+ return RetVal >+ >+BuildRuleObj =3D GetBuildRule() >+ > # This acts like the main() function for the script, unless it is=20 >'import'ed into another # script. > if __name__ =3D=3D '__main__': > import sys > EdkLogger.Initialize() >diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py >b/BaseTools/Source/Python/Common/TargetTxtClassObject.py >index 9d7673b41bb5..79a5acc01074 100644 >--- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py >+++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py >@@ -144,10 +144,12 @@ class TargetTxtClassObject(object): > def TargetTxtDict(ConfDir): > Target =3D TargetTxtClassObject() > Target.LoadTargetTxtFile(os.path.normpath(os.path.join(ConfDir, >gDefaultTargetTxtFile))) > return Target > >+TargetTxt =3D TargetTxtDict(os.path.join(os.getenv("WORKSPACE"),"Conf")) >+ > ## > # > # This acts like the main() function for the script, unless it is=20 >'import'ed into another # script. > # >diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py >b/BaseTools/Source/Python/Common/ToolDefClassObject.py >index 5d692ea13cfc..0bfa263270c3 100644 >--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py >+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py >@@ -12,11 +12,11 @@ from __future__ import absolute_import import=20 >Common.LongFilePathOs as os import re from . import EdkLogger > > from .BuildToolError import * >-from Common.TargetTxtClassObject import TargetTxtDict >+from Common.TargetTxtClassObject import TargetTxt > from Common.LongFilePathSupport import OpenLongFilePath as open from=20 >Common.Misc import PathClass from Common.StringUtils import NormPath =20 >import Common.GlobalData as GlobalData from Common import GlobalData=20 >@@ -261,11 +261,11 @@ class ToolDefClassObject(object): > # @param ConfDir: Conf dir > # > # @retval ToolDef An instance of ToolDefClassObject() with loaded=20 >tools_def.txt # def ToolDefDict(ConfDir): >- Target =3D TargetTxtDict(ConfDir) >+ Target =3D TargetTxt > ToolDef =3D ToolDefClassObject() > if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary: > ToolsDefFile =3D >Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF] > if ToolsDefFile: > ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile)) >@@ -273,10 +273,12 @@ def ToolDefDict(ConfDir): > =20 >ToolDef.LoadToolDefFile(os.path.normpath(os.path.join(ConfDir, >gDefaultToolsDefFile))) > else: > ToolDef.LoadToolDefFile(os.path.normpath(os.path.join(ConfDir, >gDefaultToolsDefFile))) > return ToolDef > >+ToolDef =3D ToolDefDict((os.path.join(os.getenv("WORKSPACE"),"Conf"))) >+ > ## > # > # This acts like the main() function for the script, unless it is=20 >'import'ed into another # script. > # >diff --git a/BaseTools/Source/Python/GenFds/GenFds.py >b/BaseTools/Source/Python/GenFds/GenFds.py >index 5888997761bb..51943411ad1f 100644 >--- a/BaseTools/Source/Python/GenFds/GenFds.py >+++ b/BaseTools/Source/Python/GenFds/GenFds.py >@@ -18,11 +18,11 @@ from glob import glob from struct import unpack =20 >from linecache import getlines from io import BytesIO > > import Common.LongFilePathOs as os >-from Common.TargetTxtClassObject import TargetTxtClassObject >+from Common.TargetTxtClassObject import TargetTxt > from Common.DataType import * > import Common.GlobalData as GlobalData from Common import EdkLogger =20 >from Common.StringUtils import NormPath from Common.Misc import=20 >DirCache, PathClass, GuidStructureStringToGuidString @@ -205,12 +205,10=20 >@@ def GenFdsApi(FdsCommandDict, >WorkSpaceDataBase=3DNone): > GenFdsGlobalVariable.ConfDir =3D ConfDirectoryPath > if not GlobalData.gConfDirectory: > GlobalData.gConfDirectory =3D GenFdsGlobalVariable.ConfDir > BuildConfigurationFile =3D >os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt")) > if os.path.isfile(BuildConfigurationFile) =3D=3D True: >- TargetTxt =3D TargetTxtClassObject() >- TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) > # if no build target given in command line, get it from targe= t.txt > if not GenFdsGlobalVariable.TargetName: > BuildTargetList =3D >TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TARGET] > if len(BuildTargetList) !=3D 1: > EdkLogger.error("GenFds", OPTION_VALUE_INVALID,=20 >ExtraData=3D"Only allows one instance for Target.") diff --git=20 >a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py >b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py >index c9c476cf6154..f49af9371b8d 100644 >--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py >+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py >@@ -20,13 +20,13 @@ from array import array > > from Common.BuildToolError import COMMAND_FAILURE,GENFDS_ERROR from=20 > Common import EdkLogger from Common.Misc import SaveFileOnChange > >-from Common.TargetTxtClassObject import TargetTxtClassObject -from=20 >Common.ToolDefClassObject import ToolDefClassObject, ToolDefDict -from=20 >AutoGen.BuildEngine import BuildRule >+from Common.TargetTxtClassObject import TargetTxt from=20 >+Common.ToolDefClassObject import ToolDef from AutoGen.BuildEngine=20 >+import BuildRuleObj > import Common.DataType as DataType > from Common.Misc import PathClass > from Common.LongFilePathSupport import OpenLongFilePath as open from=20 >Common.MultipleWorkspace import MultipleWorkspace as mws import=20 >Common.GlobalData as GlobalData @@ -93,35 +93,25 @@ class=20 >GenFdsGlobalVariable: > # > @staticmethod > def _LoadBuildRule(): > if GenFdsGlobalVariable.__BuildRuleDatabase: > return GenFdsGlobalVariable.__BuildRuleDatabase >- BuildConfigurationFile =3D >os.path.normpath(os.path.join(GenFdsGlobalVariable.ConfDir, "target.txt")) >- TargetTxt =3D TargetTxtClassObject() >- if os.path.isfile(BuildConfigurationFile) =3D=3D True: >- TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) >- if DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF in >TargetTxt.TargetTxtDictionary: >- BuildRuleFile =3D >TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_BUILD_RULE_CO >NF] >- if not BuildRuleFile: >- BuildRuleFile =3D 'Conf/build_rule.txt' >- GenFdsGlobalVariable.__BuildRuleDatabase =3D BuildRule(BuildR= uleFile) >- ToolDefinitionFile =3D >TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_C >ONF] >- if ToolDefinitionFile =3D=3D '': >- ToolDefinitionFile =3D "Conf/tools_def.txt" >- if os.path.isfile(ToolDefinitionFile): >- ToolDef =3D ToolDefClassObject() >- ToolDef.LoadToolDefFile(ToolDefinitionFile) >- ToolDefinition =3D ToolDef.ToolsDefTxtDatabase >- if DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDefini= tion >\ >- and GenFdsGlobalVariable.ToolChainTag in >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \ >- and >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlo >balVariable.ToolChainTag]: >- GenFdsGlobalVariable.BuildRuleFamily =3D >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlo >balVariable.ToolChainTag] >+ GenFdsGlobalVariable.__BuildRuleDatabase =3D BuildRuleObj >+ ToolDefinitionFile =3D >TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_C >ONF] >+ if ToolDefinitionFile =3D=3D '': >+ ToolDefinitionFile =3D "Conf/tools_def.txt" >+ if os.path.isfile(ToolDefinitionFile): >+ ToolDefinition =3D ToolDef.ToolsDefTxtDatabase >+ if DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDefinition= \ >+ and GenFdsGlobalVariable.ToolChainTag in >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \ >+ and >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlo >balVariable.ToolChainTag]: >+ GenFdsGlobalVariable.BuildRuleFamily =3D >ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlo >balVariable.ToolChainTag] > >- if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \ >- and GenFdsGlobalVariable.ToolChainTag in >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \ >- and >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable. >ToolChainTag]: >- GenFdsGlobalVariable.ToolChainFamily =3D >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable. >ToolChainTag] >+ if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \ >+ and GenFdsGlobalVariable.ToolChainTag in >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \ >+ and >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable. >ToolChainTag]: >+ GenFdsGlobalVariable.ToolChainFamily =3D >ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable. >ToolChainTag] > return GenFdsGlobalVariable.__BuildRuleDatabase > > ## GetBuildRules > # @param Inf: object of InfBuildData > # @param Arch: current arch >@@ -834,11 +824,11 @@ class GenFdsGlobalVariable: > # @param KeyStringList Filter for inputs of section generation > # @param CurrentArchList Arch list > # @param NameGuid The Guid name > # > def FindExtendTool(KeyStringList, CurrentArchList, NameGuid): >- ToolDb =3D ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatab= ase >+ ToolDb =3D ToolDef.ToolsDefTxtDatabase > # if user not specify filter, try to deduce it from global data. > if KeyStringList is None or KeyStringList =3D=3D []: > Target =3D GenFdsGlobalVariable.TargetName > ToolChain =3D GenFdsGlobalVariable.ToolChainTag > if ToolChain not in ToolDb['TOOL_CHAIN_TAG']: >@@ -850,19 +840,19 @@ def FindExtendTool(KeyStringList,=20 >CurrentArchList, >NameGuid): > > if GenFdsGlobalVariable.GuidToolDefinition: > if NameGuid in GenFdsGlobalVariable.GuidToolDefinition: > return GenFdsGlobalVariable.GuidToolDefinition[NameGuid] > >- ToolDefinition =3D >ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary >+ ToolDefinition =3D ToolDef.ToolsDefTxtDictionary > ToolPathTmp =3D None > ToolOption =3D None > ToolPathKey =3D None > ToolOptionKey =3D None > KeyList =3D None >- for ToolDef in ToolDefinition.items(): >- if NameGuid.lower() =3D=3D ToolDef[1].lower(): >- KeyList =3D ToolDef[0].split('_') >+ for tool_def in ToolDefinition.items(): >+ if NameGuid.lower() =3D=3D tool_def[1].lower(): >+ KeyList =3D tool_def[0].split('_') > Key =3D KeyList[0] + \ > '_' + \ > KeyList[1] + \ > '_' + \ > KeyList[2] >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index 9f65ad54257d..bfd203aee805 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -17,12 +17,12 @@ from Common.StringUtils import * from=20 >Common.DataType import * from Common.Misc import * from types import=20 >* from Common.Expression import * from CommonDataClass.CommonClass=20 >import SkuInfoClass -from Common.TargetTxtClassObject import=20 >TargetTxtClassObject -from Common.ToolDefClassObject import=20 >ToolDefClassObject >+from Common.TargetTxtClassObject import TargetTxt from=20 >+Common.ToolDefClassObject import ToolDef > from .MetaDataTable import * > from .MetaFileTable import * > from .MetaFileParser import * > > from .WorkspaceCommon import GetDeclaredPcd @@ -3259,19 +3259,15 @@=20 >class DscBuildData(PlatformBuildClassObject): > @property > def ToolChainFamily(self): > self._ToolChainFamily =3D TAB_COMPILER_MSFT > BuildConfigurationFile =3D >os.path.normpath(os.path.join(GlobalData.gConfDirectory, "target.txt")) > if os.path.isfile(BuildConfigurationFile) =3D=3D True: >- TargetTxt =3D TargetTxtClassObject() >- TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) > ToolDefinitionFile =3D >TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_C >ONF] > if ToolDefinitionFile =3D=3D '': > ToolDefinitionFile =3D "tools_def.txt" > ToolDefinitionFile =3D=20 >os.path.normpath(mws.join(self.WorkspaceDir, >'Conf', ToolDefinitionFile)) > if os.path.isfile(ToolDefinitionFile) =3D=3D True: >- ToolDef =3D ToolDefClassObject() >- ToolDef.LoadToolDefFile(ToolDefinitionFile) > ToolDefinition =3D ToolDef.ToolsDefTxtDatabase > if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \ > or self._Toolchain not in=20 >ToolDefinition[TAB_TOD_DEFINES_FAMILY] >\ > or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self._To= olchain]: > self._ToolChainFamily =3D TAB_COMPILER_MSFT diff=20 >--git a/BaseTools/Source/Python/build/build.py >b/BaseTools/Source/Python/build/build.py >index 8c3315619afa..5e13453a1254 100644 >--- a/BaseTools/Source/Python/build/build.py >+++ b/BaseTools/Source/Python/build/build.py >@@ -28,12 +28,12 @@ import threading > from optparse import OptionParser > from subprocess import * > from Common import Misc as Utils > > from Common.LongFilePathSupport import OpenLongFilePath as open -from=20 >Common.TargetTxtClassObject import TargetTxtClassObject -from=20 >Common.ToolDefClassObject import ToolDefClassObject >+from Common.TargetTxtClassObject import TargetTxt from=20 >+Common.ToolDefClassObject import ToolDef > from Common.DataType import * > from Common.BuildVersion import gBUILD_VERSION from AutoGen.AutoGen=20 >import * from Common.BuildToolError import * from=20 >Workspace.WorkspaceDatabase import WorkspaceDatabase @@ -714,12 +714,12=20 >@@ class Build(): > if self.SkuId: > GlobalData.gSKUID_CMD =3D self.SkuId > self.ConfDirectory =3D BuildOptions.ConfDirectory > self.SpawnMode =3D True > self.BuildReport =3D BuildReport(BuildOptions.ReportFile, >BuildOptions.ReportType) >- self.TargetTxt =3D TargetTxtClassObject() >- self.ToolDef =3D ToolDefClassObject() >+ self.TargetTxt =3D TargetTxt >+ self.ToolDef =3D ToolDef > self.AutoGenTime =3D 0 > self.MakeTime =3D 0 > self.GenFdsTime =3D 0 > GlobalData.BuildOptionPcd =3D BuildOptions.OptionPcd if >BuildOptions.OptionPcd else [] > #Set global flag for build mode @@ -813,12 +813,12 @@ class=20 >Build(): > EdkLogger.quiet("%-16s =3D %s" % ("PREBUILD", self.Prebuild)) > if self.Postbuild: > EdkLogger.quiet("%-16s =3D %s" % ("POSTBUILD", self.Postbuild= )) > if self.Prebuild: > self.LaunchPrebuild() >- self.TargetTxt =3D TargetTxtClassObject() >- self.ToolDef =3D ToolDefClassObject() >+ self.TargetTxt =3D TargetTxt >+ self.ToolDef =3D ToolDef > if not (self.LaunchPrebuildFlag and >os.path.exists(self.PlatformBuildPath)): > self.InitBuild() > > EdkLogger.info("") > os.chdir(self.WorkspaceDir) >@@ -826,27 +826,10 @@ class Build(): > ## Load configuration > # > # This method will parse target.txt and get the build configuration= s. > # > def LoadConfiguration(self): >- # >- # Check target.txt and tools_def.txt and Init them >- # >- BuildConfigurationFile =3D >os.path.normpath(os.path.join(GlobalData.gConfDirectory, >gBuildConfiguration)) >- if os.path.isfile(BuildConfigurationFile) =3D=3D True: >- StatusCode =3D self.TargetTxt.LoadTargetTxtFile(BuildConfigur= ationFile) >- >- ToolDefinitionFile =3D >self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF] >- if ToolDefinitionFile =3D=3D '': >- ToolDefinitionFile =3D gToolsDefinition >- ToolDefinitionFile =3D os.path.normpath(mws.join(self.Wor= kspaceDir, >'Conf', ToolDefinitionFile)) >- if os.path.isfile(ToolDefinitionFile) =3D=3D True: >- StatusCode =3D self.ToolDef.LoadToolDefFile(ToolDefinitio= nFile) >- else: >- EdkLogger.error("build", FILE_NOT_FOUND, >ExtraData=3DToolDefinitionFile) >- else: >- EdkLogger.error("build", FILE_NOT_FOUND, >ExtraData=3DBuildConfigurationFile) > > # if no ARCH given in command line, get it from target.txt > if not self.ArchList: > self.ArchList =3D >self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TARGET_ARCH] > self.ArchList =3D tuple(self.ArchList) >-- >2.20.1.windows.1