public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <liming.gao@intel.com>, Bob Feng <bob.c.feng@intel.com>
Subject: [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
Date: Thu, 11 Jul 2019 08:57:58 +0800	[thread overview]
Message-ID: <20190711005758.38980-1-bob.c.feng@intel.com> (raw)

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 <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
---
 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


             reply	other threads:[~2019-07-11  0:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11  0:57 Bob Feng [this message]
2019-07-11  6:53 ` [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated Liming Gao
     [not found] ` <15B047D3656769CD.30788@groups.io>
2019-07-12  9:12   ` Liming Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711005758.38980-1-bob.c.feng@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox