com.intellij.execution.configurations.RunnerSettings Java Examples

The following examples show how to use com.intellij.execution.configurations.RunnerSettings. 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: ExecutionEnvironment.java    From consulo with Apache License 2.0 6 votes vote down vote up
ExecutionEnvironment(@Nonnull RunProfile runProfile,
                     @Nonnull Executor executor,
                     @Nonnull ExecutionTarget target,
                     @Nonnull Project project,
                     @Nullable RunnerSettings runnerSettings,
                     @Nullable ConfigurationPerRunnerSettings configurationSettings,
                     @javax.annotation.Nullable RunContentDescriptor contentToReuse,
                     @Nullable RunnerAndConfigurationSettings settings,
                     @Nonnull ProgramRunner<?> runner) {
  myExecutor = executor;
  myTarget = target;
  myRunProfile = runProfile;
  myRunnerSettings = runnerSettings;
  myConfigurationSettings = configurationSettings;
  myProject = project;
  setContentToReuse(contentToReuse);
  myRunnerAndConfigurationSettings = settings;

  myRunner = runner;
}
 
Example #2
Source File: PendingTargetRunConfigurationHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
/** #api193: remove when 2019.3 no longer supported; default implementation added in 2020.1. */
@Nullable
@Override
public RunnerSettings createConfigurationData(
    ConfigurationInfoProvider configurationInfoProvider) {
  return null;
}
 
Example #3
Source File: ExecutionEnvironment.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated, use {@link com.intellij.execution.runners.ExecutionEnvironmentBuilder} instead
 * to remove in IDEA 15
 */
public ExecutionEnvironment(@Nonnull RunProfile runProfile,
                            @Nonnull Executor executor,
                            @Nonnull Project project,
                            @Nullable RunnerSettings runnerSettings) {
  //noinspection ConstantConditions
  this(runProfile, executor, DefaultExecutionTarget.INSTANCE, project, runnerSettings, null, null, null, RunnerRegistry.getInstance().getRunner(executor.getId(), runProfile));
}
 
Example #4
Source File: RunConfigurationExtensionsManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
protected List<T> getEnabledExtensions(@Nonnull U configuration, @javax.annotation.Nullable RunnerSettings runnerSettings) {
  List<T> extensions = new SmartList<>();
  for (T extension : myExtensionPointName.getExtensionList()) {
    if (extension.isApplicableFor(configuration) && extension.isEnabledFor(configuration, runnerSettings)) {
      extensions.add(extension);
    }
  }
  return extensions;
}
 
Example #5
Source File: RunConfigurationExtensionsManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void attachExtensionsToProcess(@Nonnull final U configuration,
                                      @Nonnull final ProcessHandler handler,
                                      RunnerSettings runnerSettings) {
  // only for enabled extensions
  for (T extension : getEnabledExtensions(configuration, runnerSettings)) {
    extension.attachToProcess(configuration, handler, runnerSettings);
  }
}
 
Example #6
Source File: RunConfigurationExtensionsManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void patchCommandLine(@Nonnull final U configuration,
                             final RunnerSettings runnerSettings,
                             @Nonnull final GeneralCommandLine cmdLine,
                             @Nonnull final String runnerId) throws ExecutionException {
  // only for enabled extensions
  for (T extension : getEnabledExtensions(configuration, runnerSettings)) {
    extension.patchCommandLine(configuration, runnerSettings, cmdLine, runnerId);
  }
}
 
Example #7
Source File: CoverageDataManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void attachToProcess(@Nonnull final ProcessHandler handler, @Nonnull final RunConfigurationBase configuration, final RunnerSettings runnerSettings) {
  handler.addProcessListener(new ProcessAdapter() {
    @Override
    public void processTerminated(final ProcessEvent event) {
      processGatheredCoverage(configuration, runnerSettings);
    }
  });
}
 
Example #8
Source File: CoverageHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void attachToProcess(@Nonnull RunConfigurationBase configuration,
                                   @Nonnull ProcessHandler handler,
                                   RunnerSettings runnerSettings) {
  resetCoverageSuit(configuration);

  // attach to process termination listener
  CoverageDataManager.getInstance(configuration.getProject()).attachToProcess(handler, configuration, runnerSettings);
}
 
Example #9
Source File: SMTRunnerConsoleTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
private MyConsoleView(final TestConsoleProperties consoleProperties, final RunnerSettings runnerSettings,
                      final ConfigurationPerRunnerSettings configurationPerRunnerSettings) {
  super(consoleProperties, "SMTRunnerConsoleTest");

  myTestsOutputConsolePrinter = new TestsOutputConsolePrinter(MyConsoleView.this, consoleProperties, null) {
    @Override
    public void print(final String text, final ConsoleViewContentType contentType) {
      myMockResettablePrinter.print(text, contentType);
    }
  };
}
 
