From db01c8e3d87305a406286e972f19b00c5c6960ab Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Sat, 13 Apr 2019 16:02:02 +0800 Subject: BaseTools: Singleton the object to handle build conf file BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875 The build config files are target.txt, build rule, tooldef During a build, the config is not changed, so the object to handle them need to be singleton. Cc: Liming Gao Signed-off-by: Bob Feng Acked-by: Laszlo Ersek Tested-by: Laszlo Ersek Acked-by: Liming Gao --- BaseTools/Source/Python/build/build.py | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'BaseTools/Source/Python/build/build.py') diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 6bc528974d..07693b9735 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -30,8 +30,8 @@ from subprocess import * from Common import Misc as Utils from Common.LongFilePathSupport import OpenLongFilePath as open -from Common.TargetTxtClassObject import TargetTxtClassObject -from Common.ToolDefClassObject import ToolDefClassObject +from Common.TargetTxtClassObject import TargetTxt +from Common.ToolDefClassObject import ToolDef from Common.DataType import * from Common.BuildVersion import gBUILD_VERSION from AutoGen.AutoGen import * @@ -716,8 +716,8 @@ class Build(): self.ConfDirectory = BuildOptions.ConfDirectory self.SpawnMode = True self.BuildReport = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType) - self.TargetTxt = TargetTxtClassObject() - self.ToolDef = ToolDefClassObject() + self.TargetTxt = TargetTxt + self.ToolDef = ToolDef self.AutoGenTime = 0 self.MakeTime = 0 self.GenFdsTime = 0 @@ -816,8 +816,8 @@ class Build(): EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.Postbuild)) if self.Prebuild: self.LaunchPrebuild() - self.TargetTxt = TargetTxtClassObject() - self.ToolDef = ToolDefClassObject() + self.TargetTxt = TargetTxt + self.ToolDef = ToolDef if not (self.LaunchPrebuildFlag and os.path.exists(self.PlatformBuildPath)): self.InitBuild() @@ -829,23 +829,6 @@ class Build(): # This method will parse target.txt and get the build configurations. # def LoadConfiguration(self): - # - # Check target.txt and tools_def.txt and Init them - # - BuildConfigurationFile = os.path.normpath(os.path.join(GlobalData.gConfDirectory, gBuildConfiguration)) - if os.path.isfile(BuildConfigurationFile) == True: - StatusCode = self.TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) - - ToolDefinitionFile = self.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF] - if ToolDefinitionFile == '': - ToolDefinitionFile = gToolsDefinition - ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile)) - if os.path.isfile(ToolDefinitionFile) == True: - StatusCode = self.ToolDef.LoadToolDefFile(ToolDefinitionFile) - else: - EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=ToolDefinitionFile) - else: - EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile) # if no ARCH given in command line, get it from target.txt if not self.ArchList: -- cgit v1.2.3