def Invoke(self): ''' Main process function. Should not need to be overwritten ''' self.ParseCommandLineOptions() self.ConfigureLogging() self.InputParametersConfiguredCallback() logging.log(edk2_logging.SECTION, "Init SDE") # # Next, get the environment set up. # (build_env, shell_env) = self_describing_environment.BootstrapEnvironment( self.GetWorkspaceRoot(), self.GetActiveScopes()) # Make sure the environment verifies IF it is required for this invocation if self.GetVerifyCheckRequired( ) and not self_describing_environment.VerifyEnvironment( self.GetWorkspaceRoot(), self.GetActiveScopes()): raise RuntimeError( "SDE is not current. Please update your env before running this tool." ) # Load plugins logging.log(edk2_logging.SECTION, "Loading Plugins") self.plugin_manager = plugin_manager.PluginManager() failedPlugins = self.plugin_manager.SetListOfEnvironmentDescriptors( build_env.plugins) if failedPlugins: logging.critical( "One or more plugins failed to load. Halting build.") for a in failedPlugins: logging.error("Failed Plugin: {0}".format(a["name"])) raise Exception("One or more plugins failed to load.") self.helper = HelperFunctions() if (self.helper.LoadFromPluginManager(self.plugin_manager) > 0): raise Exception("One or more helper plugins failed to load.") logging.log(edk2_logging.SECTION, "Start Invocable Tool") retcode = self.Go() logging.log(edk2_logging.SECTION, "Summary") if (retcode != 0): edk2_logging.log_progress("Error") else: edk2_logging.log_progress("Success") logging.shutdown() sys.exit(retcode)
def Go(self): logging.info("Running Python version: " + str(sys.version_info)) Edk2PlatformBuild.collect_python_pip_info() (build_env, shell_env) = self_describing_environment.BootstrapEnvironment( self.GetWorkspaceRoot(), self.GetActiveScopes()) # Bind our current execution environment into the shell vars. ph = os.path.dirname(sys.executable) if " " in ph: ph = '"' + ph + '"' shell_env.set_shell_var("PYTHON_HOME", ph) # PYTHON_COMMAND is required to be set for using edk2 python builds. # todo: work with edk2 to remove the bat file and move to native python calls pc = sys.executable if " " in pc: pc = '"' + pc + '"' shell_env.set_shell_var("PYTHON_COMMAND", pc) # Load plugins logging.log(edk2_logging.SECTION, "Loading Plugins") pm = plugin_manager.PluginManager() failedPlugins = pm.SetListOfEnvironmentDescriptors( build_env.plugins) if failedPlugins: logging.critical("One or more plugins failed to load. Halting build.") for a in failedPlugins: logging.error("Failed Plugin: {0}".format(a["name"])) raise Exception("One or more plugins failed to load.") helper = HelperFunctions() if(helper.LoadFromPluginManager(pm) > 0): raise Exception("One or more helper plugins failed to load.") # Make a pathobj so we can normalize and validate the workspace # and packages path. The Settings Manager can return absolute or # relative paths pathobj = Edk2Path(self.GetWorkspaceRoot(), self.GetPackagesPath()) # # Now we can actually kick off a build. # logging.log(edk2_logging.SECTION, "Kicking off build") ret = self.PlatformBuilder.Go(pathobj.WorkspacePath, os.pathsep.join(pathobj.PackagePathList), helper, pm) logging.log(edk2_logging.SECTION, f"Log file is located at: {self.log_filename}") return ret
def Go(self): logging.info("Running Python version: " + str(sys.version_info)) display_pip_package_info(PIP_PACKAGES_LIST) (build_env, shell_env) = self_describing_environment.BootstrapEnvironment( self.GetWorkspaceRoot(), self.GetActiveScopes()) # Bind our current execution environment into the shell vars. ph = os.path.dirname(sys.executable) if " " in ph: ph = '"' + ph + '"' shell_env.set_shell_var("PYTHON_HOME", ph) # PYTHON_COMMAND is required to be set for using edk2 python builds. # todo: work with edk2 to remove the bat file and move to native python calls pc = sys.executable if " " in pc: pc = '"' + pc + '"' shell_env.set_shell_var("PYTHON_COMMAND", pc) # Load plugins logging.log(edk2_logging.SECTION, "Loading Plugins") pm = plugin_manager.PluginManager() failedPlugins = pm.SetListOfEnvironmentDescriptors( build_env.plugins) if failedPlugins: logging.critical("One or more plugins failed to load. Halting build.") for a in failedPlugins: logging.error("Failed Plugin: {0}".format(a["name"])) raise Exception("One or more plugins failed to load.") helper = HelperFunctions() if(helper.LoadFromPluginManager(pm) > 0): raise Exception("One or more helper plugins failed to load.") # # Now we can actually kick off a build. # logging.log(edk2_logging.SECTION, "Kicking off build") return self.PlatformBuilder.Go(self.GetWorkspaceRoot(), self.PlatformSettings.GetModulePkgsPath(), helper, pm)