Example #10
Source File: PantsClasspathRunConfigurationExtension.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * The goal of this function is to find classpath for IntelliJ JUnit/Scala runner.
 * <p/>
 * This function will fail if the projects' Pants doesn't support `--export-classpath-manifest-jar-only`.
 * It also assumes that Pants has created a manifest jar that contains all the classpath links for the
 * particular test that's being run.
 */
@Override
public <T extends RunConfigurationBase> void updateJavaParameters(
  T configuration,
  @NotNull JavaParameters params,
  RunnerSettings runnerSettings
) throws ExecutionException {
  List<BeforeRunTask<?>> tasks = ((RunManagerImpl) RunManager.getInstance(configuration.getProject())).getBeforeRunTasks(configuration);
  boolean builtByPants = tasks.stream().anyMatch(s -> s.getProviderId().equals(PantsMakeBeforeRun.ID));
  // Not built by Pants means it was built by IntelliJ, in which case we don't need to change the classpath.
  if (!builtByPants) {
    return;
  }

  final Module module = findPantsModule(configuration);
  if (module == null) {
    return;
  }

  Set<String> pathsAllowed = calculatePathsAllowed(params);

  final PathsList classpath = params.getClassPath();
  List<String> classpathToKeep = classpath.getPathList().stream()
    .filter(cp -> pathsAllowed.stream().anyMatch(cp::contains)).collect(Collectors.toList());
  classpath.clear();
  classpath.addAll(classpathToKeep);

  VirtualFile manifestJar = PantsUtil.findProjectManifestJar(configuration.getProject())
    .orElseThrow(() -> new ExecutionException("manifest.jar is not found. It should be generated by `./pants export-classpath ...`"));
  classpath.add(manifestJar.getPath());

  PantsExternalMetricsListenerManager.getInstance().logTestRunner(configuration);
}
 
Example #11
Source File: BlazeJavaDebuggerRunner.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void patch(
    JavaParameters javaParameters,
    RunnerSettings runnerSettings,
    RunProfile runProfile,
    final boolean beforeExecution) {
  // We don't want to support Java run configuration patching.
}
 
Example #12
Source File: PendingTargetRunConfigurationHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
/** #api193: remove when 2019.3 no longer supported; default implementation added in 2020.1. */
@Nullable
@Override
public SettingsEditor<RunnerSettings> getSettingsEditor(
    Executor executor, RunConfiguration runConfiguration) {
  return null;
}
 
Example #13
Source File: PantsJUnitRunnerAndConfigurationSettings.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public RunnerSettings getRunnerSettings(@NotNull ProgramRunner runner) {
  return null;
}
 
Example #14
Source File: BlazeCoverageProgramRunner.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public RunnerSettings createConfigurationData(final ConfigurationInfoProvider settingsProvider) {
  return new CoverageRunnerData();
}
 
Example #15
Source File: CoverageDataManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void processGatheredCoverage(@Nonnull RunConfigurationBase configuration, RunnerSettings runnerSettings) {
  if (runnerSettings instanceof CoverageRunnerData) {
    processGatheredCoverage(configuration);
  }
}
 
Example #16
Source File: PendingTargetRunConfigurationHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
/** #api193: remove when 2019.3 no longer supported; default implementation added in 2020.1. */
@Override
public void onProcessStarted(RunnerSettings runnerSettings, ExecutionResult executionResult) {}
 
Example #17
Source File: PendingTargetRunConfigurationHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
/** #api193: remove when 2019.3 no longer supported; default implementation added in 2020.1. */
@Override
public void checkConfiguration(
    RunnerSettings runnerSettings,
    @Nullable ConfigurationPerRunnerSettings configurationPerRunnerSettings) {}
 
Example #18
Source File: TrainsRunExtension.java    From trains-pycharm-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isEnabledFor(@NotNull AbstractPythonRunConfiguration applicableConfiguration, @Nullable RunnerSettings runnerSettings) {
    return true;
}
 
Example #19
Source File: ExecutionEnvironment.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public RunnerSettings getRunnerSettings() {
  return myRunnerSettings;
}
 
