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.120, mailfrom: bob.c.feng@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Wed, 10 Jul 2019 17:58:07 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 17:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,476,1557212400"; d="scan'208";a="171083225" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga006.jf.intel.com with ESMTP; 10 Jul 2019 17:58:05 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Bob Feng Subject: [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated Date: Thu, 11 Jul 2019 08:57:58 +0800 Message-Id: <20190711005758.38980-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ToolDefinitionFile is generated by PlatformAutoGen.ToolDefinition() Code assume ToolDefinition is always called before using ToolDefinitionFile, but in some cases, it's not true. This patch is to fix this issue. Cc: Liming Gao Signed-off-by: Bob Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index c0d0ca15867b..5cfaf2141af0 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1910,22 +1910,25 @@ class PlatformAutoGen(AutoGen): if Attr == "FLAGS": MakeFlags = Value else: ToolsDef += "%s_%s = %s\n" % (Tool, Attr, Value) ToolsDef += "\n" - - SaveFileOnChange(self.ToolDefinitionFile, ToolsDef, False) + tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch) + SaveFileOnChange(tool_def_file, ToolsDef, False) for DllPath in DllPathList: os.environ["PATH"] = DllPath + os.pathsep + os.environ["PATH"] os.environ["MAKE_FLAGS"] = MakeFlags return RetVal ## Return the paths of tools @cached_property def ToolDefinitionFile(self): - return os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch) + tool_def_file = os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch) + if not os.path.exists(tool_def_file): + self.ToolDefinition + return tool_def_file ## Retrieve the toolchain family of given toolchain tag. Default to 'MSFT'. @cached_property def ToolChainFamily(self): ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase -- 2.20.1.windows.1