BaseTools: Fix bug for GUIDED tool path override by DSC [BuildOptions]
Current the GUIDED tool path can't be override to the different path in the [BuildOptions] of DSC file. This patch fix the bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=283 Cc: Liming Gao <liming.gao@intel.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:
@ -1718,7 +1718,10 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if self.BuildOption[Tool][Attr].startswith('='):
|
if self.BuildOption[Tool][Attr].startswith('='):
|
||||||
Value = self.BuildOption[Tool][Attr][1:]
|
Value = self.BuildOption[Tool][Attr][1:]
|
||||||
else:
|
else:
|
||||||
Value += " " + self.BuildOption[Tool][Attr]
|
if Attr != 'PATH':
|
||||||
|
Value += " " + self.BuildOption[Tool][Attr]
|
||||||
|
else:
|
||||||
|
Value = self.BuildOption[Tool][Attr]
|
||||||
|
|
||||||
if Attr == "PATH":
|
if Attr == "PATH":
|
||||||
# Don't put MAKE definition in the file
|
# Don't put MAKE definition in the file
|
||||||
@ -2381,8 +2384,11 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
||||||
BuildOptions[Tool][Attr] = Options[Key]
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
else:
|
else:
|
||||||
# append options for the same tool
|
# append options for the same tool except PATH
|
||||||
BuildOptions[Tool][Attr] += " " + Options[Key]
|
if Attr != 'PATH':
|
||||||
|
BuildOptions[Tool][Attr] += " " + Options[Key]
|
||||||
|
else:
|
||||||
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
# Build Option Family has been checked, which need't to be checked again for family.
|
# Build Option Family has been checked, which need't to be checked again for family.
|
||||||
if FamilyMatch or FamilyIsNull:
|
if FamilyMatch or FamilyIsNull:
|
||||||
return BuildOptions
|
return BuildOptions
|
||||||
@ -2413,8 +2419,11 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
||||||
BuildOptions[Tool][Attr] = Options[Key]
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
else:
|
else:
|
||||||
# append options for the same tool
|
# append options for the same tool except PATH
|
||||||
BuildOptions[Tool][Attr] += " " + Options[Key]
|
if Attr != 'PATH':
|
||||||
|
BuildOptions[Tool][Attr] += " " + Options[Key]
|
||||||
|
else:
|
||||||
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
return BuildOptions
|
return BuildOptions
|
||||||
|
|
||||||
## Append build options in platform to a module
|
## Append build options in platform to a module
|
||||||
@ -2473,7 +2482,10 @@ class PlatformAutoGen(AutoGen):
|
|||||||
BuildOptions[Tool][Attr] = ToolPath
|
BuildOptions[Tool][Attr] = ToolPath
|
||||||
else:
|
else:
|
||||||
Value = mws.handleWsMacro(Value)
|
Value = mws.handleWsMacro(Value)
|
||||||
BuildOptions[Tool][Attr] += " " + Value
|
if Attr != 'PATH':
|
||||||
|
BuildOptions[Tool][Attr] += " " + Value
|
||||||
|
else:
|
||||||
|
BuildOptions[Tool][Attr] = Value
|
||||||
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:
|
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:
|
||||||
#
|
#
|
||||||
# Override UNI flag only for EDK module.
|
# Override UNI flag only for EDK module.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# generate flash image
|
# generate flash image
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -30,7 +30,7 @@ from EfiSection import EfiSection
|
|||||||
import StringIO
|
import StringIO
|
||||||
import Common.TargetTxtClassObject as TargetTxtClassObject
|
import Common.TargetTxtClassObject as TargetTxtClassObject
|
||||||
import Common.ToolDefClassObject as ToolDefClassObject
|
import Common.ToolDefClassObject as ToolDefClassObject
|
||||||
import Common.DataType
|
from Common.DataType import *
|
||||||
import Common.GlobalData as GlobalData
|
import Common.GlobalData as GlobalData
|
||||||
from Common import EdkLogger
|
from Common import EdkLogger
|
||||||
from Common.String import *
|
from Common.String import *
|
||||||
@ -45,7 +45,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws
|
|||||||
## Version and Copyright
|
## Version and Copyright
|
||||||
versionNumber = "1.0" + ' ' + gBUILD_VERSION
|
versionNumber = "1.0" + ' ' + gBUILD_VERSION
|
||||||
__version__ = "%prog Version " + versionNumber
|
__version__ = "%prog Version " + versionNumber
|
||||||
__copyright__ = "Copyright (c) 2007 - 2016, Intel Corporation All rights reserved."
|
__copyright__ = "Copyright (c) 2007 - 2017, Intel Corporation All rights reserved."
|
||||||
|
|
||||||
## Tool entrance method
|
## Tool entrance method
|
||||||
#
|
#
|
||||||
@ -424,11 +424,11 @@ def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Val
|
|||||||
# @param NameGuid The Guid name
|
# @param NameGuid The Guid name
|
||||||
#
|
#
|
||||||
def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
||||||
|
ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase
|
||||||
# if user not specify filter, try to deduce it from global data.
|
# if user not specify filter, try to deduce it from global data.
|
||||||
if KeyStringList == None or KeyStringList == []:
|
if KeyStringList == None or KeyStringList == []:
|
||||||
Target = GenFdsGlobalVariable.TargetName
|
Target = GenFdsGlobalVariable.TargetName
|
||||||
ToolChain = GenFdsGlobalVariable.ToolChainTag
|
ToolChain = GenFdsGlobalVariable.ToolChainTag
|
||||||
ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase
|
|
||||||
if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:
|
if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:
|
||||||
EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external tool because tool tag %s is not defined in tools_def.txt!" % ToolChain)
|
EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external tool because tool tag %s is not defined in tools_def.txt!" % ToolChain)
|
||||||
KeyStringList = [Target + '_' + ToolChain + '_' + CurrentArchList[0]]
|
KeyStringList = [Target + '_' + ToolChain + '_' + CurrentArchList[0]]
|
||||||
@ -443,6 +443,9 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
|||||||
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
|
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
|
||||||
ToolPathTmp = None
|
ToolPathTmp = None
|
||||||
ToolOption = None
|
ToolOption = None
|
||||||
|
ToolPathKey = None
|
||||||
|
ToolOptionKey = None
|
||||||
|
KeyList = None
|
||||||
for ToolDef in ToolDefinition.items():
|
for ToolDef in ToolDefinition.items():
|
||||||
if NameGuid == ToolDef[1]:
|
if NameGuid == ToolDef[1]:
|
||||||
KeyList = ToolDef[0].split('_')
|
KeyList = ToolDef[0].split('_')
|
||||||
@ -452,24 +455,55 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
|||||||
'_' + \
|
'_' + \
|
||||||
KeyList[2]
|
KeyList[2]
|
||||||
if Key in KeyStringList and KeyList[4] == 'GUID':
|
if Key in KeyStringList and KeyList[4] == 'GUID':
|
||||||
|
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
|
||||||
ToolPath = ToolDefinition.get(Key + \
|
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
|
||||||
'_' + \
|
ToolPath = ToolDefinition.get(ToolPathKey)
|
||||||
KeyList[3] + \
|
ToolOption = ToolDefinition.get(ToolOptionKey)
|
||||||
'_' + \
|
|
||||||
'PATH')
|
|
||||||
|
|
||||||
ToolOption = ToolDefinition.get(Key + \
|
|
||||||
'_' + \
|
|
||||||
KeyList[3] + \
|
|
||||||
'_' + \
|
|
||||||
'FLAGS')
|
|
||||||
if ToolPathTmp == None:
|
if ToolPathTmp == None:
|
||||||
ToolPathTmp = ToolPath
|
ToolPathTmp = ToolPath
|
||||||
else:
|
else:
|
||||||
if ToolPathTmp != ToolPath:
|
if ToolPathTmp != ToolPath:
|
||||||
EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))
|
EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))
|
||||||
|
|
||||||
|
BuildOption = {}
|
||||||
|
for Arch in CurrentArchList:
|
||||||
|
Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||||
|
# key is (ToolChainFamily, ToolChain, CodeBase)
|
||||||
|
for item in Platform.BuildOptions:
|
||||||
|
if '_PATH' in item[1] or '_FLAGS' in item[1] or '_GUID' in item[1]:
|
||||||
|
if not item[0] or (item[0] and GenFdsGlobalVariable.ToolChainFamily== item[0]):
|
||||||
|
if item[1] not in BuildOption:
|
||||||
|
BuildOption[item[1]] = Platform.BuildOptions[item]
|
||||||
|
if BuildOption:
|
||||||
|
ToolList = [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG, TAB_TOD_DEFINES_TARGET_ARCH]
|
||||||
|
for Index in range(2, -1, -1):
|
||||||
|
for Key in dict(BuildOption):
|
||||||
|
List = Key.split('_')
|
||||||
|
if List[Index] == '*':
|
||||||
|
for String in ToolDb[ToolList[Index]]:
|
||||||
|
if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
|
||||||
|
List[Index] = String
|
||||||
|
NewKey = '%s_%s_%s_%s_%s' % tuple(List)
|
||||||
|
if NewKey not in BuildOption:
|
||||||
|
BuildOption[NewKey] = BuildOption[Key]
|
||||||
|
continue
|
||||||
|
del BuildOption[Key]
|
||||||
|
elif List[Index] not in ToolDb[ToolList[Index]]:
|
||||||
|
del BuildOption[Key]
|
||||||
|
if BuildOption:
|
||||||
|
if not KeyList:
|
||||||
|
for Op in BuildOption:
|
||||||
|
if NameGuid == BuildOption[Op]:
|
||||||
|
KeyList = Op.split('_')
|
||||||
|
Key = KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2]
|
||||||
|
if Key in KeyStringList and KeyList[4] == 'GUID':
|
||||||
|
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
|
||||||
|
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
|
||||||
|
if ToolPathKey in BuildOption.keys():
|
||||||
|
ToolPathTmp = BuildOption.get(ToolPathKey)
|
||||||
|
if ToolOptionKey in BuildOption.keys():
|
||||||
|
ToolOption = BuildOption.get(ToolOptionKey)
|
||||||
|
|
||||||
GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)
|
GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)
|
||||||
return ToolPathTmp, ToolOption
|
return ToolPathTmp, ToolOption
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user