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 <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Michael D Kinney
2021-04-20 23:12:51 -07:00
committed by mergify[bot]
parent 612edbe6cd
commit ab957f036f
5 changed files with 230 additions and 96 deletions

View File

@ -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