Search in sources :

Example 1 with BlazeCommandRunProfileState

use of com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState in project intellij by bazelbuild.

the class BlazeGoRunConfigurationRunner method getRunProfileState.

@Override
public RunProfileState getRunProfileState(Executor executor, ExecutionEnvironment env) throws ExecutionException {
    BlazeCommandRunConfiguration configuration = BlazeCommandRunConfigurationRunner.getConfiguration(env);
    if (!BlazeCommandRunConfigurationRunner.isDebugging(env) || BlazeCommandName.BUILD.equals(BlazeCommandRunConfigurationRunner.getBlazeCommand(env))) {
        return new BlazeCommandRunProfileState(env);
    }
    env.putCopyableUserData(EXECUTABLE_KEY, new AtomicReference<>());
    return new BlazeGoDummyDebugProfileState(configuration);
}
Also used : BlazeCommandRunProfileState(com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)

Example 2 with BlazeCommandRunProfileState

use of com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState 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)

Example 3 with BlazeCommandRunProfileState

use of com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState in project intellij by bazelbuild.

the class BlazePyRunConfigurationRunner method getRunProfileState.

@Override
public RunProfileState getRunProfileState(Executor executor, ExecutionEnvironment env) {
    if (!BlazeCommandRunConfigurationRunner.isDebugging(env) || BlazeCommandName.BUILD.equals(BlazeCommandRunConfigurationRunner.getBlazeCommand(env))) {
        return new BlazeCommandRunProfileState(env);
    }
    BlazeCommandRunConfiguration configuration = BlazeCommandRunConfigurationRunner.getConfiguration(env);
    env.putCopyableUserData(EXECUTABLE_KEY, new AtomicReference<>());
    return new BlazePyDummyRunProfileState(configuration);
}
Also used : BlazeCommandRunProfileState(com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState) BlazeCommandRunConfiguration(com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)

Aggregations

BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)3 BlazeCommandRunProfileState (com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationRunner.BlazeCommandRunProfileState)3 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