com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption Java Examples

The following examples show how to use com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption. 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: PantsMakeBeforeRun.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
@NotNull
protected Set<String> getTargetAddressesToCompile(RunConfiguration configuration) {
  /* Scala run configurations */
  if (PantsUtil.isScalaRelatedTestRunConfiguration(configuration)) {
    Module module = ((AbstractTestRunConfiguration) configuration).getModule();
    return getTargetAddressesToCompile(new Module[]{module});
  }
  /* JUnit, Application run configurations */
  else if (configuration instanceof RunProfileWithCompileBeforeLaunchOption) {
    RunProfileWithCompileBeforeLaunchOption config = (RunProfileWithCompileBeforeLaunchOption) configuration;
    Module[] targetModules = config.getModules();
    return getTargetAddressesToCompile(targetModules);
  }
  else {
    return Collections.emptySet();
  }
}
 
Example #2
Source File: CompileStepBeforeRun.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public MakeBeforeRunTask createTask(RunConfiguration configuration) {
  MakeBeforeRunTask task = null;

  if (!(configuration instanceof Suppressor) && configuration instanceof RunProfileWithCompileBeforeLaunchOption) {
    task = new MakeBeforeRunTask();
    if (configuration instanceof RunConfigurationBase) {
      task.setEnabled(((RunConfigurationBase)configuration).isCompileBeforeLaunchAddedByDefault());
    }
  }
  return task;
}
 
Example #3
Source File: CompileStepBeforeRun.java    From consulo with Apache License 2.0 4 votes vote down vote up
static AsyncResult<Void> doMake(UIAccess uiAccess, final Project myProject, final RunConfiguration configuration, final boolean ignoreErrors) {
  if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) {
    return AsyncResult.rejected();
  }

  if (configuration instanceof RunConfigurationBase && ((RunConfigurationBase)configuration).excludeCompileBeforeLaunchOption()) {
    return AsyncResult.resolved();
  }

  final RunProfileWithCompileBeforeLaunchOption runConfiguration = (RunProfileWithCompileBeforeLaunchOption)configuration;
  AsyncResult<Void> result = AsyncResult.undefined();
  try {
    final CompileStatusNotification callback = (aborted, errors, warnings, compileContext) -> {
      if ((errors == 0 || ignoreErrors) && !aborted) {
        result.setDone();
      }
      else {
        result.setRejected();
      }
    };

    TransactionGuard.submitTransaction(myProject, () -> {
      CompileScope scope;
      final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
      if (Comparing.equal(Boolean.TRUE.toString(), System.getProperty(MAKE_PROJECT_ON_RUN_KEY))) {
        // user explicitly requested whole-project make
        scope = compilerManager.createProjectCompileScope();
      }
      else {
        final Module[] modules = runConfiguration.getModules();
        if (modules.length > 0) {
          for (Module module : modules) {
            if (module == null) {
              LOG.error("RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + runConfiguration.getClass().getName());
            }
          }
          scope = compilerManager.createModulesCompileScope(modules, true);
        }
        else {
          scope = compilerManager.createProjectCompileScope();
        }
      }

      if (!myProject.isDisposed()) {
        compilerManager.make(scope, callback);
      }
      else {
        result.setRejected();
      }
    });
  }
  catch (Exception e) {
    result.rejectWithThrowable(e);
  }

  return result;
}
 
Example #4
Source File: CompileStepBeforeRunNoErrorCheck.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public MakeBeforeRunTaskNoErrorCheck createTask(RunConfiguration runConfiguration) {
  return runConfiguration instanceof RunProfileWithCompileBeforeLaunchOption ? new MakeBeforeRunTaskNoErrorCheck() : null;
}