Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file

2019-07-11 Thread Bob Feng
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 
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 handle 
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, 
> Liming 
> Subject: RE: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object 
> to handle build conf file
> 
> Liming,
> 
> I tested the cases:
> 1. move tool_def.txt and build_rule.txt from Conf to another folder 
> and update target.txt to set BUILD_RULE_CONF and TOOL_CHAIN_CONF to point 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 
change. 

Thanks
Liming
> 2. Move Conf folder to a new place and Set WORKSPACE to point the 
> parent folder of Conf. Append original WORKSPACE folder to 
> PACKAGES_PATH
> 
> My patch works fine.
> 
> But there is a bug in original code for case 1#, I'll send out another patch 
> to fix that.
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 
> 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 
> to handle build conf file
> 
> Liming,
> 
> Thanks for your comments. I'll  test the cases you mentioned.
> 
> Thanks,
> Bob
> 
> -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 
> build conf file
> 
> Bob:
>   target.txt is from Conf directory. build_rule.txt and tools_def.txt 
> are specified in target.txt. Please take care this case that they may have 
> the different file name.
> 
>   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 
> >
> >Subject: [Patch 1/1] 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 
> >---
> > 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 
> >+import
> >gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
> > import shutil
> > from Common.LongFilePathSupport import CopyLongFilePath  from 
> >Common.BuildToolError import *  from Common.DataType import *  from 
> >Common.Misc import * @@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =
> >re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
> >
> > ## Mapping Makefile type
> > gMakeT

Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file

2019-07-11 Thread Liming Gao
Bob:


> -Original Message-
> From: Feng, Bob C
> Sent: Thursday, July 11, 2019 8:13 PM
> To: devel@edk2.groups.io; Feng, Bob C ; Gao, Liming 
> 
> Subject: RE: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to 
> handle build conf file
> 
> Liming,
> 
> I tested the cases:
> 1. move tool_def.txt and build_rule.txt from Conf to another folder and 
> update target.txt to set BUILD_RULE_CONF and
> TOOL_CHAIN_CONF to point 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 
change. 

Thanks
Liming
> 2. Move Conf folder to a new place and Set WORKSPACE to point the parent 
> folder of Conf. Append original WORKSPACE folder to
> PACKAGES_PATH
> 
> My patch works fine.
> 
> But there is a bug in original code for case 1#, I'll send out another patch 
> to fix that.
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 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 to 
> handle build conf file
> 
> Liming,
> 
> Thanks for your comments. I'll  test the cases you mentioned.
> 
> Thanks,
> Bob
> 
> -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 build conf 
> file
> 
> Bob:
>   target.txt is from Conf directory. build_rule.txt and tools_def.txt are 
> specified in target.txt. Please take care this case that they may have
> the different file name.
> 
>   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
> >
> >Subject: [Patch 1/1] 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 
> >---
> > 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
> >+import
> >gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
> > import shutil
> > from Common.LongFilePathSupport import CopyLongFilePath  from
> >Common.BuildToolError import *  from Common.DataType import *  from
> >Common.Misc import * @@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =
> >re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
> >
> > ## Mapping Makefile type
> > gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
> >
> >
> >-## Build rule configuration file
> >-gDefaultBuildRuleFile = 'build_rule.txt'
> >-
> >-## Build rule default version
> >-AutoGenReqBuildRuleVerNum = "0.1"
> >-
> > ## default file name for AutoGen
> > gAutoGenCodeFileName = "AutoGen.c"
> > gAutoGenHeaderFileName = "AutoGen.h"
> > gAutoGenStringFileName = "%(module_name)sStrDefs.h"
> > gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
> >@@ -1964,32 +1959,10 @@ class PlatformA

Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file

2019-07-11 Thread Bob Feng
Liming,

I tested the cases:
1. move tool_def.txt and build_rule.txt from Conf to another folder and update 
target.txt to set BUILD_RULE_CONF and TOOL_CHAIN_CONF to point to the new 
folder.
2. Move Conf folder to a new place and Set WORKSPACE to point the parent folder 
of Conf. Append original WORKSPACE folder to PACKAGES_PATH

My patch works fine.

But there is a bug in original code for case 1#, I'll send out another patch to 
fix that.

Thanks,
Bob

-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 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 to handle 
build conf file

Liming,

Thanks for your comments. I'll  test the cases you mentioned.

Thanks,
Bob

-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 build conf 
file

Bob:
  target.txt is from Conf directory. build_rule.txt and tools_def.txt are 
specified in target.txt. Please take care this case that they may have the 
different file name. 

  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 
>
>Subject: [Patch 1/1] 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 
>---
> 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 
>+import
>gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
> import shutil
> from Common.LongFilePathSupport import CopyLongFilePath  from 
>Common.BuildToolError import *  from Common.DataType import *  from 
>Common.Misc import * @@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =
>re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
>
> ## Mapping Makefile type
> gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
>
>
>-## Build rule configuration file
>-gDefaultBuildRuleFile = 'build_rule.txt'
>-
>-## Build rule default version
>-AutoGenReqBuildRuleVerNum = "0.1"
>-
> ## default file name for AutoGen
> gAutoGenCodeFileName = "AutoGen.c"
> gAutoGenHeaderFileName = "AutoGen.h"
> gAutoGenStringFileName = "%(module_name)sStrDefs.h"
> gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
>@@ -1964,32 +1959,10 @@ class PlatformAutoGen(AutoGen):
> ## Return the build options specific for EDKII modules in this platform
> @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 = None
>-if TAB_TAT_DEFINES_BUILD_RULE_CONF in
>self.Workspace.TargetTxt.TargetTxtDictionary:
>-BuildRuleFile =
>self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RUL
>E_CONF]
>-if not BuildRuleFile:
>-BuildRuleFile = gDefaultBuildRuleFile
>-RetVal = BuildRule(BuildRuleFile)
>-if RetVal._FileVersion == "":
>-RetVal._FileVersion = AutoGenReqBuildRuleVerNum
>-else:
>-if RetVal._FileVersion < AutoGenReqBuildRul

Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file

