]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: AutoGen - refactor class factory
authorCarsey, Jaben <jaben.carsey@intel.com>
Fri, 27 Apr 2018 22:32:23 +0000 (06:32 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 4 May 2018 05:03:01 +0000 (13:03 +0800)
since instances are not added to cache, the factory does nothing.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/AutoGen/BuildEngine.py

index a4f39b0b2925055db9f003feff4339caf83e4a6d..dd6301b01fce4dc3499b7847ae2b0a43631ae8c5 100644 (file)
@@ -47,21 +47,10 @@ def ListFileMacro(FileType):
     return "%s_LIST" % FileListMacro(FileType)\r
 \r
 class TargetDescBlock(object):\r
-    _Cache_ = {}    # {TargetFile : TargetDescBlock object}\r
-\r
-    # Factory method\r
-    def __new__(Class, Inputs, Outputs, Commands, Dependencies):\r
-        if Outputs[0] in Class._Cache_:\r
-            Tdb = Class._Cache_[Outputs[0]]\r
-            for File in Inputs:\r
-                Tdb.AddInput(File)\r
-        else:\r
-            Tdb = super(TargetDescBlock, Class).__new__(Class)\r
-            Tdb._Init(Inputs, Outputs, Commands, Dependencies)\r
-            #Class._Cache_[Outputs[0]] = Tdb\r
-        return Tdb\r
+    def __init__(self, Inputs, Outputs, Commands, Dependencies):\r
+        self.InitWorker(Inputs, Outputs, Commands, Dependencies)\r
 \r
-    def _Init(self, Inputs, Outputs, Commands, Dependencies):\r
+    def InitWorker(self, Inputs, Outputs, Commands, Dependencies):\r
         self.Inputs = Inputs\r
         self.Outputs = Outputs\r
         self.Commands = Commands\r
@@ -90,10 +79,6 @@ class TargetDescBlock(object):
     def IsMultipleInput(self):\r
         return len(self.Inputs) > 1\r
 \r
-    @staticmethod\r
-    def Renew():\r
-        TargetDescBlock._Cache_ = {}\r
-\r
 ## Class for one build rule\r
 #\r
 # This represents a build rule which can give out corresponding command list for\r
@@ -278,7 +263,7 @@ class FileBuildRule:
                         # Command line should be regenerated since some macros are different\r
                         #\r
                         CommandList = self._BuildCommand(BuildRulePlaceholderDict)\r
-                        TargetDesc._Init([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
+                        TargetDesc.InitWorker([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
                         break\r
             else:\r
                 TargetDesc.AddInput(SourceFile)\r