public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
@ 2019-07-11  0:57 Bob Feng
  2019-07-11  6:53 ` [edk2-devel] " Liming Gao
       [not found] ` <15B047D3656769CD.30788@groups.io>
  0 siblings, 2 replies; 3+ messages in thread
From: Bob Feng @ 2019-07-11  0:57 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Bob Feng

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
  2019-07-11  0:57 [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated Bob Feng
@ 2019-07-11  6:53 ` Liming Gao
       [not found] ` <15B047D3656769CD.30788@groups.io>
  1 sibling, 0 replies; 3+ messages in thread
From: Liming Gao @ 2019-07-11  6:53 UTC (permalink / raw)
  To: devel@edk2.groups.io, Feng, Bob C

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Bob Feng
>Sent: Thursday, July 11, 2019 8:58 AM
>To: devel@edk2.groups.io
>Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
>Subject: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when
>ToolDefinitionFile is not generated
>
>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
>
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
       [not found] ` <15B047D3656769CD.30788@groups.io>
@ 2019-07-12  9:12   ` Liming Gao
  0 siblings, 0 replies; 3+ messages in thread
From: Liming Gao @ 2019-07-12  9:12 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Feng, Bob C

Push @2d100d1d73a9f9a38f224e87c48276ba1e84d8ce

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao
> Sent: Thursday, July 11, 2019 2:54 PM
> To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
> Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated
> 
> Reviewed-by: Liming Gao <liming.gao@intel.com>
> 
> >-----Original Message-----
> >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> >Bob Feng
> >Sent: Thursday, July 11, 2019 8:58 AM
> >To: devel@edk2.groups.io
> >Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
> >Subject: [edk2-devel] [Patch 1/1] BaseTools: Fixed the issue when
> >ToolDefinitionFile is not generated
> >
> >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
> >
> >
> >
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-12  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-11  0:57 [Patch 1/1] BaseTools: Fixed the issue when ToolDefinitionFile is not generated Bob Feng
2019-07-11  6:53 ` [edk2-devel] " Liming Gao
     [not found] ` <15B047D3656769CD.30788@groups.io>
2019-07-12  9:12   ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox