public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Liming Gao" <liming.gao@intel.com>
To: "Feng, Bob C" <bob.c.feng@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Re: [Patch 1/1] BaseTools: Fixed a incremental build bug
Date: Sun, 19 Jan 2020 02:50:59 +0000	[thread overview]
Message-ID: <97eddb5d06f94f74a3474772d9202aa3@intel.com> (raw)
In-Reply-To: <20200117032808.3464-1-bob.c.feng@intel.com>

Bob:
  This patch fixes the incremental build issue for the header file removement. 
  Please update the commit message with the detail solution. The code change is good. Reviewed-by: Liming Gao <liming.gao@intel.com>

Thanks
Liming
-----Original Message-----
From: Feng, Bob C <bob.c.feng@intel.com> 
Sent: 2020年1月17日 11:28
To: devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [Patch 1/1] BaseTools: Fixed a incremental build bug

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2451

If removing a header file from source code and file system, the incremental build will fail.

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/GenMake.py         | 9 +++++++--
 BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 5 ++++-
 BaseTools/Source/Python/build/build.py             | 3 ++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index fe94f9a4c232..ba199c1aa73d 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1,9 +1,9 @@
 ## @file
 # Create makefile for MS nmake and GNU make  # -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2020, Intel Corporation. All rights 
+reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent  #
 
 ## Import Modules
 #
@@ -189,10 +189,13 @@ class BuildFile(object):
             with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps.txt"),"w+") as fd:
                 fd.write("")
         if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "dependency")):
             with open(os.path.join(self._AutoGenObject.MakeFileDir, "dependency"),"w+") as fd:
                 fd.write("")
+        if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target")):
+            with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target"),"w+") as fd:
+                fd.write("")
         return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False)
 
     ## Return a list of directory creation command string
     #
     #   @param      DirList     The list of directory to be created
@@ -694,11 +697,13 @@ cleanlib:
             "dependent_library_build_directory" : self.LibraryBuildDirectoryList,
             "library_build_command"     : LibraryMakeCommandList,
             "file_macro"                : FileMacroList,
             "file_build_target"         : self.BuildTargetList,
             "backward_compatible_target": BcTargetList,
-            "INCLUDETAG"                   : self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","dependency")
+            "INCLUDETAG"                   : "\n".join([self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","dependency"),
+                                                              self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","deps_target")
+                                                              ])
         }
 
         return MakefileTemplateDict
 
     def ParserGenerateFfsCmd(self):
diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
index bb6e883d84ca..1ca1798907ef 100644
--- a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
@@ -1,9 +1,9 @@
 ## @file
 # Build cache intermediate result and state  # -# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights 
+reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent  #  from Common.caching import cached_property  import Common.EdkLogger as EdkLogger  import Common.LongFilePathOs as os @@ -63,10 +63,13 @@ class IncludesAutoGen():
             deps_include_str = _INCLUDE_DEPS_TEMPLATE.Replace(deps_file)
         except Exception as e:
             print(e)
         SaveFileOnChange(os.path.join(self.makefile_folder,"dependency"),deps_include_str,False)
 
+    def CreateDepsTarget(self):
+        
+ SaveFileOnChange(os.path.join(self.makefile_folder,"deps_target"),"\n"
+ .join([item +":" for item in self.DepsCollection]),False)
+
     @cached_property
     def deps_files(self):
         """ Get all .deps file under module build folder. """
         deps_files = []
         for root, _, files in os.walk(self.d_folder, topdown=False):
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 34acdccbdbd0..1e47e382cba9 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -1,10 +1,10 @@
 ## @file
 # build a platform or a module
 #
 #  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> -#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2020, Intel Corporation. All rights 
+reserved.<BR>
 #  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>  #  #  SPDX-License-Identifier: BSD-2-Clause-Patent  #
 
@@ -278,10 +278,11 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto = None):
         else:
             iau.UpdateDepsFileforNonMsvc()
         iau.UpdateDepsFileforTrim()
         iau.CreateModuleDeps()
         iau.CreateDepsInclude()
+        iau.CreateDepsTarget()
     return "%dms" % (int(round((time.time() - BeginTime) * 1000)))
 
 ## The smallest unit that can be built in multi-thread build mode  #  # This is the base class of build unit. The "Obj" parameter must provide
--
2.20.1.windows.1


      reply	other threads:[~2020-01-19  2:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17  3:28 [Patch 1/1] BaseTools: Fixed a incremental build bug Bob Feng
2020-01-19  2:50 ` Liming Gao [this message]

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=97eddb5d06f94f74a3474772d9202aa3@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