From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 421AE211A3225 for ; Thu, 13 Dec 2018 17:41:00 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2018 17:39:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,351,1539673200"; d="scan'208";a="98630369" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.127]) by orsmga007.jf.intel.com with ESMTP; 13 Dec 2018 17:39:36 -0800 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: zhijufan , Liming Gao , Bob Feng Date: Fri, 14 Dec 2018 09:39:33 +0800 Message-Id: <1544751573-12136-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [PATCH] BaseTools:Break build if same [LibraryClasses] name is used X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 01:41:00 -0000 From: zhijufan For example if both PackageA and PackageB declare the [LibraryClasses] name of MyLibClass, that is mapped to an include file in each package: PackageA.dec [LibraryClasses] MyLibClass|Include/Library/MyLibClass.h PackageB.dec [LibraryClasses] MyLibClass|Include/Library/MyLibClass.h Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=954 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- .../Python/Workspace/WorkspaceCommon.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index 55d01fa4b2..b05ed98888 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -20,7 +20,8 @@ from Workspace.BuildClassObject import StructurePcd from Common.BuildToolError import RESOURCE_NOT_AVAILABLE from Common.BuildToolError import OPTION_MISSING from Common.BuildToolError import BUILD_ERROR - +from Common.BuildToolError import OPTION_CONFLICT +from Common import EdkLogger as EdkLogger class OrderedListDict(OrderedDict): def __init__(self, *args, **kwargs): super(OrderedListDict, self).__init__(*args, **kwargs) @@ -48,6 +49,21 @@ def GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain): PkgSet.update(Lib.Packages) return list(PkgSet) +# Check that the LibraryClasses name are the same +def CheckLibraryClassesName(PkgList): + LibraryDict = {} + for Pkg in PkgList: + LibCls = Pkg.LibraryClasses + for Lib in LibCls: + if Lib in LibraryDict: + if LibraryDict[Lib] != str(Pkg): + EdkLogger.error("build", OPTION_CONFLICT, + "ClassName is conflicted,Please change the ClassName", + ExtraData="in [%s] [%s]\n\tClassName is [%s]" % ( + LibraryDict[Lib], str(Pkg), Lib)) + else: + LibraryDict[Lib] = str(Pkg) + ## Get all declared PCD from platform for specified arch, target and toolchain # # @param Platform: DscBuildData instance @@ -60,6 +76,7 @@ def GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain): # def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalPkgs): PkgList = GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain) + CheckLibraryClassesName(PkgList) PkgList = set(PkgList) PkgList |= additionalPkgs DecPcds = {} -- 2.18.0.windows.1