From nobody Thu Sep 19 01:12:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1533309083596567.9232892630067; Fri, 3 Aug 2018 08:11:23 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A4E3B21BADAB9; Fri, 3 Aug 2018 08:11:18 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4FD97210D83E2 for ; Fri, 3 Aug 2018 08:11:17 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Aug 2018 08:11:16 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga004.jf.intel.com with ESMTP; 03 Aug 2018 08:11:16 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,439,1526367600"; d="scan'208";a="221541445" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 3 Aug 2018 08:11:07 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 2/5] BaseTools: AutoGen - tag a function as cachable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" MakeFile generation is once per module, so mark it as such. also move the time stamp creation function inside as it's only called from one place. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 46 ++++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 1515a52758de..55c84fe4fbc2 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -54,7 +54,7 @@ from collections import OrderedDict from collections import defaultdict from Workspace.WorkspaceCommon import OrderedListDict =20 -from Common.caching import cached_property +from Common.caching import cached_property, cached_class_function =20 ## Regular expression for splitting Dependency Expression string into toke= ns gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") @@ -2677,7 +2677,6 @@ class ModuleAutoGen(AutoGen): self.ToolChainFamily =3D self.PlatformInfo.ToolChainFamily self.BuildRuleFamily =3D self.PlatformInfo.BuildRuleFamily =20 - self.IsMakeFileCreated =3D False self.IsCodeFileCreated =3D False self.IsAsBuiltInfCreated =3D False self.DepexGenerated =3D False @@ -4084,13 +4083,31 @@ class ModuleAutoGen(AutoGen): # @param CreateLibraryMakeFile Flag indicating if or not the = makefiles of # dependent libraries will be cr= eated # + @cached_class_function def CreateMakeFile(self, CreateLibraryMakeFile=3DTrue, GenFfsList =3D = []): + # nest this function inside it's only caller. + def CreateTimeStamp(): + FileSet =3D {self.MetaFile.Path} + + for SourceFile in self.Module.Sources: + FileSet.add (SourceFile.Path) + + for Lib in self.DependentLibraryList: + FileSet.add (Lib.MetaFile.Path) + + for f in self.AutoGenDepSet: + FileSet.add (f.Path) + + if os.path.exists (self.TimeStampPath): + os.remove (self.TimeStampPath) + with open(self.TimeStampPath, 'w+') as file: + for f in FileSet: + print(f, file=3Dfile) + # Ignore generating makefile when it is a binary module if self.IsBinaryModule: return =20 - if self.IsMakeFileCreated: - return self.GenFfsList =3D GenFfsList if not self.IsLibrary and CreateLibraryMakeFile: for LibraryAutoGen in self.LibraryAutoGenList: @@ -4110,8 +4127,7 @@ class ModuleAutoGen(AutoGen): EdkLogger.debug(EdkLogger.DEBUG_9, "Skipped the generation of = makefile for module %s [%s]" % (self.Name, self.Arch)) =20 - self.CreateTimeStamp() - self.IsMakeFileCreated =3D True + CreateTimeStamp() =20 def CopyBinaryFiles(self): for File in self.Module.Binaries: @@ -4284,21 +4300,3 @@ class ModuleAutoGen(AutoGen): @cached_property def TimeStampPath(self): return os.path.join(self.MakeFileDir, 'AutoGenTimeStamp') - - def CreateTimeStamp(self): - FileSet =3D {self.MetaFile.Path} - - for SourceFile in self.Module.Sources: - FileSet.add (SourceFile.Path) - - for Lib in self.DependentLibraryList: - FileSet.add (Lib.MetaFile.Path) - - for f in self.AutoGenDepSet: - FileSet.add (f.Path) - - if os.path.exists (self.TimeStampPath): - os.remove (self.TimeStampPath) - with open(self.TimeStampPath, 'w+') as file: - for f in FileSet: - print(f, file=3Dfile) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel