From ab957f036f6711869283217227480b109aedc8ef Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 20 Apr 2021 23:12:51 -0700 Subject: BaseTools/Source/Python: New Target/ToolChain/Arch in DSC [BuildOptions] REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 Update BaseTools to support new build targets, new tool chains, and new architectures declared in DSC file [BuildOptions] sections. * Do not expand * when tools_def.txt is parsed. Only expand when both tools_def.txt and DSC [BuilsOptions] sections have been parsed. This also requires more flexible matching of tool keys that contain * in tool key fields. * Pre-scan the platform DSC file for FAMILY and TOOLCHAIN declarations DSC in [BuildOptions] sections before the FAMILY and TOOLCHAIN need to be known. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Michael D Kinney Reviewed-by: Bob Feng --- .../Source/Python/AutoGen/ModuleAutoGenHelper.py | 50 +++++++++++++++------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py') diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py index 7477b1d77f..167bb59d23 100644 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py @@ -173,17 +173,30 @@ class AutoGenInfo(object): Family = Key[0] Target, Tag, Arch, Tool, Attr = Key[1].split("_") # if tool chain family doesn't match, skip it - if Tool in ToolDef and Family != "": - FamilyIsNull = False - if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "": - if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: - continue - else: - if ToolDef[Tool].get(TAB_TOD_DEFINES_FAMILY, "") == "": - continue - if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: - continue - FamilyMatch = True + if Family != "": + Found = False + if Tool in ToolDef: + FamilyIsNull = False + if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[Tool]: + if Family == ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: + FamilyMatch = True + Found = True + if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]: + if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: + FamilyMatch = True + Found = True + if TAB_STAR in ToolDef: + FamilyIsNull = False + if TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDef[TAB_STAR]: + if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_BUILDRULEFAMILY]: + FamilyMatch = True + Found = True + if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]: + if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]: + FamilyMatch = True + Found = True + if not Found: + continue # expand any wildcard if Target == TAB_STAR or Target == self.BuildTarget: if Tag == TAB_STAR or Tag == self.ToolChain: @@ -213,12 +226,19 @@ class AutoGenInfo(object): Family = Key[0] Target, Tag, Arch, Tool, Attr = Key[1].split("_") # if tool chain family doesn't match, skip it - if Tool not in ToolDef or Family == "": + if Family == "": continue # option has been added before - if TAB_TOD_DEFINES_FAMILY not in ToolDef[Tool]: - continue - if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: + Found = False + if Tool in ToolDef: + if TAB_TOD_DEFINES_FAMILY in ToolDef[Tool]: + if Family == ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: + Found = True + if TAB_STAR in ToolDef: + if TAB_TOD_DEFINES_FAMILY in ToolDef[TAB_STAR]: + if Family == ToolDef[TAB_STAR][TAB_TOD_DEFINES_FAMILY]: + Found = True + if not Found: continue # expand any wildcard -- cgit v1.2.3