def __create_targets_lazily(self): active = GNATemulator.gnatemu_on_path() if not self.__buildTargets and active: targets_def = [[ "Run with Emulator", "run-with-emulator", GNATemulator.build_and_run, "gps-emulatorloading-run-symbolic" ], [ "Debug with Emulator", "debug-with-emulator", GNATemulator.build_and_debug, "gps-emulatorloading-debug-symbolic" ]] for target in targets_def: workflows.create_target_from_workflow( target_name=target[0], workflow_name=target[1], workflow=target[2], icon_name=target[3], parent_menu='/Build/Emulator/%s/' % target[0]) self.__buildTargets.append(GPS.BuildTarget(target[0])) if active: for b in self.__buildTargets: b.show() else: for b in self.__buildTargets: b.hide()
def setup(): """ Create the build-and-run and debug-and-run workflow buttons. """ if not WorkflowButtons.__build_targets_created: targets_def = [[ "Build & Run", "build-and-run", WorkflowButtons.__build_and_run_wf, "gps-run-symbolic" ], [ "Build & Debug", "build-and-debug", WorkflowButtons.__build_and_debug_wf, "gps-debugger-initialize-symbolic" ]] for target in targets_def: workflows.create_target_from_workflow( target_name=target[0], workflow_name=target[1], workflow=target[2], icon_name=target[3], parent_menu='/Build/Project/%s/' % target[0]) WorkflowButtons.__build_targets_created = True WorkflowButtons.__connect_hooks()
def create_toolbar_button(self): workflows.create_target_from_workflow( target_name="Run GNATcoverage", workflow_name="run-gnatcov", workflow=self.run_gnatcov_wf, icon_name="gps-run-gnatcov-symbolic", parent_menu="/Build/Workflow/GNATcov/")
def create_build_targets_gnatemu(): """ Creates the Build Targets used to call gnatemu when in a test harness. """ global __targetsDef for target_def in __targetsDef: workflows.create_target_from_workflow( target_def[0], target_def[1], target_def[2], target_def[3], parent_menu='/Build/Emulator/%s/' % target_def[0])
def __create_target_lazily(self): """ Create the "Build & Run All" target. """ if not self.__buildTarget: workflows.create_target_from_workflow( parent_menu='/Build/Project/', target_name="Build & Run All", workflow_name="build-and-run-all", workflow=self.__build_and_run_all_wf, icon_name="gps-run-symbolic", main_arg="") self.__buildTarget = GPS.BuildTarget("Build & Run All")
def __create_targets_lazily(self): active = self.gnatemu_on_path() if not self.__buildTargets and active: targets_def = [ ["Run with Emulator", "run-with-emulator", self.__emu_wf, "gps-emulatorloading-run-symbolic"], ["Debug with Emulator", "debug-with-emulator", self.__emu_debug_wf, "gps-emulatorloading-debug-symbolic"]] for target in targets_def: workflows.create_target_from_workflow( target[0], target[1], target[2], target[3], parent_menu='/Build/Emulator/%s/' % target[0]) self.__buildTargets.append(GPS.BuildTarget(target[0])) if active: for b in self.__buildTargets: b.show() else: for b in self.__buildTargets: b.hide()
def update_worflow_build_targets(self): gnatcov_available = self.is_gnatcov_available() instrumentation_supported = self.is_instrumentation_supported() if gnatcov_available and not self.__run_gnatcov_wf_build_target: workflows.create_target_from_workflow( target_name="Run GNATcoverage", workflow_name="run-gnatcov", workflow=self.run_gnatcov_wf, icon_name="gps-run-gnatcov-symbolic", parent_menu="/Build/Workflow/GNATcov/") self.__run_gnatcov_wf_build_target = \ GPS.BuildTarget("Run GNATcoverage") if instrumentation_supported: workflows.create_target_from_workflow( target_name="Run GNATcoverage with instrumentation", workflow_name="run-gnatcov-with-instrumentation", in_toolbar=False, workflow=self.run_gnatcov_with_instrumentation_wf, parent_menu=PLUGIN_MENU + "/Intrumentation/") self.__run_gnatcov_instr_wf_build_target = \ GPS.BuildTarget("Run GNATcoverage with instrumentation") if not gnatcov_available: if self.__run_gnatcov_wf_build_target: self.__run_gnatcov_wf_build_target.hide() if self.__run_gnatcov_instr_wf_build_target: self.__run_gnatcov_instr_wf_build_target.hide() elif not instrumentation_supported: if self.__run_gnatcov_instr_wf_build_target: self.__run_gnatcov_instr_wf_build_target.hide()
def __create_targets_lazily(self): """ Create all the build targets needed to flash/debug a board. Here is the list of these build targets: . 'Flash to Board' and 'Flash <current file> to Board' build targets . 'Debug on Board' and 'Debug <current file> on Board' build targets . TargetConnector build target (created from IDE'Connection_Tool) This method is called each time the project changes. """ project = GPS.Project.root() # Update the settings used for flash/debug self.__update_settings(project) # Check if it's a project for non-native targets active = self.__is_non_native_project(project) # Remove the previous Target Connector build target since the # connection tool and/or its arguments may have changed. if self.__connector: self.__connector.remove() # Create the Target Connector build target if a connection tool # has been specified in the project. if active and self.__connection_tool: cmd = self.__get_connection_command_line() self.__connector = TargetConnector( tool_name=cmd[0], default_args=cmd[1:]) # Create the build targets needed in order to flash/debug the board # if not created yet. if not self.__debug_build_targets: workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/Debug on Board/', target_name="Debug on Board", workflow_name="debug-on-board", workflow=self.__debug_wf, icon_name="gps-boardloading-debug-symbolic") self.__debug_build_targets.append( GPS.BuildTarget("Debug on Board")) workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/', target_name="Debug <current file> on Board", workflow_name="debug-current-on-board", workflow=self.__debug_wf, icon_name="gps-boardloading-debug-symbolic", in_toolbar=False, main_arg="%fp") self.__debug_build_targets.append( GPS.BuildTarget("Debug <current file> on Board")) if not self.__flash_build_targets: workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/Flash to Board/', target_name="Flash to Board", workflow_name="flash-to-board", workflow=self.__flash_wf, icon_name="gps-boardloading-flash-symbolic") self.__flash_build_targets.append( GPS.BuildTarget("Flash to Board")) workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/', target_name="Flash <current file> to Board", workflow_name="flash-current-to-board", workflow=self.__flash_wf, icon_name="gps-boardloading-flash-symbolic", in_toolbar=False, main_arg="%fp") self.__flash_build_targets.append( GPS.BuildTarget("Flash <current file> to Board")) # Show/Hide the build targets accordingly self.__update_build_targets_visibility(active)
def __create_targets_lazily(self): """ Create all the build targets needed to flash/debug a board. Here is the list of these build targets: . 'Flash to Board' and 'Flash <current file> to Board' build targets . 'Debug on Board' and 'Debug <current file> on Board' build targets . TargetConnector build target (created from IDE'Connection_Tool) This method is called each time the project changes. """ project = GPS.Project.root() # Update the settings used for flash/debug self.__update_settings(project) # Check if it's a project for non-native targets active = self.__is_non_native_project(project) # Remove the previous Target Connector build target since the # connection tool and/or its arguments may have changed. if self.__connector: self.__connector.remove() # Create the Target Connector build target if a connection tool # has been specified in the project. if active and self.__connection_tool: cmd = self.__get_connection_command_line() self.__connector = TargetConnector( tool_name=cmd[0], default_args=cmd[1:]) # Create the build targets needed in order to flash/debug the board # if not created yet. if not self.__buildTargets and active: workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/Flash to Board/', target_name="Flash to Board", workflow_name="flash-to-board", workflow=self.__flash_wf, icon_name="gps-boardloading-flash-symbolic") self.__buildTargets.append(GPS.BuildTarget("Flash to Board")) workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/Debug on Board/', target_name="Debug on Board", workflow_name="debug-on-board", workflow=self.__debug_wf, icon_name="gps-boardloading-debug-symbolic") self.__buildTargets.append(GPS.BuildTarget("Debug on Board")) workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/', target_name="Flash <current file> to Board", workflow_name="flash-current-to-board", workflow=self.__flash_wf, icon_name="gps-boardloading-flash-symbolic", in_toolbar=False, main_arg="%fp") self.__buildTargets.append( GPS.BuildTarget("Flash <current file> to Board")) workflows.create_target_from_workflow( parent_menu='/Build/Bareboard/', target_name="Debug <current file> on Board", workflow_name="debug-current-on-board", workflow=self.__debug_wf, icon_name="gps-boardloading-debug-symbolic", in_toolbar=False, main_arg="%fp") self.__buildTargets.append( GPS.BuildTarget("Debug <current file> on Board")) # Show/Hide the build targets accordingly if active: for b in self.__buildTargets: b.show() else: for b in self.__buildTargets: b.hide()
def update_worflow_build_targets(self): gnatcov_available = self.is_gnatcov_available() instrumentation_supported = self.is_instrumentation_supported() if gnatcov_available and not self.__run_gnatcov_wf_build_target: if self.is_binary_supported(): workflows.create_target_from_workflow( target_name="Run GNATcoverage", workflow_name="run-gnatcov", workflow=self.run_gnatcov_wf, in_toolbar=not instrumentation_supported, icon_name="gps-run-gnatcov-symbolic", parent_menu=BINARY_TRACES_MENU + "/Run All Actions/") self.__run_gnatcov_wf_build_target = \ GPS.BuildTarget("Run GNATcoverage") GPS.parse_xml(list_to_xml(self.BINARY_TRACES_BUILD_TARGETS)) if instrumentation_supported: workflows.create_target_from_workflow( target_name="Run GNATcoverage with instrumentation", workflow_name="run-gnatcov-with-instrumentation", in_toolbar=True, icon_name="gps-run-gnatcov-symbolic", workflow=self.run_gnatcov_with_instrumentation_wf, parent_menu=SOURCE_TRACES_MENU + "/Run All Actions/") self.__run_gnatcov_instr_wf_build_target = \ GPS.BuildTarget("Run GNATcoverage with instrumentation") # We want the toolbar to be ordered according to the coverage # process: # GNATcoverage source traces # -> Instrument # -> Build # -> Run # -> Generate Report # # As the Run action is a a workflow, and is not included in # SOURCE_TRACES_BUILD_TARGETS, we have to incorporate it in the # middle. We thus first parse the XML corresponding to the # Instrument and Build steps, then parse the XML for the Run # workflow, and in the end, for the Generate Report build # target. # Instrument and Build GPS.parse_xml(list_to_xml( self.SOURCE_TRACES_BUILD_TARGETS[:4])) workflows.create_target_from_workflow( target_name="Run instrumented main", workflow_name="run-instrumented-main", in_toolbar=False, icon_name="gps-run-gnatcov-symbolic", workflow=self.run_instrumented_main_wf, parent_menu=SOURCE_TRACES_MENU + "/Run/") # Generate Report GPS.parse_xml(list_to_xml( self.SOURCE_TRACES_BUILD_TARGETS[4:])) if not gnatcov_available: if self.__run_gnatcov_wf_build_target: self.__run_gnatcov_wf_build_target.hide() if self.__run_gnatcov_instr_wf_build_target: self.__run_gnatcov_instr_wf_build_target.hide() elif not instrumentation_supported: if self.__run_gnatcov_instr_wf_build_target: self.__run_gnatcov_instr_wf_build_target.hide()