Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-27 23:04:40 +0000
committerDoug Schaefer2017-11-27 23:04:40 +0000
commit6db1357b1abf4944e40d8aa6ddd1520c2e224ce8 (patch)
tree0fcfb52fac567e624da2713b5ebca0ab567ed8d3
parent0ed7b10dea94cf37c6da0593ccfb94002b5385e8 (diff)
downloadorg.eclipse.cdt-6db1357b1abf4944e40d8aa6ddd1520c2e224ce8.tar.gz
org.eclipse.cdt-6db1357b1abf4944e40d8aa6ddd1520c2e224ce8.tar.xz
org.eclipse.cdt-6db1357b1abf4944e40d8aa6ddd1520c2e224ce8.zip
Stop launch on error. Fix up set/get make commands.
We were missing the dialog to ask if you wanted to continue after build errors in a project. We were missing the method that provided the list of projects to do that check. Also while testing that noticed the handling of the build and clean command UI was broken with make projects. Change-Id: I698e151672a114bb22c815f49d362b6413b9c315
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java18
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java21
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties7
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java65
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java3
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties1
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java7
7 files changed, 94 insertions, 28 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
index 9a66e66d4b..8caf73f4d0 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
@@ -54,31 +54,31 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
// Build Output Group
Group outputGroup = new Group(comp, SWT.NONE);
- outputGroup.setText("Build Output Location");
+ outputGroup.setText(Messages.MakeBuildSettingsTab_BuildOutputLocation);
outputGroup.setLayout(new GridLayout());
outputGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
projectButton = new Button(outputGroup, SWT.RADIO);
- projectButton.setText("Build in project directory");
+ projectButton.setText(Messages.MakeBuildSettingsTab_BuildInProjectDir);
projectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
configButton = new Button(outputGroup, SWT.RADIO);
- configButton.setText("Build in configuration specific folder");
+ configButton.setText(Messages.MakeBuildSettingsTab_BuildInConfigDir);
configButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Group cmdGroup = new Group(comp, SWT.NONE);
- cmdGroup.setText("Build Commands");
+ cmdGroup.setText(Messages.MakeBuildSettingsTab_BuildCommands);
cmdGroup.setLayout(new GridLayout(2, false));
cmdGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Label label = new Label(cmdGroup, SWT.NONE);
- label.setText("Build:");
+ label.setText(Messages.MakeBuildSettingsTab_Build);
buildCmdText = new Text(cmdGroup, SWT.BORDER);
buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
label = new Label(cmdGroup, SWT.NONE);
- label.setText("Clean:");
+ label.setText(Messages.MakeBuildSettingsTab_Clean);
cleanCmdText = new Text(cmdGroup, SWT.BORDER);
cleanCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
@@ -86,7 +86,7 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
@Override
public String getName() {
- return "Makefile";
+ return Messages.MakeBuildSettingsTab_Makefile;
}
@Override
@@ -195,11 +195,15 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
String buildCommand = buildCmdText.getText().trim();
if (!buildCommand.isEmpty()) {
stdConfig.setBuildCommand(buildCommand.split(" ")); //$NON-NLS-1$
+ } else {
+ stdConfig.setBuildCommand(null);
}
String cleanCommand = cleanCmdText.getText().trim();
if (!cleanCommand.isEmpty()) {
stdConfig.setCleanCommand(cleanCommand.split(" ")); //$NON-NLS-1$
+ } else {
+ stdConfig.setCleanCommand(null);
}
}
} catch (CoreException e) {
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java
new file mode 100644
index 0000000000..cfc24769b6
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java
@@ -0,0 +1,21 @@
+package org.eclipse.cdt.make.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.ui.messages"; //$NON-NLS-1$
+ public static String MakeBuildSettingsTab_Build;
+ public static String MakeBuildSettingsTab_BuildCommands;
+ public static String MakeBuildSettingsTab_BuildInConfigDir;
+ public static String MakeBuildSettingsTab_BuildInProjectDir;
+ public static String MakeBuildSettingsTab_BuildOutputLocation;
+ public static String MakeBuildSettingsTab_Clean;
+ public static String MakeBuildSettingsTab_Makefile;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties
new file mode 100644
index 0000000000..0b143a70f3
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties
@@ -0,0 +1,7 @@
+MakeBuildSettingsTab_Build=Build:
+MakeBuildSettingsTab_BuildCommands=Build Commands
+MakeBuildSettingsTab_BuildInConfigDir=Build in configuration specific directory
+MakeBuildSettingsTab_BuildInProjectDir=Build in project directory
+MakeBuildSettingsTab_BuildOutputLocation=Build Output Location
+MakeBuildSettingsTab_Clean=Clean:
+MakeBuildSettingsTab_Makefile=Makefile
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
index a012f8c780..5aecc329e4 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
@@ -60,8 +60,11 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
*/
public static final String CLEAN_COMMAND = "stdbuild.clean.command"; //$NON-NLS-1$
- private String[] buildCommand;
- private String[] cleanCommand;
+ private static final String[] DEFAULT_BUILD_COMMAND = new String[] { "make" }; //$NON-NLS-1$
+ private static final String[] DEFAULT_CLEAN_COMMAND = new String[] { "make", "clean" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ private String[] buildCommand = DEFAULT_BUILD_COMMAND;
+ private String[] cleanCommand = DEFAULT_CLEAN_COMMAND;
private IContainer buildContainer;
private IEnvironmentVariable[] envVars;
@@ -91,11 +94,15 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
String buildCmd = getProperty(BUILD_COMMAND);
if (buildCmd != null && !buildCmd.trim().isEmpty()) {
buildCommand = buildCmd.split(" "); //$NON-NLS-1$
+ } else {
+ buildCommand = DEFAULT_BUILD_COMMAND;
}
String cleanCmd = getProperty(CLEAN_COMMAND);
if (cleanCmd != null && !cleanCmd.trim().isEmpty()) {
cleanCommand = cleanCmd.split(" "); //$NON-NLS-1$
+ } else {
+ cleanCommand = DEFAULT_CLEAN_COMMAND;
}
}
@@ -132,12 +139,23 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
}
public void setBuildCommand(String[] buildCommand) {
- this.buildCommand = buildCommand;
- setProperty(BUILD_COMMAND, String.join(" ", buildCommand)); //$NON-NLS-1$
+ if (buildCommand != null) {
+ this.buildCommand = buildCommand;
+ setProperty(BUILD_COMMAND, String.join(" ", buildCommand)); //$NON-NLS-1$
+ } else {
+ this.buildCommand = DEFAULT_BUILD_COMMAND;
+ removeProperty(BUILD_COMMAND);
+ }
}
public void setCleanCommand(String[] cleanCommand) {
- this.cleanCommand = cleanCommand;
+ if (cleanCommand != null) {
+ this.cleanCommand = cleanCommand;
+ setProperty(CLEAN_COMMAND, String.join(" ", cleanCommand)); //$NON-NLS-1$
+ } else {
+ this.cleanCommand = DEFAULT_CLEAN_COMMAND;
+ removeProperty(CLEAN_COMMAND);
+ }
}
private void createBuildContainer(IContainer container, IProgressMonitor monitor) throws CoreException {
@@ -183,7 +201,12 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
return getBuildContainer().getFullPath().toString();
} catch (CoreException e) {
CCorePlugin.log(e.getStatus());
+ return null;
}
+ case BUILD_COMMAND:
+ return String.join(" ", buildCommand); //$NON-NLS-1$
+ case CLEAN_COMMAND:
+ return String.join(" ", cleanCommand); //$NON-NLS-1$
}
return null;
@@ -211,21 +234,23 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
outStream.write(String.format(Messages.StandardBuildConfiguration_0, buildDir.toString()));
- List<String> command;
- if (buildCommand != null) {
- command = Arrays.asList(buildCommand);
- Path make = findCommand(buildCommand[0]);
- command.set(0, make.toString());
- } else {
- command = new ArrayList<>();
- command.add(findCommand("make").toString()); //$NON-NLS-1$
- if (!getBuildContainer().equals(getProject())) {
- Path makefile = Paths.get(getProject().getFile("Makefile").getLocationURI()); //$NON-NLS-1$
- Path relative = getBuildDirectory().relativize(makefile);
- command.add("-f"); //$NON-NLS-1$
- command.add(relative.toString());
- }
- command.add("all"); //$NON-NLS-1$
+ Path make = findCommand(buildCommand[0]);
+ if (make == null) {
+ console.getErrorStream()
+ .write(String.format(Messages.StandardBuildConfiguration_CommandNotFound, buildCommand[0]));
+ return null;
+ }
+
+ List<String> command = new ArrayList<>();
+ command.add(make.toString());
+ if (!getBuildContainer().equals(getProject())) {
+ Path makefile = Paths.get(getProject().getFile("Makefile").getLocationURI()); //$NON-NLS-1$
+ Path relative = getBuildDirectory().relativize(makefile);
+ command.add("-f"); //$NON-NLS-1$
+ command.add(relative.toString());
+ }
+ for (int i = 1; i < buildCommand.length; i++) {
+ command.add(buildCommand[i]);
}
try (ErrorParserManager epm = new ErrorParserManager(project, getProject().getLocationURI(), this,
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
index 0e517dcdf8..616f15db4f 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
@@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.core.build;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.Messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.messages"; //$NON-NLS-1$
public static String CBuildConfiguration_CreateJob;
public static String CBuildConfiguration_ToolchainMissing;
public static String CBuildConfiguration_Location;
@@ -20,6 +20,7 @@ public class Messages extends NLS {
public static String CBuilder_NotConfiguredCorrectly2;
public static String StandardBuildConfiguration_0;
public static String StandardBuildConfiguration_1;
+ public static String StandardBuildConfiguration_CommandNotFound;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
index 84de49bcac..f8f6780ef9 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
@@ -11,6 +11,7 @@ CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
StandardBuildConfiguration_0=Building in: %s\n
StandardBuildConfiguration_1=Build complete: %s\n
+StandardBuildConfiguration_CommandNotFound=Error: build command '%s' not found
CBuildConfiguration_CreateJob=Create Build Folder
CBuildConfiguration_Location=line %d, external location: %s
CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java
index ea940bfadf..d5cb39d2a0 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java
@@ -44,6 +44,13 @@ public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationT
return configuration.getMappedResources()[0].getProject();
}
+ @Override
+ protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode)
+ throws CoreException {
+ IProject project = getProject(configuration);
+ return project != null ? new IProject[] { project } : new IProject[0];
+ }
+
/**
* @deprecated Use the version that takes the launch config so we can see if it
* know what toolchain to use.

Back to the top