com.intellij.execution.configurations.RunProfileState Java Examples

The following examples show how to use com.intellij.execution.configurations.RunProfileState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CppBaseDebugRunner.java    From CppTools with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
protected RunContentDescriptor doExecute(Project project, RunProfileState runProfileState, RunContentDescriptor runContentDescriptor, ExecutionEnvironment env) throws ExecutionException {
  FileDocumentManager.getInstance().saveAllDocuments();

  final RunProfile runProfile = env.getRunProfile();

  final XDebugSession debugSession =
      XDebuggerManager.getInstance(project).startSession(this, env, runContentDescriptor, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) {
          return new CppDebugProcess(session, CppBaseDebugRunner.this, (BaseCppConfiguration)runProfile);
        }
      });

  return debugSession.getRunContentDescriptor();
}
 
Example #2
Source File: WeaveDebuggerRunner.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Nullable
protected RunContentDescriptor attachVirtualMachine(final RunProfileState state, final @NotNull ExecutionEnvironment env)
        throws ExecutionException
{

    return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter()
    {
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException
        {
            WeaveRunnerCommandLine weaveRunnerCommandLine = (WeaveRunnerCommandLine) state;
            final String weaveFile = weaveRunnerCommandLine.getModel().getWeaveFile();
            final Project project = weaveRunnerCommandLine.getEnvironment().getProject();
            final VirtualFile projectFile = project.getBaseDir();
            final String path = project.getBasePath();
            final String relativePath = weaveFile.substring(path.length());
            final VirtualFile fileByRelativePath = projectFile.findFileByRelativePath(relativePath);
            final DebuggerClient localhost = new DebuggerClient(new WeaveDebuggerClientListener(session, fileByRelativePath), new TcpClientDebuggerProtocol("localhost", 6565));
            final ExecutionResult result = state.execute(env.getExecutor(), WeaveDebuggerRunner.this);
            new DebuggerConnector(localhost).start();
            return new WeaveDebugProcess(session, localhost, result);
        }
    }).getRunContentDescriptor();

}
 
Example #3
Source File: RoboVmRunner.java    From robovm-idea with GNU General Public License v2.0 6 votes vote down vote up
@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
    if(DEBUG_EXECUTOR.equals(environment.getExecutor().getId())) {
        RoboVmRunConfiguration runConfig = (RoboVmRunConfiguration)environment.getRunProfile();
        RemoteConnection connection = new RemoteConnection(true, "127.0.0.1", "" + runConfig.getDebugPort(), false);
        connection.setServerMode(true);
        return attachVirtualMachine(state, environment, connection, false);
    } else {
        ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
        if (executionResult == null) {
            return null;
        }
        return new RunContentBuilder(executionResult, environment).showRunContent(environment.getContentToReuse());
    }
}
 
Example #4
Source File: BlazeAndroidBinaryProgramRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
protected RunContentDescriptor doExecute(
    final RunProfileState state, final ExecutionEnvironment env) throws ExecutionException {
  RunContentDescriptor descriptor = super.doExecute(state, env);
  if (descriptor != null) {
    ProcessHandler processHandler = descriptor.getProcessHandler();
    assert processHandler != null;

    RunProfile runProfile = env.getRunProfile();
    RunConfiguration runConfiguration =
        (runProfile instanceof RunConfiguration) ? (RunConfiguration) runProfile : null;
    AndroidSessionInfo sessionInfo =
        AndroidSessionInfo.create(
            processHandler,
            descriptor,
            runConfiguration,
            env.getExecutor().getId(),
            env.getExecutor().getActionName(),
            env.getExecutionTarget());

    // #api3.5: not needed (along with the "uniqueId" calculation once 3.6 is in stable)
    processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
  }

  return descriptor;
}
 
Example #5
Source File: BlazeAndroidTestProgramRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
protected RunContentDescriptor doExecute(
    final RunProfileState state, final ExecutionEnvironment env) throws ExecutionException {
  RunContentDescriptor descriptor = super.doExecute(state, env);
  if (descriptor != null) {
    ProcessHandler processHandler = descriptor.getProcessHandler();
    assert processHandler != null;

    RunProfile runProfile = env.getRunProfile();
    RunConfiguration runConfiguration =
        (runProfile instanceof RunConfiguration) ? (RunConfiguration) runProfile : null;
    AndroidSessionInfo sessionInfo =
        AndroidSessionInfo.create(
            processHandler,
            descriptor,
            runConfiguration,
            env.getExecutor().getId(),
            env.getExecutor().getActionName(),
            env.getExecutionTarget());
    processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
  }

  return descriptor;
}
 
Example #6
Source File: BlazeGoDebugRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
private RunContentDescriptor doExecute(ExecutionEnvironment environment, RunProfileState state)
    throws ExecutionException {
  if (!(state instanceof BlazeGoDummyDebugProfileState)) {
    return null;
  }
  BlazeGoDummyDebugProfileState blazeState = (BlazeGoDummyDebugProfileState) state;
  GoApplicationRunningState goState = blazeState.toNativeState(environment);
  ExecutionResult executionResult = goState.execute(environment.getExecutor(), this);
  return XDebuggerManager.getInstance(environment.getProject())
      .startSession(
          environment,
          new XDebugProcessStarter() {
            @Override
            public XDebugProcess start(XDebugSession session) throws ExecutionException {
              RemoteVmConnection connection = new DlvRemoteVmConnection(true);
              XDebugProcess process =
                  new DlvDebugProcess(session, connection, executionResult, true, false);
              connection.open(goState.getDebugAddress());
              return process;
            }
          })
      .getRunContentDescriptor();
}
 
Example #7
Source File: Unity3dTestDebuggerRunner.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
@Override
@RequiredUIAccess
protected RunContentDescriptor doExecute(@Nonnull RunProfileState state, @Nonnull ExecutionEnvironment env) throws ExecutionException
{
	UnityProcess editorProcess = UnityEditorCommunication.findEditorProcess();
	if(editorProcess == null)
	{
		throw new ExecutionException("Editor is not responding");
	}
	FileDocumentManager.getInstance().saveAllDocuments();

	ExecutionResult executionResult = state.execute(env.getExecutor(), this);
	if(executionResult == null)
	{
		return null;
	}
	return Unity3dAttachRunner.runContentDescriptor(executionResult, env, editorProcess, (ConsoleView) executionResult.getExecutionConsole(), true);
}
 
Example #8
Source File: XQueryDebuggerRunner.java    From intellij-xquery with Apache License 2.0 6 votes vote down vote up
private XDebugProcessStarter getProcessStarter(final RunProfileState runProfileState, final ExecutionEnvironment
        executionEnvironment) throws ExecutionException {
    int port = getAvailablePort();
    ((XQueryRunProfileState) runProfileState).setPort(port);
    return new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
            final ExecutionResult result = runProfileState.execute(executionEnvironment.getExecutor(), XQueryDebuggerRunner.this);
            XQueryDebugProcess.XQueryDebuggerIde debuggerIde = new XQueryDebugProcess.XQueryDebuggerIde(session, result.getProcessHandler());
            final DBGpIde dbgpIde = ide().withPort(port).withDebuggerIde(debuggerIde).build();
            dbgpIde.startListening();
            result.getProcessHandler().addProcessListener(new ProcessAdapter() {
                @Override
                public void processTerminated(ProcessEvent event) {
                    dbgpIde.stopListening();
                }
            });
            return new XQueryDebugProcess(session, result, dbgpIde);
        }
    };
}
 
Example #9
Source File: DeployToServerRunConfiguration.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@Nonnull Executor executor, @Nonnull ExecutionEnvironment env) throws ExecutionException {
  String serverName = getServerName();
  if (serverName == null) {
    throw new ExecutionException("Server is not specified");
  }

  RemoteServer<S> server = RemoteServersManager.getInstance().findByName(serverName, myServerType);
  if (server == null) {
    throw new ExecutionException("Server '" + serverName + " not found");
  }

  if (myDeploymentSource == null) {
    throw new ExecutionException("Deployment is not selected");
  }

  return new DeployToServerState(server, myDeploymentSource, myDeploymentConfiguration, env);
}
 
Example #10
Source File: RemoteExternalSystemCommunicationManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Inject
public RemoteExternalSystemCommunicationManager(@Nonnull ExternalSystemProgressNotificationManager notificationManager) {
  myProgressManager = (ExternalSystemProgressNotificationManagerImpl)notificationManager;
  mySupport = new RemoteProcessSupport<Object, RemoteExternalSystemFacade, String>(RemoteExternalSystemFacade.class) {
    @Override
    protected void fireModificationCountChanged() {
    }

    @Override
    protected String getName(Object o) {
      return RemoteExternalSystemFacade.class.getName();
    }

    @Override
    protected RunProfileState getRunProfileState(Object o, String configuration, Executor executor) throws ExecutionException {
      return createRunProfileState();
    }
  };

  ShutDownTracker.getInstance().registerShutdownTask(new Runnable() {
    public void run() {
      shutdown(false);
    }
  });
}
 
Example #11
Source File: BlazeCommandRunConfiguration.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public RunProfileState getState(Executor executor, ExecutionEnvironment environment)
    throws ExecutionException {
  BlazeCommandRunConfigurationRunner runner = handler.createRunner(executor, environment);
  if (runner != null) {
    environment.putCopyableUserData(BlazeCommandRunConfigurationRunner.RUNNER_KEY, runner);
    return runner.getRunProfileState(executor, environment);
  }
  return null;
}
 
Example #12
Source File: BlazeRerunFailedTestsAction.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(Executor executor, ExecutionEnvironment environment)
    throws ExecutionException {
  BlazeCommandRunConfigurationCommonState handlerState =
      configuration.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
  if (handlerState == null
      || !BlazeCommandName.TEST.equals(handlerState.getCommandState().getCommand())) {
    return null;
  }
  Project project = getProject();
  List<Location<?>> locations =
      getFailedTests(project)
          .stream()
          .filter(AbstractTestProxy::isLeaf)
          .map((test) -> toLocation(project, test))
          .filter(Objects::nonNull)
          .collect(Collectors.toList());
  String testFilter = eventsHandler.getTestFilter(getProject(), locations);
  if (testFilter == null) {
    return null;
  }
  List<String> blazeFlags =
      setTestFilter(handlerState.getBlazeFlagsState().getRawFlags(), testFilter);
  handlerState.getBlazeFlagsState().setRawFlags(blazeFlags);
  return configuration.getState(executor, environment);
}
 
Example #13
Source File: BlazeCoverageProgramRunner.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected RunContentDescriptor doExecute(RunProfileState profile, ExecutionEnvironment env)
    throws ExecutionException {
  BlazeInfo blazeInfo = getBlazeInfo(env.getProject());
  if (blazeInfo == null) {
    throw new ExecutionException(
        "Can't run with coverage: no sync data found. Please sync your project and retry.");
  }
  RunContentDescriptor result = super.doExecute(profile, env);
  if (result == null) {
    return null;
  }
  EventLoggingService.getInstance().logEvent(getClass(), "run-with-coverage");
  // remove any old copy of the coverage data

  // retrieve coverage data and copy locally
  BlazeCommandRunConfiguration blazeConfig = (BlazeCommandRunConfiguration) env.getRunProfile();
  BlazeCoverageEnabledConfiguration config =
      (BlazeCoverageEnabledConfiguration) CoverageEnabledConfiguration.getOrCreate(blazeConfig);

  String coverageFilePath = config.getCoverageFilePath();
  File blazeOutputFile = CoverageUtils.getOutputFile(blazeInfo);

  ProcessHandler handler = result.getProcessHandler();
  if (handler != null) {
    ProcessHandler wrappedHandler =
        new ProcessHandlerWrapper(
            handler, exitCode -> copyCoverageOutput(blazeOutputFile, coverageFilePath, exitCode));
    CoverageHelper.attachToProcess(blazeConfig, wrappedHandler, env.getRunnerSettings());
  }
  return result;
}
 
Example #14
Source File: BlazePyRunConfigurationRunner.java    From intellij with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #15
Source File: BlazeGoRunConfigurationRunner.java    From intellij with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #16
Source File: AsyncProgramRunner.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected static void startRunProfile(ExecutionEnvironment environment,
                                      RunProfileState state,
                                      ProgramRunner.Callback callback,
                                      @javax.annotation.Nullable RunProfileStarter starter) {

  ThrowableComputable<AsyncResult<RunContentDescriptor>, ExecutionException> func = () -> {
    AsyncResult<RunContentDescriptor> promise = starter == null ? AsyncResult.done(null) : starter.executeAsync(state, environment);
    return promise.doWhenDone(it -> BaseProgramRunner.postProcess(environment, it, callback));
  };

  ExecutionManager.getInstance(environment.getProject()).startRunProfile(runProfileStarter(func), state, environment);
}
 
Example #17
Source File: EmbeddedLinuxJVMRunner.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the Runner, This only gets called in run mode.
 * It returns null because you want to show only the PI Console
 *
 * @param profileState
 * @param environment
 * @return
 * @throws ExecutionException
 */
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState profileState, @NotNull ExecutionEnvironment environment) throws ExecutionException {
    final RunProfile runProfileRaw = environment.getRunProfile();
    if (runProfileRaw instanceof EmbeddedLinuxJVMRunConfiguration) {
        FileDocumentManager.getInstance().saveAllDocuments();
        setupConsole(environment.getProject());
        return super.doExecute(profileState, environment);
    }
    return super.doExecute(profileState, environment);
}
 
Example #18
Source File: EmbeddedLinuxJVMDebugger.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the runner
 *
 * @param project
 * @param state
 * @param contentToReuse
 * @param environment
 * @return
 * @throws ExecutionException
 */
@Override
protected RunContentDescriptor doExecute(@NotNull Project project, @NotNull RunProfileState state, RunContentDescriptor contentToReuse, @NotNull ExecutionEnvironment environment) throws ExecutionException {
    final RunProfile runProfileRaw = environment.getRunProfile();
    if (runProfileRaw instanceof EmbeddedLinuxJVMRunConfiguration) {
        FileDocumentManager.getInstance().saveAllDocuments();
        setupConsole(environment.getProject());
        super.doExecute(project, state, contentToReuse, environment);
    }
    return super.doExecute(project, state, contentToReuse, environment);
}
 
Example #19
Source File: RoboVmRunner.java    From robovm-idea with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void execute(@NotNull ExecutionEnvironment environment, @Nullable Callback callback, @NotNull RunProfileState state) throws ExecutionException {
    // we need to pass the run profile info to the compiler so
    // we can decide if this is a debug or release build
    RoboVmRunConfiguration runConfig = (RoboVmRunConfiguration)environment.getRunnerAndConfigurationSettings().getConfiguration();
    runConfig.setDebug(DEBUG_EXECUTOR.equals(environment.getExecutor().getId()));
    super.execute(environment, callback, state);
}
 
Example #20
Source File: LocalServerRunConfiguration.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@Nonnull Executor executor, @Nonnull ExecutionEnvironment env) throws ExecutionException {
  if (myDeploymentSource == null) {
    throw new ExecutionException("Deployment is not selected");
  }

  return new LocalServerState(myLocalRunner, myDeploymentSource, myDeploymentConfiguration, env);
}
 
Example #21
Source File: RoboVmRunner.java    From robovm-idea with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
protected RunContentDescriptor attachVirtualMachine(RunProfileState state,
                                                    @NotNull ExecutionEnvironment env,
                                                    RemoteConnection connection,
                                                    boolean pollConnection) throws ExecutionException {
    DebugEnvironment environment = new DefaultDebugUIEnvironment(env, state, connection, pollConnection).getEnvironment();
    final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
    if (debuggerSession == null) {
        return null;
    }

    final DebugProcessImpl debugProcess = debuggerSession.getProcess();
    if (debugProcess.isDetached() || debugProcess.isDetaching()) {
        debuggerSession.dispose();
        return null;
    }
    // optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
    // which is an expensive operation when executed first time
    debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);

    return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
        @Override
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) {
            XDebugSessionImpl sessionImpl = (XDebugSessionImpl)session;
            ExecutionResult executionResult = debugProcess.getExecutionResult();
            sessionImpl.addExtraActions(executionResult.getActions());
            if (executionResult instanceof DefaultExecutionResult) {
                sessionImpl.addRestartActions(((DefaultExecutionResult)executionResult).getRestartActions());
                sessionImpl.addExtraStopActions(((DefaultExecutionResult)executionResult).getAdditionalStopActions());
            }
            return JavaDebugProcess.create(session, debuggerSession);
        }
    }).getRunContentDescriptor();
}
 
Example #22
Source File: TestConfiguration.java    From buck with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(
    @NotNull Executor executor, @NotNull ExecutionEnvironment environment)
    throws ExecutionException {
  final BuckBuildManager buildManager = BuckBuildManager.getInstance(getProject());
  if (buildManager.isBuilding()) {
    final Notification notification =
        new Notification(
            "", "Can't run test. Buck is already running!", "", NotificationType.ERROR);
    Notifications.Bus.notify(notification);
    return null;
  }
  return new TestExecutionState(this, getProject());
}
 
