use of com.intellij.execution.configurations.RunConfigurationBase in project intellij-community by JetBrains.
the class CompileStepBeforeRun method doMake.
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors, final boolean forceMakeProject) {
if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) {
return true;
}
if (configuration instanceof RunConfigurationBase && ((RunConfigurationBase) configuration).excludeCompileBeforeLaunchOption()) {
return true;
}
final RunProfileWithCompileBeforeLaunchOption runConfiguration = (RunProfileWithCompileBeforeLaunchOption) configuration;
final Ref<Boolean> result = new Ref<>(Boolean.FALSE);
try {
final Semaphore done = new Semaphore();
done.down();
final ProjectTaskNotification callback = new ProjectTaskNotification() {
public void finished(@NotNull ProjectTaskResult executionResult) {
if ((executionResult.getErrors() == 0 || ignoreErrors) && !executionResult.isAborted()) {
result.set(Boolean.TRUE);
}
done.up();
}
};
TransactionGuard.submitTransaction(myProject, () -> {
ProjectTask projectTask;
Object sessionId = ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(env);
final ProjectTaskManager projectTaskManager = ProjectTaskManager.getInstance(myProject);
if (forceMakeProject) {
// user explicitly requested whole-project make
projectTask = projectTaskManager.createAllModulesBuildTask(true, myProject);
} 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());
}
}
projectTask = projectTaskManager.createModulesBuildTask(modules, true, true, true);
} else {
projectTask = projectTaskManager.createAllModulesBuildTask(true, myProject);
}
}
if (!myProject.isDisposed()) {
projectTaskManager.run(new ProjectTaskContext(sessionId, configuration), projectTask, callback);
} else {
done.up();
}
});
done.waitFor();
} catch (Exception e) {
return false;
}
return result.get();
}
use of com.intellij.execution.configurations.RunConfigurationBase in project android by JetBrains.
the class AndroidProgramRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
boolean showRunContent = env.getRunProfile() instanceof AndroidTestRunConfiguration;
RunnerAndConfigurationSettings runnerAndConfigurationSettings = env.getRunnerAndConfigurationSettings();
if (runnerAndConfigurationSettings != null) {
runnerAndConfigurationSettings.setActivateToolWindowBeforeRun(showRunContent);
}
RunContentDescriptor descriptor = super.doExecute(state, env);
if (descriptor != null) {
ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
RunProfile runProfile = env.getRunProfile();
int uniqueId = runProfile instanceof RunConfigurationBase ? ((RunConfigurationBase) runProfile).getUniqueID() : -1;
AndroidSessionInfo sessionInfo = new AndroidSessionInfo(processHandler, descriptor, uniqueId, env.getExecutor().getId(), InstantRunUtils.isInstantRunEnabled(env));
processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
}
return descriptor;
}
use of com.intellij.execution.configurations.RunConfigurationBase in project intellij-community by JetBrains.
the class RunContentBuilder method createDescriptor.
@NotNull
private RunContentDescriptor createDescriptor() {
final RunProfile profile = myEnvironment.getRunProfile();
if (ApplicationManager.getApplication().isUnitTestMode()) {
return new RunContentDescriptor(profile, myExecutionResult, myUi);
}
final ExecutionConsole console = myExecutionResult.getExecutionConsole();
RunContentDescriptor contentDescriptor = new RunContentDescriptor(profile, myExecutionResult, myUi);
if (console != null) {
if (console instanceof ExecutionConsoleEx) {
((ExecutionConsoleEx) console).buildUi(myUi);
} else {
buildConsoleUiDefault(myUi, console);
}
initLogConsoles(profile, contentDescriptor, console);
}
myUi.getOptions().setLeftToolbar(createActionToolbar(contentDescriptor), ActionPlaces.RUNNER_TOOLBAR);
if (profile instanceof RunConfigurationBase) {
if (console instanceof ObservableConsoleView && !ApplicationManager.getApplication().isUnitTestMode()) {
((ObservableConsoleView) console).addChangeListener(new ConsoleToFrontListener((RunConfigurationBase) profile, myProject, myEnvironment.getExecutor(), contentDescriptor, myUi), this);
}
}
return contentDescriptor;
}
use of com.intellij.execution.configurations.RunConfigurationBase in project intellij-plugins by JetBrains.
the class DartTestRerunnerAction method getRunProfile.
@Override
protected MyRunProfile getRunProfile(@NotNull ExecutionEnvironment environment) {
final RunConfigurationBase configuration = (RunConfigurationBase) myConsoleProperties.getConfiguration();
final DartTestRerunner runner = new DartTestRerunner(environment, getFailedTests(configuration.getProject()));
return new RerunProfile(configuration, runner);
}
use of com.intellij.execution.configurations.RunConfigurationBase in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoCoverageRunner method loadCoverageData.
@Override
public ProjectData loadCoverageData(@NotNull File sessionDataFile, @Nullable CoverageSuite baseCoverageSuite) {
if (!(baseCoverageSuite instanceof BaseCoverageSuite)) {
return null;
}
Project project = baseCoverageSuite.getProject();
if (project == null) {
return null;
}
RunConfigurationBase configuration = ((BaseCoverageSuite) baseCoverageSuite).getConfiguration();
Module module = configuration instanceof ModuleBasedConfiguration ? ((ModuleBasedConfiguration) configuration).getConfigurationModule().getModule() : null;
try {
BufferedReader reader = new BufferedReader(new FileReader(sessionDataFile.getAbsolutePath()));
try {
return parseCoverage(reader, project, module);
} catch (IOException e) {
LOG.warn(e);
} finally {
try {
reader.close();
} catch (IOException e) {
LOG.warn(e);
}
}
} catch (FileNotFoundException e) {
LOG.warn(e);
}
return null;
}
Aggregations