[edk2] [Patch] BaseTools: PCD can only use single access method by source build

Yonghong Zhu posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
[edk2] [Patch] BaseTools: PCD can only use single access method by source build
Posted by Yonghong Zhu 6 years, 11 months ago
Add the error check that A PCD can only use one type for all source
modules.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 8075afc..205a75d 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -502,10 +502,26 @@ class WorkspaceAutoGen(AutoGen):
                         elif 'FixedAtBuild' in BuildData.Pcds[key].Type:
                             if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) not in SourcePcdDict['FixedAtBuild']:
                                 SourcePcdDict['FixedAtBuild'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
                 else:
                     pass
+            #
+            # A PCD can only use one type for all source modules
+            #
+            for i in SourcePcdDict_Keys:
+                for j in SourcePcdDict_Keys:
+                    if i != j:
+                        IntersectionList = list(set(SourcePcdDict[i]).intersection(set(SourcePcdDict[j])))
+                        if len(IntersectionList) > 0:
+                            EdkLogger.error(
+                            'build',
+                            FORMAT_INVALID,
+                            "Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j),
+                            ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) for P in IntersectionList])
+                            )
+                    else:
+                        pass
 
             #
             # intersection the BinaryPCD for Mixed PCD
             #
             for i in BinaryPcdDict_Keys:
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: PCD can only use single access method by source build
Posted by Gao, Liming 6 years, 11 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Wednesday, May 03, 2017 5:21 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: PCD can only use single access method by source
>build
>
>Add the error check that A PCD can only use one type for all source
>modules.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index 8075afc..205a75d 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -502,10 +502,26 @@ class WorkspaceAutoGen(AutoGen):
>                         elif 'FixedAtBuild' in BuildData.Pcds[key].Type:
>                             if (BuildData.Pcds[key].TokenCName,
>BuildData.Pcds[key].TokenSpaceGuidCName) not in
>SourcePcdDict['FixedAtBuild']:
>
>SourcePcdDict['FixedAtBuild'].append((BuildData.Pcds[key].TokenCName,
>BuildData.Pcds[key].TokenSpaceGuidCName))
>                 else:
>                     pass
>+            #
>+            # A PCD can only use one type for all source modules
>+            #
>+            for i in SourcePcdDict_Keys:
>+                for j in SourcePcdDict_Keys:
>+                    if i != j:
>+                        IntersectionList =
>list(set(SourcePcdDict[i]).intersection(set(SourcePcdDict[j])))
>+                        if len(IntersectionList) > 0:
>+                            EdkLogger.error(
>+                            'build',
>+                            FORMAT_INVALID,
>+                            "Building modules from source INFs, following PCD use %s
>and %s access method. It must be corrected to use only one access method." %
>(i, j),
>+                            ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) for P in
>IntersectionList])
>+                            )
>+                    else:
>+                        pass
>
>             #
>             # intersection the BinaryPCD for Mixed PCD
>             #
>             for i in BinaryPcdDict_Keys:
>--
>2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel