]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py
BaseTools: Add BaseTools plugins to support CI
[mirror_edk2.git] / BaseTools / Plugin / WindowsResourceCompiler / WinRcPath.py
diff --git a/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py b/BaseTools/Plugin/WindowsResourceCompiler/WinRcPath.py
new file mode 100644 (file)
index 0000000..ec2f2d1
--- /dev/null
@@ -0,0 +1,29 @@
+## @file WinRcPath.py\r
+# Plugin to find Windows SDK Resource Compiler rc.exe\r
+##\r
+# This plugin works in conjuncture with the tools_def to support rc.exe\r
+#\r
+# Copyright (c) Microsoft Corporation\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+import os\r
+from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin\r
+import edk2toollib.windows.locate_tools as locate_tools\r
+from edk2toolext.environment import shell_environment\r
+from edk2toolext.environment import version_aggregator\r
+\r
+class WinRcPath(IUefiBuildPlugin):\r
+\r
+    def do_post_build(self, thebuilder):\r
+        return 0\r
+\r
+    def do_pre_build(self, thebuilder):\r
+        #get the locate tools module\r
+        path = locate_tools.FindToolInWinSdk("rc.exe")\r
+        if path is None:\r
+            thebuilder.logging.warning("Failed to find rc.exe")\r
+        else:\r
+            p = os.path.abspath(os.path.dirname(path))\r
+            shell_environment.GetEnvironment().set_shell_var("WINSDK_PATH_FOR_RC_EXE", p)\r
+            version_aggregator.GetVersionAggregator().ReportVersion("WINSDK_PATH_FOR_RC_EXE", p, version_aggregator.VersionTypes.INFO)\r
+        return 0\r