.pytool: CompilerPlugin: Pass through build vars

Pass build variables (those passed to build.py through -D) to the DSC
parser to provide a more accurate parsing of the DSC file.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
This commit is contained in:
Joey Vagedes 2024-06-27 08:43:48 -07:00 committed by mergify[bot]
parent 6b256cef01
commit 4f174696fd
1 changed files with 4 additions and 3 deletions

View File

@ -74,9 +74,10 @@ class CompilerPlugin(ICiBuildPlugin):
self._env.SetValue("ACTIVE_PLATFORM", AP_Path, "Set in Compiler Plugin")
# Parse DSC to check for SUPPORTED_ARCHITECTURES
build_target = self._env.GetValue("TARGET")
input_vars = self._env.GetAllBuildKeyValues(build_target)
dp = DscParser()
dp.SetBaseAbsPath(Edk2pathObj.WorkspacePath)
dp.SetPackagePaths(Edk2pathObj.PackagePathList)
dp.SetEdk2Path(Edk2pathObj).SetInputVars(input_vars)
dp.ParseFile(AP_Path)
if "SUPPORTED_ARCHITECTURES" in dp.LocalVars:
SUPPORTED_ARCHITECTURES = dp.LocalVars["SUPPORTED_ARCHITECTURES"].split('|')
@ -85,7 +86,7 @@ class CompilerPlugin(ICiBuildPlugin):
# Skip if there is no intersection between SUPPORTED_ARCHITECTURES and TARGET_ARCHITECTURES
if len(set(SUPPORTED_ARCHITECTURES) & set(TARGET_ARCHITECTURES)) == 0:
tc.SetSkipped()
tc.LogStdError("No supported architecutres to build")
tc.LogStdError("No supported architectures to build")
return -1
uefiBuilder = UefiBuilder()