BaseTools: optimize buildoptions loop
change a dict to a double defaultdict to prevent needing to seed innter values. move "Value" determination under a conditional continue statement Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
6be947438f
commit
339fe8dd6a
@ -2686,40 +2686,31 @@ class PlatformAutoGen(AutoGen):
|
|||||||
AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() +
|
AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() +
|
||||||
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +
|
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +
|
||||||
self.ToolDefinition.keys())
|
self.ToolDefinition.keys())
|
||||||
BuildOptions = {}
|
BuildOptions = defaultdict(lambda: defaultdict(str))
|
||||||
for Tool in AllTools:
|
for Tool in AllTools:
|
||||||
if Tool not in BuildOptions:
|
|
||||||
BuildOptions[Tool] = {}
|
|
||||||
|
|
||||||
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
|
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
|
||||||
if Tool not in Options:
|
if Tool not in Options:
|
||||||
continue
|
continue
|
||||||
for Attr in Options[Tool]:
|
for Attr in Options[Tool]:
|
||||||
Value = Options[Tool][Attr]
|
|
||||||
#
|
#
|
||||||
# Do not generate it in Makefile
|
# Do not generate it in Makefile
|
||||||
#
|
#
|
||||||
if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
|
if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
|
||||||
continue
|
continue
|
||||||
if Attr not in BuildOptions[Tool]:
|
Value = Options[Tool][Attr]
|
||||||
BuildOptions[Tool][Attr] = ""
|
|
||||||
# check if override is indicated
|
# check if override is indicated
|
||||||
if Value.startswith('='):
|
if Value.startswith('='):
|
||||||
ToolPath = Value[1:]
|
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value[1:])
|
||||||
ToolPath = mws.handleWsMacro(ToolPath)
|
|
||||||
BuildOptions[Tool][Attr] = ToolPath
|
|
||||||
else:
|
else:
|
||||||
Value = mws.handleWsMacro(Value)
|
|
||||||
if Attr != 'PATH':
|
if Attr != 'PATH':
|
||||||
BuildOptions[Tool][Attr] += " " + Value
|
BuildOptions[Tool][Attr] += " " + mws.handleWsMacro(Value)
|
||||||
else:
|
else:
|
||||||
BuildOptions[Tool][Attr] = Value
|
BuildOptions[Tool][Attr] = mws.handleWsMacro(Value)
|
||||||
|
|
||||||
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:
|
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:
|
||||||
#
|
#
|
||||||
# Override UNI flag only for EDK module.
|
# Override UNI flag only for EDK module.
|
||||||
#
|
#
|
||||||
if 'BUILD' not in BuildOptions:
|
|
||||||
BuildOptions['BUILD'] = {}
|
|
||||||
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
|
BuildOptions['BUILD']['FLAGS'] = self.Workspace.UniFlag
|
||||||
return BuildOptions, BuildRuleOrder
|
return BuildOptions, BuildRuleOrder
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user