public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:Break build if same [LibraryClasses] name is used
@ 2018-12-14  1:39 Yonghong Zhu
  0 siblings, 0 replies; only message in thread
From: Yonghong Zhu @ 2018-12-14  1:39 UTC (permalink / raw)
  To: edk2-devel; +Cc: zhijufan, Liming Gao, Bob Feng

From: zhijufan <zhijux.fan@intel.com>

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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=954
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 .../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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-14  1:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14  1:39 [PATCH] BaseTools:Break build if same [LibraryClasses] name is used Yonghong Zhu

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