2019-07-11 Thread Bob Feng
Liming,

Thanks for your comments. I'll  test the cases you mentioned.

Thanks,
Bob

-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 build conf 
file

Bob:
  target.txt is from Conf directory. build_rule.txt and tools_def.txt are 
specified in target.txt. Please take care this case that they may have the 
different file name. 

  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 
>
>Subject: [Patch 1/1] 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 
>---
> 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 
>+import
>gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
> import shutil
> from Common.LongFilePathSupport import CopyLongFilePath  from 
>Common.BuildToolError import *  from Common.DataType import *  from 
>Common.Misc import * @@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =
>re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
>
> ## Mapping Makefile type
> gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
>
>
>-## Build rule configuration file
>-gDefaultBuildRuleFile = 'build_rule.txt'
>-
>-## Build rule default version
>-AutoGenReqBuildRuleVerNum = "0.1"
>-
> ## default file name for AutoGen
> gAutoGenCodeFileName = "AutoGen.c"
> gAutoGenHeaderFileName = "AutoGen.h"
> gAutoGenStringFileName = "%(module_name)sStrDefs.h"
> gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
>@@ -1964,32 +1959,10 @@ class PlatformAutoGen(AutoGen):
> ## Return the build options specific for EDKII modules in this platform
> @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 = None
>-if TAB_TAT_DEFINES_BUILD_RULE_CONF in
>self.Workspace.TargetTxt.TargetTxtDictionary:
>-BuildRuleFile =
>self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RUL
>E_CONF]
>-if not BuildRuleFile:
>-BuildRuleFile = gDefaultBuildRuleFile
>-RetVal = BuildRule(BuildRuleFile)
>-if RetVal._FileVersion == "":
>-RetVal._FileVersion = 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="The version number [%s] of 
>build_rule.txt is less
>than the version number required by the AutoGen.(the minimum required 
>version number is [%s])"\
>- % (RetVal._FileVersion, 
>AutoGenReqBuildRuleVerNum))
>-return RetVal
>-
> ## Summarize the packages used by modules in this platform
> @cached_property
> def PackageList(self):
> RetVal = set()
> for La in self.LibraryAutoGenList:
>@@ -3143,11 +3116,11 @@ class ModuleAutoGen(AutoGen):
> return RetVal
>
> @cached_property
> def BuildRules(self):
> RetVal = {}
>-BuildRuleDatabase = self.PlatformInfo.BuildRule
>+BuildRuleDatabase = BuildRule
> for Type in BuildRuleDatabase.FileTypeList:
> #first try getting build rule by BuildRuleFamily
> RuleObject = BuildRuleDatabase[Type, 

Re: [edk2-devel] [Patch 1/1] BaseTools: Singleton the object to handle build conf file

2019-07-11 Thread Liming Gao
Bob:
  target.txt is from Conf directory. build_rule.txt and tools_def.txt are 
specified in target.txt. Please take care this case that they may have the 
different file name. 

  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 
>Subject: [Patch 1/1] 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 
>---
> 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 import
>gDefaultBuildRuleFile,AutoGenReqBuildRuleVerNum
> import shutil
> from Common.LongFilePathSupport import CopyLongFilePath
> from Common.BuildToolError import *
> from Common.DataType import *
> from Common.Misc import *
>@@ -76,16 +77,10 @@ gEfiVarStoreGuidPattern =
>re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
>
> ## Mapping Makefile type
> gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
>
>
>-## Build rule configuration file
>-gDefaultBuildRuleFile = 'build_rule.txt'
>-
>-## Build rule default version
>-AutoGenReqBuildRuleVerNum = "0.1"
>-
> ## default file name for AutoGen
> gAutoGenCodeFileName = "AutoGen.c"
> gAutoGenHeaderFileName = "AutoGen.h"
> gAutoGenStringFileName = "%(module_name)sStrDefs.h"
> gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
>@@ -1964,32 +1959,10 @@ class PlatformAutoGen(AutoGen):
> ## Return the build options specific for EDKII modules in this platform
> @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 = None
>-if TAB_TAT_DEFINES_BUILD_RULE_CONF in
>self.Workspace.TargetTxt.TargetTxtDictionary:
>-BuildRuleFile =
>self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RUL
>E_CONF]
>-if not BuildRuleFile:
>-BuildRuleFile = gDefaultBuildRuleFile
>-RetVal = BuildRule(BuildRuleFile)
>-if RetVal._FileVersion == "":
>-RetVal._FileVersion = 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="The version number [%s] of 
>build_rule.txt is less
>than the version number required by the AutoGen.(the minimum required
>version number is [%s])"\
>- % (RetVal._FileVersion, 
>AutoGenReqBuildRuleVerNum))
>-return RetVal
>-
> ## Summarize the packages used by modules in this platform
> @cached_property
> def PackageList(self):
> RetVal = set()
> for La in self.LibraryAutoGenList:
>@@ -3143,11 +3116,11 @@ class ModuleAutoGen(AutoGen):
> return RetVal
>
> @cached_property
> def BuildRules(self):
> RetVal = {}
>-BuildRuleDatabase = self.PlatformInfo.BuildRule
>+BuildRuleDatabase = BuildRule
> for Type in BuildRuleDatabase.FileTypeList:
> #first try getting build rule by BuildRuleFamily
> RuleObject = BuildRuleDatabase[Type, self.BuildType, 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
>---