Search in sources :

Example 1 with SkylarkDebugProcess

use of com.google.idea.blaze.skylark.debugger.impl.SkylarkDebugProcess in project intellij by bazelbuild.

the class SkylarkDebugRunner method doExecute.

@Nullable
@Override
protected RunContentDescriptor doExecute(RunProfileState state, ExecutionEnvironment env) throws ExecutionException {
    if (!DefaultDebugExecutor.EXECUTOR_ID.equals(env.getExecutor().getId())) {
        logger.error("Unexpected executor id: " + env.getExecutor().getId());
        return null;
    }
    BlazeCommandRunConfiguration config = BlazeCommandRunConfigurationRunner.getBlazeConfig(env.getRunProfile());
    if (config == null || !(state instanceof BlazeCommandRunProfileState)) {
        throw new ExecutionException("Debugging is not supported for this blaze run configuration");
    }
    ExecutionResult result = state.execute(env.getExecutor(), this);
    FileDocumentManager.getInstance().saveAllDocuments();
    XDebuggerManager manager = XDebuggerManager.getInstance(env.getProject());
    XDebugSession session = manager.startSession(env, new XDebugProcessStarter() {

        @Override
        public XDebugProcess start(XDebugSession session) {
            EventLoggingService.getInstance().logEvent(getClass(), "skylark-debugging");
            return new SkylarkDebugProcess(session, result, SkylarkDebugBuildFlagsProvider.SERVER_PORT);
        }
    });
    return session.getRunContentDescriptor();
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugProcess(com.intellij.xdebugger.XDebugProcess) BlazeCommandRunProfileState(com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) XDebuggerManager(com.intellij.xdebugger.XDebuggerManager) SkylarkDebugProcess(com.google.idea.blaze.skylark.debugger.impl.SkylarkDebugProcess) ExecutionResult(com.intellij.execution.ExecutionResult) ExecutionException(com.intellij.execution.ExecutionException) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration) Nullable(javax.annotation.Nullable)

Aggregations

BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)1 BlazeCommandRunProfileState (com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState)1 SkylarkDebugProcess (com.google.idea.blaze.skylark.debugger.impl.SkylarkDebugProcess)1 ExecutionException (com.intellij.execution.ExecutionException)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 XDebugProcess (com.intellij.xdebugger.XDebugProcess)1 XDebugProcessStarter (com.intellij.xdebugger.XDebugProcessStarter)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 XDebuggerManager (com.intellij.xdebugger.XDebuggerManager)1 Nullable (javax.annotation.Nullable)1