BaseTools: Support DSC component !include PCD items
authorYunhua Feng <yunhuax.feng@intel.com>
Tue, 10 Apr 2018 02:50:25 +0000 (10:50 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 19 Apr 2018 07:47:36 +0000 (15:47 +0800)
DSC format:
[Components]
  TestPkg/TestDriver.inf {
    <PcdsFixedAtBuild>
      !include TestPkg/Test.txt
  }

Test.txt content:
PcdToken.PcdCName | 0x123

Per spec we should support this usage.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/Workspace/MetaFileParser.py

index 3d123147170932e5c220814b1d06c6bc553c84b7..322ed384496658635e8b87c1de4e75d6d564713c 100644 (file)
@@ -1538,9 +1538,13 @@ class DscParser(MetaFileParser):
             self._FileWithError = IncludedFile1\r
 \r
             IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False)\r
-            Owner = self._Content[self._ContentIndex - 1][0]\r
+            FromItem = self._Content[self._ContentIndex - 1][0]\r
+            if self._Content[self._ContentIndex - 1][8] != -1.0:\r
+                Owner = self._Content[self._ContentIndex - 1][8]\r
+            else:\r
+                Owner = self._Content[self._ContentIndex - 1][0]\r
             Parser = DscParser(IncludedFile1, self._FileType, self._Arch, IncludedFileTable,\r
-                               Owner=Owner, From=Owner)\r
+                               Owner=Owner, From=FromItem)\r
 \r
             self.IncludedFiles.add (IncludedFile1)\r
 \r
@@ -1552,7 +1556,10 @@ class DscParser(MetaFileParser):
 \r
             # set the parser status with current status\r
             Parser._SectionName = self._SectionName\r
-            Parser._SectionType = self._SectionType\r
+            if self._InSubsection:\r
+                Parser._SectionType = self._SubsectionType\r
+            else:\r
+                Parser._SectionType = self._SectionType\r
             Parser._Scope = self._Scope\r
             Parser._Enabled = self._Enabled\r
             # Parse the included file\r