From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: bob.c.feng@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Thu, 11 Jul 2019 07:57:06 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2019 07:57:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,478,1557212400"; d="scan'208";a="317701488" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 11 Jul 2019 07:57:05 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jul 2019 07:57:04 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0439.000; Thu, 11 Jul 2019 22:57:03 +0800 From: "Bob Feng" To: "Gao, Liming" , "devel@edk2.groups.io" Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file Thread-Topic: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file Thread-Index: AQHVLYAmRtqITLoqbEObuMv2expNvqbEsBKAgACJu6CAACl+IP//pheAgACMR3A= Date: Thu, 11 Jul 2019 14:57:02 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160B3DF78@SHSMSX105.ccr.corp.intel.com> References: <20190628070703.17224-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A6513@SHSMSX104.ccr.corp.intel.com> <15B0502B4303BDC5.2265@groups.io> <08650203BA1BD64D8AD9B6D5D74A85D160B3DDD0@SHSMSX105.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A688E@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4A688E@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWE5Y2FiMzQtN2U0MS00ZjVjLWEzNDctMmMyMzRkZTJiMjk2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOHpWbnc3RlRrTHZ1bkxYeW5ocDlFdXJTM1ZQQWJIelVNUEVrdG96K1NGd3poSHJPQmtDMVdRc2VlOWEyTVwvWUoifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action 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 Yes. it will work after I fix this bug in WorkspaceAutoGen._GetMetaFiles() Here, the code assumes the tools_def.txt and build_rule.txt are always in = Conf directory. # # add build_rule.txt & tools_def.txt # AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, = gDefaultBuildRuleFile)) AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, = gDefaultToolsDefFile)) Thanks, Bob -----Original Message----- From: Gao, Liming=20 Sent: Thursday, July 11, 2019 10:31 PM To: Feng, Bob C ; devel@edk2.groups.io Subject: RE: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to h= andle build conf file Bob: > -----Original Message----- > From: Feng, Bob C > Sent: Thursday, July 11, 2019 8:13 PM > To: devel@edk2.groups.io; Feng, Bob C ; Gao,=20 > Liming > Subject: RE: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object=20 > to handle build conf file >=20 > Liming, >=20 > I tested the cases: > 1. move tool_def.txt and build_rule.txt from Conf to another folder=20 > and update target.txt to set BUILD_RULE_CONF and TOOL_CHAIN_CONF to poin= t to the new folder. If their file name is also changed in target.txt, does it work in current = BaseTools? I just want to make sure keep the same support scope with this c= hange.=20 Thanks Liming > 2. Move Conf folder to a new place and Set WORKSPACE to point the=20 > parent folder of Conf. Append original WORKSPACE folder to=20 > PACKAGES_PATH >=20 > My patch works fine. >=20 > But there is a bug in original code for case 1#, I'll send out another p= atch to fix that. >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of=20 > Bob Feng > Sent: Thursday, July 11, 2019 5:27 PM > To: Gao, Liming ; devel@edk2.groups.io > Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object=20 > to handle build conf file >=20 > Liming, >=20 > Thanks for your comments. I'll test the cases you mentioned. >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: Gao, Liming > 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=20 > build conf file >=20 > Bob: > target.txt is from Conf directory. build_rule.txt and tools_def.txt=20 > are specified in target.txt. Please take care this case that they may ha= ve the different file name. >=20 > And, Conf directory is relative to WORKSPACE and PACKAGES_PATH. Does t= his patch support it? >=20 > 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=20 > >to 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 .= =20 > >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 pla= tform > > @cached_property > > def EdkIIBuildOption(self): > > return self._ExpandBuildOption(self.Platform.BuildOptions, > >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_RU > >L > >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 num= ber required by > >the tools, halting the build. > >- EdkLogger.error("build", AUTOGEN_ERROR, > >- ExtraData=3D"The version number [%s] o= f build_rule.txt is less > >than the version number required by the AutoGen.(the minimum required= =20 > >version number is [%s])"\ > >- % (RetVal._FileVersion, AutoGenReqBui= ldRuleVerNum)) > >- 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.TargetTxtDictionar= y: > >+ 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=20 > >+ number 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, AutoGenReqBuildRu= leVerNum)) > >+ 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=20 > >+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 Common.Misc import PathClass from Common.StringUtils import=20 > >NormPath import Common.GlobalData as GlobalData from Common import=20 > >GlobalData @@ -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): > > > >ToolDef.LoadToolDefFile(os.path.normpath(os.path.join(ConfDir, > >gDefaultToolsDefFile))) > > else: > > =20 > >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=20 > >+205,10 @@ 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 ta= rget.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=20 > >-from 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 Common.MultipleWorkspace import MultipleWorkspace as mws import= =20 > >Common.GlobalData as GlobalData @@ -93,35 +93,25 @@ class > >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(Bui= ldRuleFile) > >- 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 ToolDef= inition > >\ > >- 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 ToolDefinit= ion \ > >+ 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).ToolsDefTxtDa= tabase > >+ 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=20 > >import > >* 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.= _Toolchain]: > > 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=20 > >-from 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=20 > >+714,12 @@ 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 > >Build(): > > EdkLogger.quiet("%-16s =3D %s" % ("PREBUILD", self.Prebuil= d)) > > if self.Postbuild: > > EdkLogger.quiet("%-16s =3D %s" % ("POSTBUILD", self.Postbu= ild)) > > 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 configurat= ions. > > # > > 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(BuildConfi= gurationFile) > >- > >- 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.= WorkspaceDir, > >'Conf', ToolDefinitionFile)) > >- if os.path.isfile(ToolDefinitionFile) =3D=3D True: > >- StatusCode =3D self.ToolDef.LoadToolDefFile(ToolDefini= tionFile) > >- 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 >=20 >=20 >=20