]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py
BaseTools: Add BaseTools plugins to support CI
[mirror_edk2.git] / BaseTools / Plugin / WindowsResourceCompiler / WinRcPath.py
CommitLineData
de4ce46d
SB
1## @file WinRcPath.py\r
2# Plugin to find Windows SDK Resource Compiler rc.exe\r
3##\r
4# This plugin works in conjuncture with the tools_def to support rc.exe\r
5#\r
6# Copyright (c) Microsoft Corporation\r
7# SPDX-License-Identifier: BSD-2-Clause-Patent\r
8##\r
9import os\r
10from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin\r
11import edk2toollib.windows.locate_tools as locate_tools\r
12from edk2toolext.environment import shell_environment\r
13from edk2toolext.environment import version_aggregator\r
14\r
15class WinRcPath(IUefiBuildPlugin):\r
16\r
17 def do_post_build(self, thebuilder):\r
18 return 0\r
19\r
20 def do_pre_build(self, thebuilder):\r
21 #get the locate tools module\r
22 path = locate_tools.FindToolInWinSdk("rc.exe")\r
23 if path is None:\r
24 thebuilder.logging.warning("Failed to find rc.exe")\r
25 else:\r
26 p = os.path.abspath(os.path.dirname(path))\r
27 shell_environment.GetEnvironment().set_shell_var("WINSDK_PATH_FOR_RC_EXE", p)\r
28 version_aggregator.GetVersionAggregator().ReportVersion("WINSDK_PATH_FOR_RC_EXE", p, version_aggregator.VersionTypes.INFO)\r
29 return 0\r