Example #23
Source File: HaskellTestRunConfiguration.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
    // TODO: How do we integrate with the test output UI?

    // Running the tests should automatically enable tests in the build settings.
    HaskellBuildSettings.getInstance(getProject()).setEnableTests(true);
    return new HaskellTestCommandLineState(executionEnvironment, this);
}
 
Example #24
Source File: GaugeRunConfiguration.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    GeneralCommandLine commandLine = GaugeCommandLine.getInstance(getModule(), getProject());
    addFlags(commandLine, env);
    return new GaugeCommandLineState(commandLine, getProject(), env, this);
}
 
Example #25
Source File: TestProgramRunner.java    From buck with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected RunContentDescriptor doExecute(
    @NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
  checkBuckSettings(env.getProject());
  return super.doExecute(state, env);
}
 
Example #26
Source File: GaugeRerunFailedAction.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
    GeneralCommandLine commandLine = GaugeCommandLine.getInstance(config.getModule(), getProject());
    commandLine.addParameters(Constants.RUN, Constants.FAILED);
    return new GaugeCommandLineState(commandLine, getProject(), env, config);
}
 
Example #27
Source File: XQueryRunConfiguration.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env)
        throws ExecutionException {
    XQueryRunProfileState state = new XQueryRunProfileState(env, (XQueryRunConfiguration) env
            .getRunnerAndConfigurationSettings().getConfiguration());
    XQueryRunConfigurationModule module = getConfigurationModule();
    state.setConsoleBuilder(TextConsoleBuilderFactory.getInstance().createBuilder(getProject(),
            module.getSearchScope()));
    return state;
}
 
Example #28
Source File: HaxeTestsRunner.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected RunContentDescriptor doExecute(@NotNull final Project project,
                                         @NotNull RunProfileState state,
                                         final RunContentDescriptor descriptor,
                                         @NotNull final ExecutionEnvironment environment) throws ExecutionException {

  final HaxeTestsConfiguration profile = (HaxeTestsConfiguration)environment.getRunProfile();
  final Module module = profile.getConfigurationModule().getModule();

  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  VirtualFile[] roots = rootManager.getContentRoots();

  return super.doExecute(project, new CommandLineState(environment) {
    @NotNull
    @Override
    protected ProcessHandler startProcess() throws ExecutionException {
      //actually only neko target is supported for tests
      HaxeTarget currentTarget = HaxeTarget.NEKO;
      final GeneralCommandLine commandLine = new GeneralCommandLine();
      commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath()));
      commandLine.setExePath(currentTarget.getFlag());
      final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);
      String folder = settings.getOutputFolder() != null ? (settings.getOutputFolder() + "/release/") : "";
      commandLine.addParameter(getFileNameWithCurrentExtension(currentTarget, folder + settings.getOutputFileName()));

      final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject());
      consoleBuilder.addFilter(new ErrorFilter(module));
      setConsoleBuilder(consoleBuilder);

      return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
    }

    private String getFileNameWithCurrentExtension(HaxeTarget haxeTarget, String fileName) {
      if (haxeTarget != null) {
        return haxeTarget.getTargetFileNameWithExtension(FileUtil.getNameWithoutExtension(fileName));
      }
      return fileName;
    }
  }, descriptor, environment);
}
 
Example #29
Source File: XQueryDebuggerRunner.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private RunContentDescriptor createContentDescriptor(final RunProfileState runProfileState,
                                                     final ExecutionEnvironment environment) throws ExecutionException {
    XDebuggerManager debuggerManager = XDebuggerManager.getInstance(environment.getProject());
    XDebugProcessStarter processStarter = getProcessStarter(runProfileState, environment);
    final XDebugSession debugSession = debuggerManager.startSession(environment, processStarter);
    return debugSession.getRunContentDescriptor();
}
 
Example #30
Source File: BlazeJavaRunConfigurationHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public RunProfileState getRunProfileState(Executor executor, ExecutionEnvironment env) {
  FastBuildSuggestion.getInstance()
      .displayNotification(BlazeCommandRunConfigurationRunner.getConfiguration(env));
  if (!BlazeCommandRunConfigurationRunner.isDebugging(env)
      || BlazeCommandName.BUILD.equals(
          BlazeCommandRunConfigurationRunner.getBlazeCommand(env))) {
    return new BlazeCommandRunProfileState(env);
  }
  ClassFileManifestBuilder.initState(env);
  return new BlazeJavaRunProfileState(env);
}