Example #20
Source File: ConfigurationSettingsEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private JComponent createCompositePerRunnerSettings(final Executor executor, final ProgramRunner runner) {
  final SettingsEditor<ConfigurationPerRunnerSettings> configEditor = myConfiguration.getRunnerSettingsEditor(runner);
  SettingsEditor<RunnerSettings> runnerEditor;

  try {
    runnerEditor = runner.getSettingsEditor(executor, myConfiguration);
  }
  catch (AbstractMethodError error) {
    // this is stub code for plugin compatibility!
    runnerEditor = null;
  }

  if (configEditor == null && runnerEditor == null) return null;
  SettingsEditor<RunnerAndConfigurationSettings> wrappedConfigEditor = null;
  SettingsEditor<RunnerAndConfigurationSettings> wrappedRunEditor = null;
  if (configEditor != null) {
    wrappedConfigEditor = new SettingsEditorWrapper<RunnerAndConfigurationSettings, ConfigurationPerRunnerSettings>(configEditor,
                                                                                                                    new Convertor<RunnerAndConfigurationSettings, ConfigurationPerRunnerSettings>() {
                                                                                                                      @Override
                                                                                                                      public ConfigurationPerRunnerSettings convert(RunnerAndConfigurationSettings configurationSettings) {
                                                                                                                        return configurationSettings.getConfigurationSettings(runner);
                                                                                                                      }
                                                                                                                    });
    myRunnerEditors.add(wrappedConfigEditor);
    Disposer.register(this, wrappedConfigEditor);
  }

  if (runnerEditor != null) {
    wrappedRunEditor = new SettingsEditorWrapper<RunnerAndConfigurationSettings, RunnerSettings>(runnerEditor,
                                                                                                 new Convertor<RunnerAndConfigurationSettings, RunnerSettings>() {
                                                                                                   @Override
                                                                                                   public RunnerSettings convert(RunnerAndConfigurationSettings configurationSettings) {
                                                                                                     return configurationSettings.getRunnerSettings(runner);
                                                                                                   }
                                                                                                 });
    myRunnerEditors.add(wrappedRunEditor);
    Disposer.register(this, wrappedRunEditor);
  }

  if (wrappedRunEditor != null && wrappedConfigEditor != null) {
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(wrappedConfigEditor.getComponent(), BorderLayout.CENTER);
    JComponent wrappedRunEditorComponent = wrappedRunEditor.getComponent();
    wrappedRunEditorComponent.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 0, 0));
    panel.add(wrappedRunEditorComponent, BorderLayout.SOUTH);
    return panel;
  }

  if (wrappedRunEditor != null) return wrappedRunEditor.getComponent();
  return wrappedConfigEditor.getComponent();
}
 
Example #21
Source File: CoverageDataManager.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * This method attach process listener to process handler. Listener will load coverage information after process termination
 * @param handler
 * @param configuration
 * @param runnerSettings
 */
public abstract void attachToProcess(@Nonnull final ProcessHandler handler,
                                     @Nonnull final RunConfigurationBase configuration, RunnerSettings runnerSettings);
 
Example #22
Source File: RunConfigurationExtensionBase.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param applicableConfiguration Applicable run configuration
 * @return True if extension is turned on in configuration extension settings.
 *         E.g. RCov is turned on for given run configuration.
 */
protected abstract boolean isEnabledFor(@Nonnull final T applicableConfiguration, @Nullable RunnerSettings runnerSettings);
 
Example #23
Source File: RunConfigurationExtensionBase.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Patches the command line of the process about to be started by the underlying run configuration.
 *
 * @param configuration  the underlying run configuration.
 * @param runnerSettings the runner-specific settings.
 * @param cmdLine        the command line of the process about to be started.
 * @param runnerId       the ID of the {@link com.intellij.execution.runners.ProgramRunner} used to start the process.
 * @throws ExecutionException if there was an error configuring the command line and the execution should be canceled.
 */
protected abstract void patchCommandLine(@Nonnull final T configuration,
                                         @javax.annotation.Nullable RunnerSettings runnerSettings,
                                         @Nonnull final GeneralCommandLine cmdLine,
                                         @Nonnull final String runnerId) throws ExecutionException;
 
Example #24
Source File: RunConfigurationExtensionBase.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Attaches the extension to a process that has been started.
 *
 * @param configuration  the underlying run configuration.
 * @param handler        the ProcessHandler for the running process.
 * @param runnerSettings the runner-specific settings.
 */
protected void attachToProcess(@Nonnull final T configuration,
                               @Nonnull final ProcessHandler handler,
                               @javax.annotation.Nullable RunnerSettings runnerSettings) {

}
 
Example #25
Source File: CoverageDataManager.java    From consulo with Apache License 2.0 votes vote down vote up
public abstract void processGatheredCoverage(@Nonnull RunConfigurationBase configuration, RunnerSettings runnerSettings);