## @file\r
# This file is used to create a database used by build tool\r
#\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
from Common.DataType import *\r
from Common.Misc import *\r
from types import *\r
+from collections import OrderedDict\r
\r
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject\r
\r
self._Ppis = None\r
self._Guids = None\r
self._Includes = None\r
+ self._CommonIncludes = None\r
self._LibraryClasses = None\r
self._Pcds = None\r
self.__Macros = None\r
\r
## Retrieve public include paths declared in this package\r
def _GetInclude(self):\r
- if self._Includes == None:\r
+ if self._Includes == None or self._CommonIncludes is None:\r
+ self._CommonIncludes = []\r
self._Includes = []\r
self._PrivateIncludes = []\r
PublicInclues = []\r
PublicInclues.append(File)\r
if File in self._PrivateIncludes:\r
EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)\r
-\r
+ if Record[3] == "COMMON":\r
+ self._CommonIncludes.append(File)\r
return self._Includes\r
\r
## Retrieve library class declarations (not used in build at present)\r
\r
\r
def ProcessStructurePcd(self, StructurePcdRawDataSet):\r
- s_pcd_set = dict()\r
+ s_pcd_set = OrderedDict()\r
for s_pcd,LineNo in StructurePcdRawDataSet:\r
if s_pcd.TokenSpaceGuidCName not in s_pcd_set:\r
s_pcd_set[s_pcd.TokenSpaceGuidCName] = []\r
struct_pcd = StructurePcd()\r
for item,LineNo in s_pcd_set[pcdname]:\r
if "<HeaderFiles>" in item.TokenCName:\r
- struct_pcd.StructuredPcdIncludeFile = item.DefaultValue\r
+ struct_pcd.StructuredPcdIncludeFile.append(item.DefaultValue)\r
elif "<Packages>" in item.TokenCName:\r
dep_pkgs.append(item.DefaultValue)\r
elif item.DatumType == item.TokenCName:\r
struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")\r
struct_pcd.PcdDefineLineNo = LineNo\r
struct_pcd.PkgPath = self.MetaFile.File\r
+ struct_pcd.SetDecDefaultValue(item.DefaultValue)\r
else:\r
struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo)\r
\r
struct_pcd.PackageDecs = dep_pkgs\r
-\r
str_pcd_set.append(struct_pcd)\r
-\r
return str_pcd_set\r
\r
## Retrieve PCD declarations for given type\r
list(validlists),\r
list(expressions)\r
)\r
+ PcdObj.DefinitionPosition = (self.MetaFile.File,LineNo)\r
if "." in TokenSpaceGuid:\r
StrPcdSet.append((PcdObj,LineNo))\r
else:\r
StructurePcds = self.ProcessStructurePcd(StrPcdSet)\r
for pcd in StructurePcds:\r
Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd\r
+ StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\r
+ for pcd in Pcds.values():\r
+ if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
+ if StructPattern.match(pcd.DatumType) == None:\r
+ EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", pcd.DefinitionPosition[0],pcd.DefinitionPosition[1])\r
+ for struct_pcd in Pcds.values():\r
+ if isinstance(struct_pcd,StructurePcd) and not struct_pcd.StructuredPcdIncludeFile:\r
+ EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName,struct_pcd.DefinitionPosition[0],struct_pcd.DefinitionPosition[1] ))\r
\r
return Pcds\r
+ @property\r
+ def CommonIncludes(self):\r
+ if self._CommonIncludes is None:\r
+ self.Includes\r
+ return self._CommonIncludes\r
\r
\r
_Macros = property(_GetMacros)\r