summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/BuildEngine.py
diff options
context:
space:
mode:
authorFeng, Bob C <bob.c.feng@intel.com>2019-04-13 16:02:02 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-08-09 23:15:51 +0800
commitdb01c8e3d87305a406286e972f19b00c5c6960ab (patch)
tree68b75b18c650656b3e5c7204be1e8b7e6f666d63 /BaseTools/Source/Python/AutoGen/BuildEngine.py
parent4b1b7c1913092d73d689d8086dcfa579c0217dc8 (diff)
downloadedk2-db01c8e3d87305a406286e972f19b00c5c6960ab.tar.gz
edk2-db01c8e3d87305a406286e972f19b00c5c6960ab.tar.bz2
edk2-db01c8e3d87305a406286e972f19b00c5c6960ab.zip
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 <liming.gao@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/BuildEngine.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/BuildEngine.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 14e61140e7..bb91534477 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -20,6 +20,9 @@ from Common.BuildToolError import *
from Common.Misc import tdict, PathClass
from Common.StringUtils import NormPath
from Common.DataType import *
+from Common.TargetTxtClassObject import TargetTxt
+gDefaultBuildRuleFile = 'build_rule.txt'
+AutoGenReqBuildRuleVerNum = '0.1'
import Common.EdkLogger as EdkLogger
@@ -583,6 +586,25 @@ class BuildRule:
_UnknownSection : SkipSection,
}
+def GetBuildRule():
+ BuildRuleFile = None
+ if TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.TargetTxtDictionary:
+ BuildRuleFile = TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_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
+
+BuildRuleObj = GetBuildRule()
+
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
if __name__ == '__main__':