BaseTools: Fixed BuildOptions bug.
The BuildOptions in an INF should also follow override rule: If '==' is used, all previous options are overridden. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu <yingke.d.liu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17796 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -2000,7 +2000,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if Options.get((self.BuildRuleFamily, NowKey)) != None:
|
if Options.get((self.BuildRuleFamily, NowKey)) != None:
|
||||||
Options.pop((self.BuildRuleFamily, NowKey))
|
Options.pop((self.BuildRuleFamily, NowKey))
|
||||||
|
|
||||||
OverrideOpt = set()
|
|
||||||
for Key in Options:
|
for Key in Options:
|
||||||
if ModuleStyle != None and len (Key) > 2:
|
if ModuleStyle != None and len (Key) > 2:
|
||||||
# Check Module style is EDK or EDKII.
|
# Check Module style is EDK or EDKII.
|
||||||
@ -2026,9 +2025,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if Arch == "*" or Arch == self.Arch:
|
if Arch == "*" or Arch == self.Arch:
|
||||||
if Tool not in BuildOptions:
|
if Tool not in BuildOptions:
|
||||||
BuildOptions[Tool] = {}
|
BuildOptions[Tool] = {}
|
||||||
if Options[Key].startswith('='):
|
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
||||||
OverrideOpt.add((Tool, Attr))
|
|
||||||
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt:
|
|
||||||
BuildOptions[Tool][Attr] = Options[Key]
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
else:
|
else:
|
||||||
# append options for the same tool
|
# append options for the same tool
|
||||||
@ -2037,7 +2034,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if FamilyMatch or FamilyIsNull:
|
if FamilyMatch or FamilyIsNull:
|
||||||
return BuildOptions
|
return BuildOptions
|
||||||
|
|
||||||
OverrideOpt = set()
|
|
||||||
for Key in Options:
|
for Key in Options:
|
||||||
if ModuleStyle != None and len (Key) > 2:
|
if ModuleStyle != None and len (Key) > 2:
|
||||||
# Check Module style is EDK or EDKII.
|
# Check Module style is EDK or EDKII.
|
||||||
@ -2061,9 +2057,7 @@ class PlatformAutoGen(AutoGen):
|
|||||||
if Arch == "*" or Arch == self.Arch:
|
if Arch == "*" or Arch == self.Arch:
|
||||||
if Tool not in BuildOptions:
|
if Tool not in BuildOptions:
|
||||||
BuildOptions[Tool] = {}
|
BuildOptions[Tool] = {}
|
||||||
if Options[Key].startswith('='):
|
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
|
||||||
OverrideOpt.add((Tool, Attr))
|
|
||||||
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or (Tool, Attr) in OverrideOpt:
|
|
||||||
BuildOptions[Tool][Attr] = Options[Key]
|
BuildOptions[Tool][Attr] = Options[Key]
|
||||||
else:
|
else:
|
||||||
# append options for the same tool
|
# append options for the same tool
|
||||||
@ -2103,7 +2097,6 @@ class PlatformAutoGen(AutoGen):
|
|||||||
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +
|
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() +
|
||||||
self.ToolDefinition.keys())
|
self.ToolDefinition.keys())
|
||||||
BuildOptions = {}
|
BuildOptions = {}
|
||||||
OverrideTool = set()
|
|
||||||
for Tool in AllTools:
|
for Tool in AllTools:
|
||||||
if Tool not in BuildOptions:
|
if Tool not in BuildOptions:
|
||||||
BuildOptions[Tool] = {}
|
BuildOptions[Tool] = {}
|
||||||
@ -2122,9 +2115,8 @@ class PlatformAutoGen(AutoGen):
|
|||||||
BuildOptions[Tool][Attr] = ""
|
BuildOptions[Tool][Attr] = ""
|
||||||
# check if override is indicated
|
# check if override is indicated
|
||||||
if Value.startswith('='):
|
if Value.startswith('='):
|
||||||
OverrideTool.add((Tool, Attr))
|
|
||||||
BuildOptions[Tool][Attr] = Value[1:]
|
BuildOptions[Tool][Attr] = Value[1:]
|
||||||
elif (Tool, Attr) not in OverrideTool:
|
else:
|
||||||
BuildOptions[Tool][Attr] += " " + Value
|
BuildOptions[Tool][Attr] += " " + Value
|
||||||
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:
|
if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:
|
||||||
#
|
#
|
||||||
|
@ -753,7 +753,6 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
## Retrieve [BuildOptions]
|
## Retrieve [BuildOptions]
|
||||||
def _GetBuildOptions(self):
|
def _GetBuildOptions(self):
|
||||||
if self._BuildOptions == None:
|
if self._BuildOptions == None:
|
||||||
OverrideTool = set()
|
|
||||||
self._BuildOptions = sdict()
|
self._BuildOptions = sdict()
|
||||||
#
|
#
|
||||||
# Retrieve build option for EDKII and EDK style module
|
# Retrieve build option for EDKII and EDK style module
|
||||||
@ -762,12 +761,10 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase]
|
RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, CodeBase]
|
||||||
for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:
|
for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:
|
||||||
CurKey = (ToolChainFamily, ToolChain, CodeBase)
|
CurKey = (ToolChainFamily, ToolChain, CodeBase)
|
||||||
if Option.startswith('='):
|
|
||||||
OverrideTool.add(CurKey)
|
|
||||||
#
|
#
|
||||||
# Only flags can be appended
|
# Only flags can be appended
|
||||||
#
|
#
|
||||||
if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or CurKey in OverrideTool:
|
if CurKey not in self._BuildOptions or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
|
||||||
self._BuildOptions[CurKey] = Option
|
self._BuildOptions[CurKey] = Option
|
||||||
else:
|
else:
|
||||||
self._BuildOptions[CurKey] += ' ' + Option
|
self._BuildOptions[CurKey] += ' ' + Option
|
||||||
@ -778,16 +775,13 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
self._ModuleTypeOptions = sdict()
|
self._ModuleTypeOptions = sdict()
|
||||||
if (Edk, ModuleType) not in self._ModuleTypeOptions:
|
if (Edk, ModuleType) not in self._ModuleTypeOptions:
|
||||||
options = sdict()
|
options = sdict()
|
||||||
OverrideTool = set()
|
|
||||||
self._ModuleTypeOptions[Edk, ModuleType] = options
|
self._ModuleTypeOptions[Edk, ModuleType] = options
|
||||||
DriverType = '%s.%s' % (Edk, ModuleType)
|
DriverType = '%s.%s' % (Edk, 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 Arch == self._Arch and Type == DriverType:
|
if Type == DriverType:
|
||||||
Key = (ToolChainFamily, ToolChain, Edk)
|
Key = (ToolChainFamily, ToolChain, Edk)
|
||||||
if Option.startswith('='):
|
if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
|
||||||
OverrideTool.add(Key)
|
|
||||||
if Key not in options or not ToolChain.endswith('_FLAGS') or Key in OverrideTool:
|
|
||||||
options[Key] = Option
|
options[Key] = Option
|
||||||
else:
|
else:
|
||||||
options[Key] += ' ' + Option
|
options[Key] += ' ' + Option
|
||||||
@ -2399,7 +2393,7 @@ class InfBuildData(ModuleBuildClassObject):
|
|||||||
ToolChainFamily = Record[0]
|
ToolChainFamily = Record[0]
|
||||||
ToolChain = Record[1]
|
ToolChain = Record[1]
|
||||||
Option = Record[2]
|
Option = Record[2]
|
||||||
if (ToolChainFamily, ToolChain) not in self._BuildOptions:
|
if (ToolChainFamily, ToolChain) not in self._BuildOptions or Option.startswith('='):
|
||||||
self._BuildOptions[ToolChainFamily, ToolChain] = Option
|
self._BuildOptions[ToolChainFamily, ToolChain] = Option
|
||||||
else:
|
else:
|
||||||
# concatenate the option string if they're for the same tool
|
# concatenate the option string if they're for the same tool
|
||||||
|
Reference in New Issue
Block a user