BaseTools: Fix a bug use 'COMMON' as CodeBase in BuildOptions section

Current BaseTools query the BuildOptions not cover the case that use
'COMMON' as CodeBase, while DSC spec allow this usage. This Patch add
support for such 'common.DXE_RUNTIME_DRIVER' as the Scope2 in the query
Condition.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Kurt Kennett <Kurt.Kennett@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2016-08-17 18:52:51 +08:00
parent 91ae2988c6
commit 35dc964bf1
2 changed files with 9 additions and 2 deletions

View File

@ -341,7 +341,13 @@ class PlatformTable(MetaFileTable):
if Scope1 != None and Scope1 != 'COMMON': if Scope1 != None and Scope1 != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1 ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1
if Scope2 != None and Scope2 != 'COMMON': if Scope2 != None and Scope2 != 'COMMON':
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2 # Cover the case that CodeBase is 'COMMON' for BuildOptions section
if '.' in Scope2:
Index = Scope2.index('.')
NewScope = 'COMMON'+ Scope2[Index:]
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT' OR Scope2='%s')" % (Scope2, NewScope)
else:
ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2
if BelongsToItem != None: if BelongsToItem != None:
ConditionString += " AND BelongsToItem=%s" % BelongsToItem ConditionString += " AND BelongsToItem=%s" % BelongsToItem

View File

@ -802,9 +802,10 @@ class DscBuildData(PlatformBuildClassObject):
options = sdict() options = sdict()
self._ModuleTypeOptions[Edk, ModuleType] = options self._ModuleTypeOptions[Edk, ModuleType] = options
DriverType = '%s.%s' % (Edk, ModuleType) DriverType = '%s.%s' % (Edk, ModuleType)
CommonDriverType = '%s.%s' % ('COMMON', ModuleType)
RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType] RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType]
for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList: for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList:
if Type == DriverType: if Type == DriverType or Type == CommonDriverType:
Key = (ToolChainFamily, ToolChain, Edk) Key = (ToolChainFamily, ToolChain, Edk)
if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='): if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
options[Key] = Option options[Key] = Option