mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-90936 Force project make option before launch in run configuration
This commit is contained in:
@@ -102,7 +102,11 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
|
||||
return doMake(myProject, configuration, env, false);
|
||||
}
|
||||
|
||||
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors) {
|
||||
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors) {
|
||||
return doMake(myProject, configuration, env, ignoreErrors, Boolean.getBoolean(MAKE_PROJECT_ON_RUN_KEY));
|
||||
}
|
||||
|
||||
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors, final boolean forceMakeProject) {
|
||||
if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) {
|
||||
return true;
|
||||
}
|
||||
@@ -130,7 +134,7 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
|
||||
public void run() {
|
||||
CompileScope scope;
|
||||
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
|
||||
if (Boolean.valueOf(System.getProperty(MAKE_PROJECT_ON_RUN_KEY, Boolean.FALSE.toString())).booleanValue()) {
|
||||
if (forceMakeProject) {
|
||||
// user explicitly requested whole-project make
|
||||
scope = compilerManager.createProjectCompileScope(myProject);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.compiler.options;
|
||||
|
||||
import com.intellij.execution.BeforeRunTask;
|
||||
import com.intellij.execution.BeforeRunTaskProvider;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption;
|
||||
import com.intellij.execution.remote.RemoteConfiguration;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompileScope;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class MakeProjectStepBeforeRun extends BeforeRunTaskProvider<MakeProjectStepBeforeRun.MakeProjectBeforeRunTask> {
|
||||
public static final Key<MakeProjectBeforeRunTask> ID = Key.create("MakeProject");
|
||||
|
||||
private final Project myProject;
|
||||
|
||||
public MakeProjectStepBeforeRun(@NotNull Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key<MakeProjectBeforeRunTask> getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ExecutionBundle.message("before.launch.make.project.step");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(MakeProjectBeforeRunTask task) {
|
||||
return getName();
|
||||
}
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.Actions.Compile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getTaskIcon(MakeProjectBeforeRunTask task) {
|
||||
return AllIcons.Actions.Compile;
|
||||
}
|
||||
|
||||
public boolean configureTask(RunConfiguration runConfiguration, MakeProjectBeforeRunTask task) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExecuteTask(RunConfiguration configuration, MakeProjectBeforeRunTask task) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean executeTask(DataContext context, final RunConfiguration configuration, final ExecutionEnvironment env, MakeProjectBeforeRunTask task) {
|
||||
return CompileStepBeforeRun.doMake(myProject, configuration, env, false, true);
|
||||
}
|
||||
|
||||
public boolean isConfigurable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static RunConfiguration getRunConfiguration(final CompileContext context) {
|
||||
return getRunConfiguration(context.getCompileScope());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static RunConfiguration getRunConfiguration(final CompileScope compileScope) {
|
||||
return compileScope.getUserData(CompileStepBeforeRun.RUN_CONFIGURATION);
|
||||
}
|
||||
|
||||
|
||||
public MakeProjectBeforeRunTask createTask(RunConfiguration runConfiguration) {
|
||||
return !(runConfiguration instanceof RemoteConfiguration) && runConfiguration instanceof RunProfileWithCompileBeforeLaunchOption
|
||||
? new MakeProjectBeforeRunTask()
|
||||
: null;
|
||||
}
|
||||
|
||||
public static class MakeProjectBeforeRunTask extends BeforeRunTask<MakeProjectBeforeRunTask> {
|
||||
public MakeProjectBeforeRunTask() {
|
||||
super(ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,6 +323,7 @@ configuration.action.chooser.title=Choose configuration type to run
|
||||
env.vars.checkbox.title=&Include parent environment variables
|
||||
|
||||
before.launch.compile.step=Make
|
||||
before.launch.make.project.step=Make Project
|
||||
before.launch.compile.step.no.error.check=Make, no error check
|
||||
execute.before.run.debug.dialog.title=Execute {0} Before Run/Debug
|
||||
|
||||
|
||||
@@ -330,6 +330,7 @@
|
||||
|
||||
|
||||
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRun" id="compileBeforeRun"/>
|
||||
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.MakeProjectStepBeforeRun" id="makeProjectBeforeRun"/>
|
||||
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck" id="compileBeforeRunNoErrorCheck" order="after compileBeforeRun"/>
|
||||
<stepsBeforeRunProvider implementation="com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTaskProvider" order="after compileBeforeRunNoErrorCheck"/>
|
||||
<programRunner id="defaultRunRunner" implementation="com.intellij.execution.impl.DefaultJavaProgramRunner"/>
|
||||
|
||||
Reference in New Issue
Block a user