Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java2
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java3
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainFile.java11
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java5
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java12
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java16
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainFile.java22
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java14
-rw-r--r--build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF3
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java6
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java167
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java43
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java17
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java79
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java8
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties16
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters46
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java62
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java66
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java241
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java13
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java19
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java29
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java6
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties1
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java12
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchBarTracker.java11
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchConfigDelegate.java245
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties1
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java262
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/org.eclipse.jdt.core.prefs13
-rw-r--r--launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF2
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java3
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties3
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CommonBuildTab.java193
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java4
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/Activator.java4
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/launch/QtBuildTab.java71
42 files changed, 1144 insertions, 607 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 3ee7de0d1b..4665dda940 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -103,7 +103,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
idBuilder.append(arch);
}
idBuilder.append('-');
- idBuilder.append(pathToToolChain.toString());
+ idBuilder.append(pathToToolChain.toString().replaceAll("\\\\", "/")); //$NON-NLS-1$ //$NON-NLS-2$
this.id = idBuilder.toString();
properties.put(ATTR_ARCH, arch);
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
index d44607af45..cd1aa9daa0 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/GCCPathToolChainProvider.java
@@ -40,6 +40,9 @@ public class GCCPathToolChainProvider implements IToolChainProvider {
File dir = new File(dirStr);
if (dir.isDirectory()) {
for (File file : dir.listFiles()) {
+ if (file.isDirectory()) {
+ continue;
+ }
Matcher matcher = gccPattern.matcher(file.getName());
if (matcher.matches()) {
try {
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainFile.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainFile.java
index 0f40cc6699..c7052f95fa 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainFile.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainFile.java
@@ -9,6 +9,15 @@ package org.eclipse.cdt.cmake.core;
import java.nio.file.Path;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * A toolchain file.
+ *
+ * @noimplement
+ * @noextend
+ */
public interface ICMakeToolChainFile {
Path getPath();
@@ -17,4 +26,6 @@ public interface ICMakeToolChainFile {
void setProperty(String key, String value);
+ IToolChain getToolChain() throws CoreException;
+
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
index b522fb1d0e..b77bfff288 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeToolChainManager.java
@@ -11,10 +11,13 @@ import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
+import org.eclipse.cdt.core.build.IToolChain;
+
/**
* Manages toolchain files for CMake.
*
* @noimplement
+ * @noextend
*/
public interface ICMakeToolChainManager {
@@ -28,6 +31,8 @@ public interface ICMakeToolChainManager {
Collection<ICMakeToolChainFile> getToolChainFilesMatching(Map<String, String> properties);
+ ICMakeToolChainFile getToolChainFileFor(IToolChain toolchain);
+
Collection<ICMakeToolChainFile> getToolChainFiles();
void addListener(ICMakeToolChainListener listener);
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index eb4bea66f1..0d9a9c06ac 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -90,8 +90,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
throws CoreException {
IProject project = getProject();
try {
- Map<String, String> properties = getProperties();
- String generator = properties.get(CMAKE_GENERATOR);
+ String generator = getProperty(CMAKE_GENERATOR);
if (generator == null) {
generator = "Ninja"; //$NON-NLS-1$
}
@@ -131,7 +130,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
command.add("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"); //$NON-NLS-1$
- String userArgs = properties.get(CMAKE_ARGUMENTS);
+ String userArgs = getProperty(CMAKE_ARGUMENTS);
if (userArgs != null) {
command.addAll(Arrays.asList(userArgs.trim().split("\\s+"))); //$NON-NLS-1$
}
@@ -147,7 +146,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
getToolChain().getErrorParserIds())) {
- String buildCommand = properties.get(BUILD_COMMAND);
+ String buildCommand = getProperty(BUILD_COMMAND);
if (buildCommand == null) {
if (generator.equals("Ninja")) { //$NON-NLS-1$
buildCommand = "ninja"; //$NON-NLS-1$
@@ -184,8 +183,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
try {
- Map<String, String> properties = getProperties();
- String generator = properties.get(CMAKE_GENERATOR);
+ String generator = getProperty(CMAKE_GENERATOR);
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
@@ -198,7 +196,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
return;
}
- String cleanCommand = properties.get(CLEAN_COMMAND);
+ String cleanCommand = getProperty(CLEAN_COMMAND);
if (cleanCommand == null) {
if (generator == null || generator.equals("Ninja")) { //$NON-NLS-1$
cleanCommand = "ninja clean"; //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java
index c09b0850d2..71916f5d22 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationProvider.java
@@ -73,18 +73,6 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv
@Override
public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
IProgressMonitor monitor) throws CoreException {
- // See if there is one already
- for (IBuildConfiguration config : project.getBuildConfigs()) {
- ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class);
- if (cconfig != null) {
- CMakeBuildConfiguration cmakeConfig = cconfig.getAdapter(CMakeBuildConfiguration.class);
- if (cmakeConfig != null && cmakeConfig.getToolChain().equals(toolChain)
- && launchMode.equals(cmakeConfig.getLaunchMode())) {
- return cconfig;
- }
- }
- }
-
// get matching toolchain file if any
Map<String, String> properties = new HashMap<>();
String os = toolChain.getProperty(IToolChain.ATTR_OS);
@@ -108,13 +96,13 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv
configName.append('.');
configName.append(os);
}
- if (arch != null) {
+ if (arch != null && !arch.isEmpty()) {
configName.append('.');
configName.append(arch);
}
String name = configName.toString();
int i = 0;
- while (project.hasBuildConfig(name)) {
+ while (configManager.hasConfiguration(this, project, name)) {
name = configName.toString() + '.' + (++i);
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainFile.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainFile.java
index 5e97996a5c..ce4e704506 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainFile.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainFile.java
@@ -8,15 +8,20 @@
package org.eclipse.cdt.cmake.core.internal;
import java.nio.file.Path;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.core.runtime.CoreException;
public class CMakeToolChainFile implements ICMakeToolChainFile {
String n;
private final Path path;
+ private IToolChain toolchain;
final Map<String, String> properties = new HashMap<>();
@@ -40,6 +45,23 @@ public class CMakeToolChainFile implements ICMakeToolChainFile {
properties.put(key, value);
}
+ @Override
+ public IToolChain getToolChain() throws CoreException {
+ if (toolchain == null) {
+ IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
+ toolchain = tcManager.getToolChain(properties.get(CMakeBuildConfiguration.TOOLCHAIN_TYPE),
+ properties.get(CMakeBuildConfiguration.TOOLCHAIN_ID));
+
+ if (toolchain == null) {
+ Collection<IToolChain> tcs = tcManager.getToolChainsMatching(properties);
+ if (!tcs.isEmpty()) {
+ toolchain = tcs.iterator().next();
+ }
+ }
+ }
+ return toolchain;
+ }
+
boolean matches(Map<String, String> properties) {
for (Map.Entry<String, String> property : properties.entrySet()) {
if (!property.getValue().equals(getProperty(property.getKey()))) {
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
index 98582f0de2..42b94794a4 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeToolChainManager.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.cdt.cmake.core.ICMakeToolChainListener;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
import org.eclipse.cdt.cmake.core.ICMakeToolChainProvider;
+import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -182,6 +183,19 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
}
@Override
+ public ICMakeToolChainFile getToolChainFileFor(IToolChain toolchain) {
+ String id = toolchain.getId();
+
+ for (ICMakeToolChainFile file : getToolChainFiles()) {
+ if (id.equals(file.getProperty(CMakeBuildConfiguration.TOOLCHAIN_ID))) {
+ return file;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
public void addListener(ICMakeToolChainListener listener) {
listeners.add(listener);
}
diff --git a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
index 78e0949d57..0f54e0028b 100644
--- a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.ui;bundle-version="3.11.200",
org.eclipse.cdt.launch;bundle-version="9.1.0",
org.eclipse.cdt.debug.core;bundle-version="8.1.0",
- org.eclipse.cdt.ui;bundle-version="6.2.0"
+ org.eclipse.cdt.ui;bundle-version="6.2.0",
+ org.eclipse.launchbar.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
index d0e3630ac5..036da68941 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
@@ -40,9 +40,13 @@ public class Activator extends AbstractUIPlugin {
return new Status(IStatus.ERROR, PLUGIN_ID, message, cause);
}
+ public static void log(IStatus status) {
+ plugin.getLog().log(status);
+ }
+
public static void log(Exception e) {
if (e instanceof CoreException) {
- plugin.getLog().log(((CoreException) e).getStatus());
+ log(((CoreException) e).getStatus());
} else {
plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
index 6cc9a02e01..9ce46b0fa2 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
@@ -7,15 +7,14 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
-import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.launch.ui.corebuild.CommonBuildTab;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -23,10 +22,12 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
+public class CMakeBuildTab extends CommonBuildTab {
private Button unixGenButton;
private Button ninjaGenButton;
@@ -35,15 +36,28 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
private Text cleanCommandText;
@Override
+ protected String getBuildConfigProviderId() {
+ return CMakeBuildConfigurationProvider.ID;
+ }
+
+ @Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
setControl(comp);
- Label label = new Label(comp, SWT.NONE);
+ Control tcControl = createToolchainSelector(comp);
+ tcControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Group cmakeGroup = new Group(comp, SWT.NONE);
+ cmakeGroup.setText(Messages.CMakeBuildTab_Settings);
+ cmakeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ cmakeGroup.setLayout(new GridLayout());
+
+ Label label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_Generator);
- Composite genComp = new Composite(comp, SWT.BORDER);
+ Composite genComp = new Composite(cmakeGroup, SWT.BORDER);
genComp.setLayout(new GridLayout(2, true));
unixGenButton = new Button(genComp, SWT.RADIO);
@@ -64,67 +78,61 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
}
});
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_CMakeArgs);
- cmakeArgsText = new Text(comp, SWT.BORDER);
+ cmakeArgsText = new Text(cmakeGroup, SWT.BORDER);
cmakeArgsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
cmakeArgsText.addModifyListener(e -> updateLaunchConfigurationDialog());
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_BuildCommand);
- buildCommandText = new Text(comp, SWT.BORDER);
+ buildCommandText = new Text(cmakeGroup, SWT.BORDER);
buildCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
buildCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_CleanCommand);
- cleanCommandText = new Text(comp, SWT.BORDER);
+ cleanCommandText = new Text(cmakeGroup, SWT.BORDER);
cleanCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
cleanCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- String mode = getLaunchConfigurationDialog().getMode();
- configuration.removeAttribute("COREBUILD_" + mode); //$NON-NLS-1$
+ // TODO
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- String mode = getLaunchConfigurationDialog().getMode();
- // TODO find a home for the attribute name
- Map<String, String> properties = configuration.getAttribute("COREBUILD_" + mode, //$NON-NLS-1$
- new HashMap<>());
-
- String generator = properties.get(CMakeBuildConfiguration.CMAKE_GENERATOR);
- updateGeneratorButtons(generator);
-
- String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
- if (cmakeArgs != null) {
- cmakeArgsText.setText(cmakeArgs);
- } else {
- cmakeArgsText.setText(""); //$NON-NLS-1$
- }
+ super.initializeFrom(configuration);
- String buildCommand = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
- if (buildCommand != null) {
- buildCommandText.setText(buildCommand);
- } else {
- buildCommandText.setText(""); //$NON-NLS-1$
- }
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
- String cleanCommand = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
- if (cleanCommand != null) {
- cleanCommandText.setText(buildCommand);
- } else {
- cleanCommandText.setText(""); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- Activator.log(e);
+ String generator = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_GENERATOR);
+ updateGeneratorButtons(generator);
+
+ String cmakeArgs = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
+ if (cmakeArgs != null) {
+ cmakeArgsText.setText(cmakeArgs);
+ } else {
+ cmakeArgsText.setText(""); //$NON-NLS-1$
+ }
+
+ String buildCommand = buildConfig.getProperty(CMakeBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null) {
+ buildCommandText.setText(buildCommand);
+ } else {
+ buildCommandText.setText(""); //$NON-NLS-1$
+ }
+
+ String cleanCommand = buildConfig.getProperty(CMakeBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null) {
+ cleanCommandText.setText(buildCommand);
+ } else {
+ cleanCommandText.setText(""); //$NON-NLS-1$
}
}
@@ -138,32 +146,83 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- Map<String, String> properties = new HashMap<>();
+ super.performApply(configuration);
- properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR,
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+
+ buildConfig.setProperty(CMakeBuildConfiguration.CMAKE_GENERATOR,
ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
String cmakeArgs = cmakeArgsText.getText().trim();
if (!cmakeArgs.isEmpty()) {
- properties.put(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgs);
+ buildConfig.setProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgs);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
}
String buildCommand = buildCommandText.getText().trim();
if (!buildCommand.isEmpty()) {
- properties.put(CMakeBuildConfiguration.BUILD_COMMAND, buildCommand);
+ buildConfig.setProperty(CMakeBuildConfiguration.BUILD_COMMAND, buildCommand);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.BUILD_COMMAND);
}
String cleanCommand = cleanCommandText.getText().trim();
if (!cleanCommand.isEmpty()) {
- properties.put(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ buildConfig.setProperty(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.CLEAN_COMMAND);
+ }
+ }
+
+ @Override
+ protected void saveProperties(Map<String, String> properties) {
+ super.saveProperties(properties);
+ properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR,
+ ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ properties.put(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgsText.getText().trim());
+ properties.put(CMakeBuildConfiguration.BUILD_COMMAND, buildCommandText.getText().trim());
+ properties.put(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommandText.getText().trim());
+ }
+
+ @Override
+ protected void restoreProperties(Map<String, String> properties) {
+ super.restoreProperties(properties);
+
+ String gen = properties.get(CMakeBuildConfiguration.CMAKE_GENERATOR);
+ if (gen != null) {
+ switch (gen) {
+ case "Ninja": //$NON-NLS-1$
+ ninjaGenButton.setSelection(true);
+ unixGenButton.setSelection(false);
+ break;
+ case "Unix Makefiles": //$NON-NLS-1$
+ ninjaGenButton.setSelection(false);
+ unixGenButton.setSelection(true);
+ break;
+ }
+ }
+
+ String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
+ if (cmakeArgs != null) {
+ cmakeArgsText.setText(cmakeArgs);
+ } else {
+ cmakeArgsText.setText(""); //$NON-NLS-1$
+ }
+
+ String buildCmd = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
+ if (buildCmd != null) {
+ buildCommandText.setText(buildCmd);
+ } else {
+ buildCommandText.setText(""); //$NON-NLS-1$
}
- String buildAttribute = CoreBuildLaunchConfigDelegate
- .getBuildAttributeName(getLaunchConfigurationDialog().getMode());
- if (!properties.isEmpty()) {
- configuration.setAttribute(buildAttribute, properties);
+ String cleanCmd = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCmd != null) {
+ cleanCommandText.setText(cleanCmd);
} else {
- configuration.removeAttribute(buildAttribute);
+ cleanCommandText.setText(""); //$NON-NLS-1$
}
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
index 94406b75ac..7cc58fbb99 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.preference.PreferencePage;
@@ -59,7 +60,7 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
Group filesGroup = new Group(control, SWT.NONE);
filesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- filesGroup.setText("ToolChain Files");
+ filesGroup.setText(Messages.CMakePreferencePage_Files);
filesGroup.setLayout(new GridLayout(2, false));
Composite filesComp = new Composite(filesGroup, SWT.NONE);
@@ -75,18 +76,14 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
});
TableColumn pathColumn = new TableColumn(filesTable, SWT.NONE);
- pathColumn.setText("ToolChain File");
+ pathColumn.setText(Messages.CMakePreferencePage_Path);
- TableColumn osColumn = new TableColumn(filesTable, SWT.NONE);
- osColumn.setText("OS");
-
- TableColumn archColumn = new TableColumn(filesTable, SWT.NONE);
- archColumn.setText("CPU");
+ TableColumn tcColumn = new TableColumn(filesTable, SWT.NONE);
+ tcColumn.setText(Messages.CMakePreferencePage_Toolchain);
TableColumnLayout tableLayout = new TableColumnLayout();
- tableLayout.setColumnData(pathColumn, new ColumnWeightData(75, 350, true));
- tableLayout.setColumnData(osColumn, new ColumnWeightData(25, 100, true));
- tableLayout.setColumnData(archColumn, new ColumnWeightData(25, 100, true));
+ tableLayout.setColumnData(pathColumn, new ColumnWeightData(50, 350, true));
+ tableLayout.setColumnData(tcColumn, new ColumnWeightData(50, 350, true));
filesComp.setLayout(tableLayout);
Composite buttonsComp = new Composite(filesGroup, SWT.NONE);
@@ -95,11 +92,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
Button addButton = new Button(buttonsComp, SWT.PUSH);
addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- addButton.setText("Add...");
+ addButton.setText(Messages.CMakePreferencePage_Add);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard(getFiles());
+ NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard();
WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
ICMakeToolChainFile file = wizard.getNewFile();
@@ -115,11 +112,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
removeButton = new Button(buttonsComp, SWT.PUSH);
removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- removeButton.setText("Remove");
+ removeButton.setText(Messages.CMakePreferencePage_Remove);
removeButton.setEnabled(false);
removeButton.addListener(SWT.Selection, e -> {
- if (MessageDialog.openConfirm(getShell(), "Deregister CMake ToolChain File",
- "Do you wish to deregister the selected files?")) {
+ if (MessageDialog.openConfirm(getShell(), Messages.CMakePreferencePage_ConfirmRemoveTitle,
+ Messages.CMakePreferencePage_ConfirmRemoveDesc)) {
for (TableItem item : filesTable.getSelection()) {
ICMakeToolChainFile file = (ICMakeToolChainFile) item.getData();
if (filesToAdd.containsKey(file.getPath())) {
@@ -145,14 +142,16 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
for (ICMakeToolChainFile file : sorted) {
TableItem item = new TableItem(filesTable, SWT.NONE);
item.setText(0, file.getPath().toString());
- String os = file.getProperty(IToolChain.ATTR_OS);
- if (os != null) {
- item.setText(1, os);
- }
- String arch = file.getProperty(IToolChain.ATTR_ARCH);
- if (arch != null) {
- item.setText(2, arch);
+
+ try {
+ IToolChain tc = file.getToolChain();
+ if (tc != null) {
+ item.setText(1, tc.getName());
+ }
+ } catch (CoreException e) {
+ Activator.log(e.getStatus());
}
+
item.setData(file);
}
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
index 50df2366fa..91e4a32329 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
@@ -17,7 +17,17 @@ public class Messages extends NLS {
public static String CMakeBuildTab_CMakeArgs;
public static String CMakeBuildTab_Generator;
public static String CMakeBuildTab_Ninja;
+ public static String CMakeBuildTab_NoneAvailable;
+ public static String CMakeBuildTab_Settings;
+ public static String CMakeBuildTab_Toolchain;
public static String CMakeBuildTab_UnixMakefiles;
+ public static String CMakePreferencePage_Add;
+ public static String CMakePreferencePage_ConfirmRemoveDesc;
+ public static String CMakePreferencePage_ConfirmRemoveTitle;
+ public static String CMakePreferencePage_Files;
+ public static String CMakePreferencePage_Path;
+ public static String CMakePreferencePage_Remove;
+ public static String CMakePreferencePage_Toolchain;
public static String CMakePropertyPage_FailedToStartCMakeGui_Body;
public static String CMakePropertyPage_FailedToStartCMakeGui_Title;
public static String CMakePropertyPage_LaunchCMakeGui;
@@ -26,6 +36,13 @@ public class Messages extends NLS {
public static String NewCMakeProjectWizard_PageTitle;
public static String NewCMakeProjectWizard_WindowTitle;
+ public static String NewCMakeToolChainFilePage_Browse;
+ public static String NewCMakeToolChainFilePage_NoPath;
+ public static String NewCMakeToolChainFilePage_Path;
+ public static String NewCMakeToolChainFilePage_Select;
+ public static String NewCMakeToolChainFilePage_Title;
+ public static String NewCMakeToolChainFilePage_Toolchain;
+
static {
// initialize resource bundle
NLS.initializeMessages("org.eclipse.cdt.cmake.ui.internal.messages", Messages.class); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
index b40c60a2d8..4e6f63b9ca 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
@@ -7,18 +7,20 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Map;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
+import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
@@ -26,14 +28,13 @@ import org.eclipse.swt.widgets.Text;
public class NewCMakeToolChainFilePage extends WizardPage {
- private final Map<Path, ICMakeToolChainFile> existing;
private Text pathText;
- private Text osText;
- private Text archText;
+ private Combo tcCombo;
- public NewCMakeToolChainFilePage(Map<Path, ICMakeToolChainFile> existing) {
- super("NewCMakeToolChainFilePage", "New CMake ToolChain File", null); //$NON-NLS-1$
- this.existing = existing;
+ private IToolChain[] toolchains;
+
+ public NewCMakeToolChainFilePage() {
+ super("NewCMakeToolChainFilePage", Messages.NewCMakeToolChainFilePage_Title, null); //$NON-NLS-1$
}
@Override
@@ -44,7 +45,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
Label pathLabel = new Label(comp, SWT.NONE);
pathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- pathLabel.setText("Path:");
+ pathLabel.setText(Messages.NewCMakeToolChainFilePage_Path);
Composite pathComp = new Composite(comp, SWT.NONE);
pathComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
@@ -58,31 +59,33 @@ public class NewCMakeToolChainFilePage extends WizardPage {
Button pathButton = new Button(pathComp, SWT.PUSH);
pathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- pathButton.setText("Browse...");
+ pathButton.setText(Messages.NewCMakeToolChainFilePage_Browse);
pathButton.addListener(SWT.Selection, e -> {
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- dialog.setText("Select location for CMake toolchain file");
+ dialog.setText(Messages.NewCMakeToolChainFilePage_Select);
String path = dialog.open();
if (path != null) {
pathText.setText(path);
}
});
- Label osLabel = new Label(comp, SWT.NONE);
- osLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- osLabel.setText("Target OS:");
-
- osText = new Text(comp, SWT.BORDER);
- osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- osText.addModifyListener(e -> validate());
-
- Label archLabel = new Label(comp, SWT.NONE);
- archLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- archLabel.setText("Target CPU:");
-
- archText = new Text(comp, SWT.BORDER);
- archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- archText.addModifyListener(e -> validate());
+ Label tcLabel = new Label(comp, SWT.NONE);
+ tcLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ tcLabel.setText(Messages.NewCMakeToolChainFilePage_Toolchain);
+
+ tcCombo = new Combo(comp, SWT.READ_ONLY);
+ tcCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ try {
+ IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
+ toolchains = tcManager.getAllToolChains().toArray(new IToolChain[0]);
+ for (IToolChain tc : toolchains) {
+ tcCombo.add(tc.getName());
+ }
+ tcCombo.select(0);
+ } catch (CoreException e) {
+ Activator.log(e.getStatus());
+ }
setControl(comp);
validate();
@@ -93,17 +96,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
String path = pathText.getText();
if (path.isEmpty()) {
- setErrorMessage("Please set the path to the CMake toolchain file.");
- return;
- }
-
- if (existing.containsKey(Paths.get(path))) {
- setErrorMessage("CMake toolchain file entry already exists.");
- return;
- }
-
- if (osText.getText().isEmpty()) {
- setErrorMessage("Please set the target operating system.");
+ setErrorMessage(Messages.NewCMakeToolChainFilePage_NoPath);
return;
}
@@ -115,15 +108,9 @@ public class NewCMakeToolChainFilePage extends WizardPage {
ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
ICMakeToolChainFile file = manager.newToolChainFile(Paths.get(pathText.getText()));
- String os = osText.getText();
- if (!os.isEmpty()) {
- file.setProperty(IToolChain.ATTR_OS, os);
- }
-
- String arch = archText.getText();
- if (!arch.isEmpty()) {
- file.setProperty(IToolChain.ATTR_ARCH, arch);
- }
+ IToolChain tc = toolchains[tcCombo.getSelectionIndex()];
+ file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_TYPE, tc.getProvider().getId());
+ file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_ID, tc.getId());
return file;
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
index f5be2f3e64..fe616eeeac 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
@@ -7,9 +7,6 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.nio.file.Path;
-import java.util.Map;
-
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.jface.wizard.Wizard;
@@ -18,12 +15,9 @@ public class NewCMakeToolChainFileWizard extends Wizard {
private ICMakeToolChainFile newFile;
private NewCMakeToolChainFilePage page;
- public NewCMakeToolChainFileWizard(Map<Path, ICMakeToolChainFile> existing) {
- page = new NewCMakeToolChainFilePage(existing);
- }
-
@Override
public void addPages() {
+ page = new NewCMakeToolChainFilePage();
addPage(page);
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
index 51b607823f..09d2055d8c 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
@@ -4,10 +4,26 @@ CMakeBuildTab_Cmake=CMake
CMakeBuildTab_CMakeArgs=Additional CMake arguments:
CMakeBuildTab_Generator=Generator
CMakeBuildTab_Ninja=Ninja
+CMakeBuildTab_NoneAvailable=No Toolchains Available for this Target
+CMakeBuildTab_Settings=CMake Settings
+CMakeBuildTab_Toolchain=Toolchain
CMakeBuildTab_UnixMakefiles=Unix Makefiles
+CMakePreferencePage_Add=Add...
+CMakePreferencePage_ConfirmRemoveDesc=Do you wish to deregister the selected files?
+CMakePreferencePage_ConfirmRemoveTitle=Deregister CMake ToolChain File
+CMakePreferencePage_Files=Toolchain Files
+CMakePreferencePage_Path=Toolchain File
+CMakePreferencePage_Remove=Remove
+CMakePreferencePage_Toolchain=Toolchain
CMakePropertyPage_FailedToStartCMakeGui_Body=Failed to run the CMake GUI:
CMakePropertyPage_FailedToStartCMakeGui_Title=Failed to run CMake GUI
CMakePropertyPage_LaunchCMakeGui=Launch CMake GUI...
NewCMakeProjectWizard_Description=Specify properties of new CMake project.
NewCMakeProjectWizard_PageTitle=New CMake Project
NewCMakeProjectWizard_WindowTitle=New CMake Project
+NewCMakeToolChainFilePage_Browse=Browse...
+NewCMakeToolChainFilePage_NoPath=Please set the path to the CMake toolchain file.
+NewCMakeToolChainFilePage_Path=Path:
+NewCMakeToolChainFilePage_Select=Select location for CMake toolchain file
+NewCMakeToolChainFilePage_Title=New CMake ToolChain File
+NewCMakeToolChainFilePage_Toolchain=Toolchain:
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
index f95a509891..3f75336083 100644
--- a/core/org.eclipse.cdt.core/.settings/.api_filters
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -1,5 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2">
+ <resource path="src/org/eclipse/cdt/core/build/ICBuildConfiguration.java" type="org.eclipse.cdt.core.build.ICBuildConfiguration">
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="TOOLCHAIN_ID"/>
+ </message_arguments>
+ </filter>
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="TOOLCHAIN_TYPE"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="getLaunchMode()"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="getProperty(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="removeProperty(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="setProperty(String, String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java" type="org.eclipse.cdt.core.build.ICBuildConfigurationProvider">
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfigurationProvider"/>
+ <message_argument value="getSupportedToolchains(Collection&lt;IToolChain&gt;)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/cdt/core/build/IToolChainProvider.java" type="org.eclipse.cdt.core.build.IToolChainProvider">
<filter comment="This interface is still pretty new. Assuming low risk." id="404000815">
<message_arguments>
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index 5b67738268..0f1ac13459 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -108,9 +108,11 @@ import com.ibm.icu.text.MessageFormat;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CCorePlugin extends Plugin {
+ // IStatus codes for our plug-in
public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
+
/**
* Status code for core exception that is thrown if a pdom grew larger than
* the supported limit.
@@ -119,6 +121,13 @@ public class CCorePlugin extends Plugin {
*/
public static final int STATUS_PDOM_TOO_LARGE = 4;
+ /**
+ * Toolchain not found when inflating a build configuration.
+ *
+ * @since 6.4
+ */
+ public static final int STATUS_TOOLCHAIN_NOT_FOUND = 5;
+
public static final String PLUGIN_ID = "org.eclipse.cdt.core"; //$NON-NLS-1$
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index e2adadf98c..d90e35e9ef 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -24,7 +24,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -96,9 +95,6 @@ import com.google.gson.JsonParseException;
public abstract class CBuildConfiguration extends PlatformObject
implements ICBuildConfiguration, IMarkerGenerator, IConsoleParser {
- private static final String TOOLCHAIN_TYPE = "cdt.toolChain.type"; //$NON-NLS-1$
- private static final String TOOLCHAIN_ID = "cdt.toolChain.id"; //$NON-NLS-1$
- private static final String TOOLCHAIN_VERSION = "cdt.toolChain.version"; //$NON-NLS-1$
private static final String LAUNCH_MODE = "cdt.launchMode"; //$NON-NLS-1$
private static final List<String> DEFAULT_COMMAND = new ArrayList<>(0);
@@ -111,8 +107,6 @@ public abstract class CBuildConfiguration extends PlatformObject
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
private ScannerInfoCache scannerInfoCache;
- private Map<String, String> properties;
-
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
this.config = config;
this.name = name;
@@ -120,9 +114,8 @@ public abstract class CBuildConfiguration extends PlatformObject
Preferences settings = getSettings();
String typeId = settings.get(TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
String id = settings.get(TOOLCHAIN_ID, ""); //$NON-NLS-1$
- String version = settings.get(TOOLCHAIN_VERSION, ""); //$NON-NLS-1$
IToolChainManager toolChainManager = CCorePlugin.getService(IToolChainManager.class);
- IToolChain tc = toolChainManager.getToolChain(typeId, id, version);
+ IToolChain tc = toolChainManager.getToolChain(typeId, id);
if (tc == null) {
// check for other versions
@@ -132,7 +125,9 @@ public abstract class CBuildConfiguration extends PlatformObject
tc = tcs.iterator().next();
} else {
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
- String.format(Messages.CBuildConfigurationtoolchainMissing, config.getName())));
+ CCorePlugin.STATUS_TOOLCHAIN_NOT_FOUND,
+ String.format(Messages.CBuildConfiguration_ToolchainMissing, config.getName()),
+ null));
}
}
toolChain = tc;
@@ -157,7 +152,6 @@ public abstract class CBuildConfiguration extends PlatformObject
Preferences settings = getSettings();
settings.put(TOOLCHAIN_TYPE, toolChain.getProvider().getId());
settings.put(TOOLCHAIN_ID, toolChain.getId());
- settings.put(TOOLCHAIN_VERSION, toolChain.getVersion());
try {
settings.flush();
} catch (BackingStoreException e) {
@@ -181,6 +175,7 @@ public abstract class CBuildConfiguration extends PlatformObject
/**
* @since 6.2
*/
+ @Override
public String getLaunchMode() {
return launchMode;
}
@@ -756,12 +751,11 @@ public abstract class CBuildConfiguration extends PlatformObject
*/
@Override
public boolean setProperties(Map<String, String> properties) {
- if (this.properties == null || !this.properties.equals(properties)) {
- this.properties = properties;
- return true;
- } else {
- return false;
+ Preferences settings = getSettings();
+ for (Entry<String, String> entry : properties.entrySet()) {
+ settings.put(entry.getKey(), entry.getValue());
}
+ return true;
}
/**
@@ -769,10 +763,42 @@ public abstract class CBuildConfiguration extends PlatformObject
*/
@Override
public Map<String, String> getProperties() {
- if (properties == null) {
- properties = getDefaultProperties();
+ Map<String, String> properties = new HashMap<>();
+ Preferences settings = getSettings();
+ try {
+ for (String key : settings.childrenNames()) {
+ String value = settings.get(key, null);
+ if (value != null) {
+ properties.put(key, value);
+ }
+ }
+ } catch (BackingStoreException e) {
+ CCorePlugin.log(e);
}
- return Collections.unmodifiableMap(properties);
+ return properties;
+ }
+
+ /**
+ * @since 6.4
+ */
+ @Override
+ public String getProperty(String name) {
+ return getSettings().get(name, null);
+ }
+
+ /**
+ * @since 6.4
+ */
+ @Override
+ public void setProperty(String name, String value) {
+ Preferences settings = getSettings();
+ settings.put(name, value);
+ }
+
+ @Override
+ public void removeProperty(String name) {
+ Preferences settings = getSettings();
+ settings.remove(name);
}
/**
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
index 0794d4f054..b53a01e434 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
@@ -34,11 +34,21 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
* CDT doesn't like that the Platform default config name is an empty string.
* It needs a real name for the name of the build directory, for example.
*/
- public static String DEFAULT_NAME = "default"; //$NON-NLS-1$
+ public static final String DEFAULT_NAME = "default"; //$NON-NLS-1$
/**
- * Returns the resources build configuration that this CDT build
- * configuration is associated with.
+ * @since 6.4
+ */
+ public static final String TOOLCHAIN_TYPE = "cdt.toolChain.type"; //$NON-NLS-1$
+
+ /**
+ * @since 6.4
+ */
+ public static final String TOOLCHAIN_ID = "cdt.toolChain.id"; //$NON-NLS-1$
+
+ /**
+ * Returns the resources build configuration that this CDT build configuration
+ * is associated with.
*
* @return resources build configuration
*/
@@ -52,6 +62,15 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
IToolChain getToolChain() throws CoreException;
/**
+ * Return the launch mode associated with this build configuration.
+ *
+ * @since 6.4
+ */
+ default String getLaunchMode() {
+ return null;
+ }
+
+ /**
* Ids for the Binary Parsers to use when checking whether a file is a
* binary that can be launched.
*
@@ -73,7 +92,7 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
/**
* Return all of the build environment variables for this configuration.
*
- * @return
+ * @return environment variables
* @throws CoreException
*/
IEnvironmentVariable[] getVariables() throws CoreException;
@@ -161,6 +180,45 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
}
/**
+ * Set a property to the given value.
+ *
+ * @param name
+ * the name of the property
+ * @param the
+ * new value for the property
+ * @since 6.4
+ */
+ default void setProperty(String name, String value) {
+ Map<String, String> properties = new HashMap<>(getProperties());
+ properties.put(name, value);
+ setProperties(properties);
+ }
+
+ /**
+ * Remove the named property.
+ *
+ * @param name
+ * name of the property
+ * @since 6.4
+ */
+ default void removeProperty(String name) {
+ Map<String, String> properties = new HashMap<>(getProperties());
+ properties.remove(name);
+ setProperties(properties);
+ }
+
+ /**
+ * Return the named property.
+ *
+ * @param name
+ * the name of the property
+ * @since 6.4
+ */
+ default String getProperty(String name) {
+ return getProperties().get(name);
+ }
+
+ /**
* Returns whether this build configuration supports the given build
* properties.
*
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
index 91efa47a7e..8a20f1412d 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
@@ -1,112 +1,129 @@
-/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.core.build;
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * The OSGi service that manages the mapping from platform build configuration
- * to CDT build configuration.
- *
- * @since 6.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface ICBuildConfigurationManager {
-
- /**
- * Return the build configuration provider with the given id.
- *
- * @param id
- * @return build configuration provider
- */
- ICBuildConfigurationProvider getProvider(String id);
-
- /**
- * Create a new build configuration to be owned by a provider.
- *
- * @param provider
- * @param project
- * @param configName
- * @param monitor
- * @return new build configuration
- * @throws CoreException
- */
- IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
- String configName, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Create a new build configuration for a given project using a given
- * toolchain and builds for a given launch mode.
- *
- * @param project
- * project for the config
- * @param toolChain
- * toolchain the build config will use
- * @param launchMode
- * launch mode the buld config will build for
- * @return new build configuration
- * @throws CoreException
- * @since 6.1
- */
- ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
- IProgressMonitor monitor) throws CoreException;
-
- /**
- * Create a new build configuration for a given project using a toolchain
- * with the given properties and that builds for a given launch mode.
- *
- * @param project
- * project for the config
- * @param properties
- * properties for the toolchain to be selected
- * @param launchMode
- * launch mode the buld config will build for
- * @return new build configuration
- * @throws CoreException
- * @since 6.2
- */
- ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
- String launchMode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Called by providers to add new build configurations as they are created.
- *
- * @param buildConfig
- * platform build configuration
- * @param cConfig
- * CDT build configuration
- */
- void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
-
- /**
- * Return the CDT build configuration associated with the given Platform
- * build configuration.
- *
- * @param buildConfig
- * @return the matching CDT build configuration
- */
- ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
-
- /**
- * Does this build system support this project. This is determined by
- * searching the build configuration providers looking to see if any of them
- * support this project.
- *
- * @param project
- * @return is this project supported by this build system
- * @throws CoreException
- * @since 6.1
- */
- boolean supports(IProject project) throws CoreException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.build;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * The OSGi service that manages the mapping from platform build configuration
+ * to CDT build configuration.
+ *
+ * @since 6.0
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICBuildConfigurationManager {
+
+ /**
+ * Return the build configuration provider with the given id.
+ *
+ * @param id
+ * @return build configuration provider
+ */
+ ICBuildConfigurationProvider getProvider(String id);
+
+ /**
+ * Return whether the given project has a configuration with the given
+ * configName.
+ *
+ * @param provider
+ * @param project
+ * @param configName
+ * @return true if project has the named config
+ * @throws CoreException
+ * @since 6.4
+ */
+ boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project, String configName)
+ throws CoreException;
+
+ /**
+ * Create a new build configuration to be owned by a provider.
+ *
+ * @param provider
+ * @param project
+ * @param configName
+ * @param monitor
+ * @return new build configuration
+ * @throws CoreException
+ */
+ IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
+ String configName, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Create a new build configuration for a given project using a given
+ * toolchain and builds for a given launch mode.
+ *
+ * @param project
+ * project for the config
+ * @param toolChain
+ * toolchain the build config will use
+ * @param launchMode
+ * launch mode the buld config will build for
+ * @return new build configuration
+ * @throws CoreException
+ * @since 6.1
+ */
+ ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
+ IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Create a new build configuration for a given project using a toolchain with
+ * the given properties and that builds for a given launch mode.
+ *
+ * @deprecated clients really need to pick which toolchain they want a build
+ * config for. This method pretty much picks one at random.
+ * @param project
+ * project for the config
+ * @param properties
+ * properties for the toolchain to be selected
+ * @param launchMode
+ * launch mode the buld config will build for
+ * @return new build configuration
+ * @throws CoreException
+ * @since 6.2
+ */
+ @Deprecated
+ ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
+ String launchMode, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Called by providers to add new build configurations as they are created.
+ *
+ * @param buildConfig
+ * platform build configuration
+ * @param cConfig
+ * CDT build configuration
+ */
+ void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
+
+ /**
+ * Return the CDT build configuration associated with the given Platform
+ * build configuration.
+ *
+ * @param buildConfig
+ * @return the matching CDT build configuration
+ */
+ ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
+
+ /**
+ * Does this build system support this project. This is determined by
+ * searching the build configuration providers looking to see if any of them
+ * support this project.
+ *
+ * @param project
+ * @return is this project supported by this build system
+ * @throws CoreException
+ * @since 6.1
+ */
+ boolean supports(IProject project) throws CoreException;
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
index 6de0c38e49..f2a7517464 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
@@ -7,6 +7,8 @@
*******************************************************************************/
package org.eclipse.cdt.core.build;
+import java.util.Collection;
+
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -53,4 +55,15 @@ public interface ICBuildConfigurationProvider {
return null;
}
+ /**
+ * Return a collection of supported toolchains for build configurations of this
+ * type.
+ *
+ * @since 6.4
+ */
+ default Collection<IToolChain> getSupportedToolchains(Collection<IToolChain> toolchains)
+ throws CoreException {
+ return toolchains;
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
index b1b0ec270b..08d210cf79 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
@@ -35,6 +35,7 @@ public interface IToolChainManager {
/**
* Return the toolchain from the given provider with the given id and version.
*
+ * @deprecated Version is now irrelevant. id's are unique.
* @param providerId
* id of provider
* @param id
@@ -44,7 +45,23 @@ public interface IToolChainManager {
* @return the toolchain
* @throws CoreException
*/
- IToolChain getToolChain(String providerId, String id, String version) throws CoreException;
+ @Deprecated
+ default IToolChain getToolChain(String providerId, String id, String version) throws CoreException {
+ return getToolChain(providerId, id);
+ }
+
+ /**
+ * Return the toolChain from the given provider with the given id.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchain
+ * @return the toolchain
+ * @throws CoreException
+ * @since 6.4
+ */
+ IToolChain getToolChain(String providerId, String id) throws CoreException;
/**
* Return the toolchains provided by the given provider
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
index 0c86753500..3f8ead11ed 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
@@ -40,6 +40,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
@@ -142,6 +143,13 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
}
@Override
+ public boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project,
+ String configName) throws CoreException {
+ String name = provider.getId() + '/' + configName;
+ return project.hasBuildConfig(name);
+ }
+
+ @Override
public IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider,
IProject project, String configName, IProgressMonitor monitor) throws CoreException {
String name = provider.getId() + '/' + configName;
@@ -196,7 +204,15 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
}
if (provider != null) {
- config = provider.getCBuildConfiguration(buildConfig, configName);
+ try {
+ config = provider.getCBuildConfiguration(buildConfig, configName);
+ } catch (CoreException e) {
+ IStatus status = e.getStatus();
+ if (!status.getPlugin().equals(CCorePlugin.PLUGIN_ID)
+ || status.getCode() != CCorePlugin.STATUS_TOOLCHAIN_NOT_FOUND) {
+ throw e;
+ }
+ }
if (config != null) {
configs.put(buildConfig, config);
// Also make sure we reset the binary parser cache
@@ -224,8 +240,19 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
@Override
public ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain,
String launchMode, IProgressMonitor monitor) throws CoreException {
+ // First see if we have one
+ for (IBuildConfiguration config : project.getBuildConfigs()) {
+ ICBuildConfiguration cconfig = getBuildConfiguration(config);
+ if (cconfig != null && cconfig.getToolChain().equals(toolChain)
+ && launchMode.equals(cconfig.getLaunchMode())) {
+ return cconfig;
+ }
+ }
+
+ // Nope, ask the provider to create one
ICBuildConfigurationProvider provider = getProvider(project);
if (provider != null) {
+ // The provider will call us back to add in the new one
return provider.createBuildConfiguration(project, toolChain, launchMode, monitor);
} else {
return null;
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 e94820da9d..f9cc33c351 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
@@ -11,7 +11,7 @@ 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$
- public static String CBuildConfigurationtoolchainMissing;
+ public static String CBuildConfiguration_ToolchainMissing;
public static String CBuilder_ExceptionWhileBuilding;
public static String CBuilder_ExceptionWhileBuilding2;
public static String CBuilder_NotConfiguredCorrectly;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
index 754f919469..1ac9b8b7df 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
@@ -68,7 +68,6 @@ public class ToolChainManager implements IToolChainManager {
List<String> id = new ArrayList<>(3);
id.add(toolChain.getProvider().getId());
id.add(toolChain.getId());
- id.add(toolChain.getVersion());
return id;
}
@@ -101,12 +100,11 @@ public class ToolChainManager implements IToolChainManager {
}
@Override
- public IToolChain getToolChain(String providerId, String id, String version) throws CoreException {
+ public IToolChain getToolChain(String providerId, String id) throws CoreException {
init();
List<String> tid = new ArrayList<>(3);
tid.add(providerId);
tid.add(id);
- tid.add(version);
IToolChain toolChain = toolChains.get(tid);
if (toolChain != null) {
@@ -116,7 +114,7 @@ public class ToolChainManager implements IToolChainManager {
// Try the provider
IToolChainProvider realProvider = providers.get(providerId);
if (realProvider != null) {
- toolChain = realProvider.getToolChain(id, version);
+ toolChain = realProvider.getToolChain(id);
if (toolChain != null) {
toolChains.put(getId(toolChain), toolChain);
return toolChain;
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 318235d700..8a4bc16a5c 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
@@ -10,3 +10,4 @@ CBuilder_ExceptionWhileBuilding2=Exception while building
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
StandardBuildConfiguration_0=Building in: %s\n
+CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
index b00b7fae88..b272142894 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
@@ -446,18 +446,22 @@ public class EnvironmentVariableManager implements IEnvironmentVariableManager {
@Override
public void setEnvironment(Map<String, String> env, IBuildConfiguration config, boolean resolveMacros) {
for (IEnvironmentVariable var : getVariables(config, resolveMacros)) {
+ String name = var.getName();
+ if ("PATH".equals(name) && env.containsKey("Path")) { //$NON-NLS-1$ //$NON-NLS-2$
+ name = "Path"; //$NON-NLS-1$
+ }
switch (var.getOperation()) {
case IEnvironmentVariable.ENVVAR_REPLACE:
- env.put(var.getName(), var.getValue());
+ env.put(name, var.getValue());
break;
case IEnvironmentVariable.ENVVAR_APPEND:
- env.put(var.getName(), env.get(var.getName()) + var.getDelimiter() + var.getValue());
+ env.put(name, env.get(name) + var.getDelimiter() + var.getValue());
break;
case IEnvironmentVariable.ENVVAR_PREPEND:
- env.put(var.getName(), var.getValue() + var.getDelimiter() + env.get(var.getName()));
+ env.put(name, var.getValue() + var.getDelimiter() + env.get(name));
break;
case IEnvironmentVariable.ENVVAR_REMOVE:
- env.remove(var.getName());
+ env.remove(name);
break;
}
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchBarTracker.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchBarTracker.java
index b79da79032..81ccf982b8 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchBarTracker.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildLaunchBarTracker.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainManager;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
@@ -86,7 +87,7 @@ public class CoreBuildLaunchBarTracker implements ILaunchBarListener {
// Pick build config based on toolchain for target
// Since this may create a new config, need to run it in a Job
- Job job = new Job("Change Build Configurations") {
+ Job job = new Job(InternalDebugCoreMessages.CoreBuildLaunchBarTracker_Job) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
@@ -102,14 +103,6 @@ public class CoreBuildLaunchBarTracker implements ILaunchBarListener {
IProjectDescription desc = finalProject.getDescription();
desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
finalProject.setDescription(desc, monitor);
-
- // Copy over the build attributes from the launch config
- ILaunchConfiguration configuration = launchBarManager.getLaunchConfiguration(descriptor,
- target);
- Map<String, String> buildProps = configuration.getAttribute(
- CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode.getIdentifier()),
- buildConfig.getDefaultProperties());
- buildConfig.setProperties(buildProps);
}
}
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 cf8e12788c..0a3ef900b3 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
@@ -1,107 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.debug.core.launch;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.cdt.debug.core.CDebugCorePlugin;
-import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
-
-/**
- * Common launch delegate code for core build launches.
- *
- * @since 8.1
- */
-public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate {
-
- protected ICBuildConfigurationManager configManager = CDebugCorePlugin
- .getService(ICBuildConfigurationManager.class);
- protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
-
- public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
- // TODO - make sure this is really the correct project
- return configuration.getMappedResources()[0].getProject();
- }
-
- protected ICBuildConfiguration getBuildConfiguration(IProject project, String mode, ILaunchTarget target,
- IProgressMonitor monitor) throws CoreException {
- // Pick build config based on toolchain for target
- Map<String, String> properties = new HashMap<>();
- properties.putAll(target.getAttributes());
- Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
- if (!tcs.isEmpty()) {
- IToolChain toolChain = tcs.iterator().next();
- return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
- } else {
- return null;
- }
- }
-
- protected IBinary getBinary(ICBuildConfiguration buildConfig) throws CoreException {
- IBinary[] binaries = buildConfig.getBuildOutput();
- IBinary exeFile = null;
- for (IBinary binary : binaries) {
- if (binary.isExecutable()) {
- exeFile = binary;
- break;
- }
- }
- if (exeFile == null) {
- throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, InternalDebugCoreMessages.CoreBuildLaunchConfigDelegate_noBinaries));
- }
- return exeFile;
- }
-
- @Override
- protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
- // 1. Extract project from configuration
- // TODO dependencies too.
- IProject project = getProject(configuration);
- return new IProject[] { project };
- }
-
- public static String getBuildAttributeName(String mode) {
- return "COREBUILD_" + mode; //$NON-NLS-1$
- }
-
- @Override
- public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
- IProgressMonitor monitor) throws CoreException {
- IProject project = getProject(configuration);
- ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
- if (buildConfig != null) {
- IProjectDescription desc = project.getDescription();
- desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
- project.setDescription(desc, monitor);
-
- Map<String, String> buildProps = configuration.getAttribute(getBuildAttributeName(mode),
- buildConfig.getDefaultProperties());
- buildConfig.setProperties(buildProps);
- }
-
- // proceed with the build
- return superBuildForLaunch(configuration, mode, monitor);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.core.launch;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
+
+/**
+ * Common launch delegate code for core build launches.
+ *
+ * @since 8.1
+ */
+public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate {
+
+ protected ICBuildConfigurationManager configManager = CDebugCorePlugin
+ .getService(ICBuildConfigurationManager.class);
+ protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
+
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ // TODO - make sure this is really the correct project
+ return configuration.getMappedResources()[0].getProject();
+ }
+
+ /**
+ * @deprecated Use the version that takes the launch config so we can see if it
+ * know what toolchain to use.
+ */
+ @Deprecated
+ protected ICBuildConfiguration getBuildConfiguration(IProject project, String mode, ILaunchTarget target,
+ IProgressMonitor monitor) throws CoreException {
+ // Pick build config based on toolchain for target
+ Map<String, String> properties = new HashMap<>();
+ properties.putAll(target.getAttributes());
+ Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
+ if (!tcs.isEmpty()) {
+ IToolChain toolChain = tcs.iterator().next();
+ return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @since 8.3
+ */
+ protected ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration, String mode,
+ ILaunchTarget target, IProgressMonitor monitor) throws CoreException {
+ IProject project = getProject(configuration);
+ String toolchainId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_ID, (String) null);
+ if (toolchainId != null) {
+ String providerId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
+ IToolChain toolchain = toolChainManager.getToolChain(providerId, toolchainId);
+ if (toolchain != null) {
+ return configManager.getBuildConfiguration(project, toolchain, mode, monitor);
+ }
+ }
+
+ // Pick the first one that matches
+ Map<String, String> properties = new HashMap<>();
+ properties.putAll(target.getAttributes());
+ Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
+ if (!tcs.isEmpty()) {
+ IToolChain toolChain = tcs.iterator().next();
+ return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
+ }
+
+ return null;
+ }
+ protected IBinary getBinary(ICBuildConfiguration buildConfig) throws CoreException {
+ IBinary[] binaries = buildConfig.getBuildOutput();
+ IBinary exeFile = null;
+ for (IBinary binary : binaries) {
+ if (binary.isExecutable()) {
+ exeFile = binary;
+ break;
+ }
+ }
+ if (exeFile == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, InternalDebugCoreMessages.CoreBuildLaunchConfigDelegate_noBinaries));
+ }
+ return exeFile;
+ }
+
+ @Override
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
+ // 1. Extract project from configuration
+ // TODO dependencies too.
+ IProject project = getProject(configuration);
+ return new IProject[] { project };
+ }
+
+ /**
+ * @deprecated Store build properties right on the build configs
+ */
+ @Deprecated
+ public static String getBuildAttributeName(String mode) {
+ return "COREBUILD_" + mode; //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
+ IProgressMonitor monitor) throws CoreException {
+ ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
+ if (buildConfig != null) {
+ IProject project = getProject(configuration);
+ IProjectDescription desc = project.getDescription();
+ desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
+ project.setDescription(desc, monitor);
+ }
+
+ // proceed with the build
+ return superBuildForLaunch(configuration, mode, monitor);
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.java
index c5494d95df..85a9d73bc7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
-import org.eclipse.core.internal.variables.VariablesMessages;
import org.eclipse.osgi.util.NLS;
public class InternalDebugCoreMessages extends NLS {
@@ -27,6 +26,7 @@ public class InternalDebugCoreMessages extends NLS {
public static String CDebugAdapter_0;
public static String CDebugAdapter_1;
public static String CDebugAdapter_Program_file_not_specified;
+ public static String CoreBuildLaunchBarTracker_Job;
public static String CoreBuildLaunchConfigDelegate_noBinaries;
public static String CoreBuildLocalRunLaunchDelegate_ErrorLaunching;
public static String CRegisterManager_0;
@@ -39,7 +39,7 @@ public class InternalDebugCoreMessages extends NLS {
static {
// Load message values from a bundle file.
- NLS.initializeMessages(InternalDebugCoreMessages.class.getName(), VariablesMessages.class);
+ NLS.initializeMessages(InternalDebugCoreMessages.class.getName(), InternalDebugCoreMessages.class);
}
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
index 8c0130ab93..b9320c0048 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
@@ -21,6 +21,7 @@ DebugConfiguration_0=This debugger no longer supports this operation
CDebugAdapter_0=This debugger does not support debugging external files
CDebugAdapter_1=Debugger Process
CDebugAdapter_Program_file_not_specified=Program file not specified
+CoreBuildLaunchBarTracker_Job=Change Build Configurations
CoreBuildLaunchConfigDelegate_noBinaries=No binaries
CoreBuildLocalRunLaunchDelegate_ErrorLaunching=Error launching
CRegisterManager_0=Unable to restore register groups - invalid memento.
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
index 4ff8b3921c..b9e62ba39c 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
@@ -15,7 +15,6 @@ import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -31,10 +30,8 @@ public class CoreBuildLocalRunLaunchDelegate extends CoreBuildLaunchConfigDelega
@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
- IProject project = getProject(configuration);
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
-
- ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
+ ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
IBinary exeFile = getBinary(buildConfig);
try {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
index e962a55e4c..8b5cff15a8 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/launching/CoreBuildLocalDebugLaunchDelegate.java
@@ -1,132 +1,130 @@
-/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.internal.launching;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
-import org.eclipse.cdt.dsf.concurrent.Query;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
-import org.eclipse.cdt.dsf.concurrent.Sequence;
-import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
-import org.eclipse.cdt.dsf.gdb.internal.Messages;
-import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
-import org.eclipse.cdt.dsf.gdb.launching.GdbSourceLookupDirector;
-import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
-import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
-import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
-import org.eclipse.cdt.dsf.service.DsfServicesTracker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.launchbar.core.target.ILaunchTarget;
-import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
-
-public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDelegate {
-
- @Override
- public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target)
- throws CoreException {
- GdbLaunch launch = new GdbLaunch(configuration, mode, null);
- launch.setLaunchTarget(target);
- launch.initialize();
-
- GdbSourceLookupDirector locator = new GdbSourceLookupDirector(launch.getSession());
- String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
- if (memento == null) {
- locator.initializeDefaults(configuration);
- } else {
- locator.initializeFromMemento(memento, configuration);
- }
-
- launch.setSourceLocator(locator);
- return launch;
- }
-
- @Override
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
- throws CoreException {
- GdbLaunch gdbLaunch = (GdbLaunch) launch;
- ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
- IProject project = getProject(configuration);
- ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
-
- Map<String, String> buildEnv = new HashMap<>();
- buildConfig.setBuildEnvironment(buildEnv);
- Properties envProps = new Properties();
- envProps.putAll(buildEnv);
- gdbLaunch.setInitialEnvironment(envProps);
-
- IToolChain toolChain = buildConfig.getToolChain();
- Path gdbPath = toolChain.getCommandPath(Paths.get("gdb")); //$NON-NLS-1$
- gdbLaunch.setGDBPath(gdbPath != null ? gdbPath.toString() : "gdb"); //$NON-NLS-1$
- String gdbVersion = gdbLaunch.getGDBVersion();
-
- Path exeFile = Paths.get(getBinary(buildConfig).getLocationURI());
- gdbLaunch.setProgramPath(exeFile.toString());
-
- gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion, configuration));
-
- Sequence servicesLaunchSequence = new ServicesLaunchSequence(gdbLaunch.getSession(), gdbLaunch, monitor);
- gdbLaunch.getSession().getExecutor().execute(servicesLaunchSequence);
- try {
- servicesLaunchSequence.get();
- } catch (InterruptedException | ExecutionException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
- }
-
- gdbLaunch.initializeControl();
-
- gdbLaunch.addCLIProcess(gdbLaunch.getGDBPath().toOSString() + " (" + gdbVersion + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-
- Query<Object> ready = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker = new DsfServicesTracker(
- GdbPlugin.getDefault().getBundle().getBundleContext(), gdbLaunch.getSession().getId());
- IGDBControl control = tracker.getService(IGDBControl.class);
- tracker.dispose();
- control.completeInitialization(
- new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), monitor) {
- @Override
- protected void handleCompleted() {
- if (isCanceled()) {
- rm.cancel();
- } else {
- rm.setStatus(getStatus());
- }
- rm.done();
- }
- });
- }
- };
-
- // Start it up
- gdbLaunch.getSession().getExecutor().execute(ready);
- try {
- ready.get();
- } catch (ExecutionException | InterruptedException e) {
- throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.gdb.internal.launching;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
+import org.eclipse.cdt.dsf.concurrent.Query;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
+import org.eclipse.cdt.dsf.concurrent.Sequence;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
+import org.eclipse.cdt.dsf.gdb.internal.Messages;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.cdt.dsf.gdb.launching.GdbSourceLookupDirector;
+import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
+import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
+import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
+import org.eclipse.cdt.dsf.service.DsfServicesTracker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
+
+public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDelegate {
+
+ @Override
+ public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target)
+ throws CoreException {
+ GdbLaunch launch = new GdbLaunch(configuration, mode, null);
+ launch.setLaunchTarget(target);
+ launch.initialize();
+
+ GdbSourceLookupDirector locator = new GdbSourceLookupDirector(launch.getSession());
+ String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
+ if (memento == null) {
+ locator.initializeDefaults(configuration);
+ } else {
+ locator.initializeFromMemento(memento, configuration);
+ }
+
+ launch.setSourceLocator(locator);
+ return launch;
+ }
+
+ @Override
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ GdbLaunch gdbLaunch = (GdbLaunch) launch;
+ ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
+ ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
+
+ Map<String, String> buildEnv = new HashMap<>();
+ buildConfig.setBuildEnvironment(buildEnv);
+ Properties envProps = new Properties();
+ envProps.putAll(buildEnv);
+ gdbLaunch.setInitialEnvironment(envProps);
+
+ IToolChain toolChain = buildConfig.getToolChain();
+ Path gdbPath = toolChain.getCommandPath(Paths.get("gdb")); //$NON-NLS-1$
+ gdbLaunch.setGDBPath(gdbPath != null ? gdbPath.toString() : "gdb"); //$NON-NLS-1$
+ String gdbVersion = gdbLaunch.getGDBVersion();
+
+ Path exeFile = Paths.get(getBinary(buildConfig).getLocationURI());
+ gdbLaunch.setProgramPath(exeFile.toString());
+
+ gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion, configuration));
+
+ Sequence servicesLaunchSequence = new ServicesLaunchSequence(gdbLaunch.getSession(), gdbLaunch, monitor);
+ gdbLaunch.getSession().getExecutor().execute(servicesLaunchSequence);
+ try {
+ servicesLaunchSequence.get();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
+ }
+
+ gdbLaunch.initializeControl();
+
+ gdbLaunch.addCLIProcess(gdbLaunch.getGDBPath().toOSString() + " (" + gdbVersion + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Query<Object> ready = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(
+ GdbPlugin.getDefault().getBundle().getBundleContext(), gdbLaunch.getSession().getId());
+ IGDBControl control = tracker.getService(IGDBControl.class);
+ tracker.dispose();
+ control.completeInitialization(
+ new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), monitor) {
+ @Override
+ protected void handleCompleted() {
+ if (isCanceled()) {
+ rm.cancel();
+ } else {
+ rm.setStatus(getStatus());
+ }
+ rm.done();
+ }
+ });
+ }
+ };
+
+ // Start it up
+ gdbLaunch.getSession().getExecutor().execute(ready);
+ try {
+ ready.get();
+ } catch (ExecutionException | InterruptedException e) {
+ throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
+ }
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/org.eclipse.jdt.core.prefs b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/org.eclipse.jdt.core.prefs
index bd3f715282..09a75c5c99 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/org.eclipse.jdt.core.prefs
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/org.eclipse.jdt.core.prefs
@@ -2,18 +2,22 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
@@ -45,12 +49,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
@@ -67,12 +73,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
@@ -80,6 +90,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
diff --git a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
index 731ca773c5..346e4d26e5 100644
--- a/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
+++ b/launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.launch; singleton:=true
-Bundle-Version: 9.1.0.qualifier
+Bundle-Version: 9.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
index 0b3e4a846a..2b25f90f59 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
@@ -46,6 +46,9 @@ public class LaunchMessages extends NLS {
public static String LocalAttachLaunchDelegate_Platform_cannot_list_processes;
public static String LocalAttachLaunchDelegate_Select_Process_to_attach_debugger_to;
public static String LocalAttachLaunchDelegate_CDT_Launch_Error;
+ public static String CommonBuildTab_Default;
+ public static String CommonBuildTab_NotFound;
+ public static String CommonBuildTab_Toolchain;
public static String CoreBuildTab_Build;
public static String CoreBuildTab_NoOptions;
public static String CoreFileLaunchDelegate_Launching_postmortem_debugger;
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
index e287e387bf..cf0cca0384 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
@@ -49,6 +49,9 @@ LocalAttachLaunchDelegate_Platform_cannot_list_processes=Current platform does n
LocalAttachLaunchDelegate_Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
LocalAttachLaunchDelegate_CDT_Launch_Error=CDT Launch Error
+CommonBuildTab_Default=Default (%s)
+CommonBuildTab_NotFound=No suitable toolchains found
+CommonBuildTab_Toolchain=Toolchain
CoreBuildTab_Build=Build Settings
CoreBuildTab_NoOptions=No build options required.
CoreFileLaunchDelegate_Launching_postmortem_debugger=Launching postmortem debugger
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CommonBuildTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CommonBuildTab.java
index c7b79e6c49..27e7da3d10 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CommonBuildTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/CommonBuildTab.java
@@ -7,20 +7,36 @@
*******************************************************************************/
package org.eclipse.cdt.launch.ui.corebuild;
+import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.launchbar.ui.ILaunchBarLaunchConfigDialog;
+import org.eclipse.launchbar.ui.internal.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
/**
* Common utilities for Core Build launch configuration tabs.
@@ -29,6 +45,163 @@ import org.eclipse.launchbar.ui.ILaunchBarLaunchConfigDialog;
*/
public abstract class CommonBuildTab extends AbstractLaunchConfigurationTab {
+ private Combo tcCombo;
+ private ICBuildConfiguration buildConfig;
+ private IToolChain[] toolchains;
+
+ private IToolChain currentToolchain;
+ private IProject project;
+
+ private Map<ICBuildConfiguration, Map<String, String>> savedProperties = new HashMap<>();
+
+ private static IToolChainManager tcManager = LaunchUIPlugin.getService(IToolChainManager.class);
+ private static ICBuildConfigurationManager bcManager = LaunchUIPlugin.getService(ICBuildConfigurationManager.class);
+
+ /**
+ * @since 9.2
+ */
+ protected String getBuildConfigProviderId() {
+ return null;
+ }
+
+ /**
+ * @since 9.2
+ */
+ protected void saveProperties(Map<String, String> properties) {
+ }
+
+ /**
+ * @since 9.2
+ */
+ protected void restoreProperties(Map<String, String> properties) {
+ }
+
+ /**
+ * @since 9.2
+ */
+ protected Control createToolchainSelector(Composite parent) {
+ Group tcGroup = new Group(parent, SWT.NONE);
+ tcGroup.setText(LaunchMessages.CommonBuildTab_Toolchain);
+ tcGroup.setLayout(new GridLayout());
+
+ tcCombo = new Combo(tcGroup, SWT.READ_ONLY);
+ tcCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ tcCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (buildConfig != null) {
+ Map<String, String> saved = new HashMap<>();
+ saveProperties(saved);
+ savedProperties.put(buildConfig, saved);
+ }
+
+ if (toolchainChanged()) {
+ Map<String, String> saved = savedProperties.get(buildConfig);
+ if (saved != null) {
+ restoreProperties(saved);
+ }
+ }
+ }
+ });
+
+ return tcGroup;
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ if (tcCombo == null) {
+ return;
+ }
+
+ try {
+ project = CoreBuildLaunchConfigDelegate.getProject(configuration);
+
+ ICBuildConfigurationProvider bcProvider = bcManager.getProvider(getBuildConfigProviderId());
+ ILaunchTarget target = getLaunchTarget();
+ toolchains = bcProvider.getSupportedToolchains(tcManager.getToolChainsMatching(target.getAttributes()))
+ .toArray(new IToolChain[0]);
+
+ tcCombo.removeAll();
+ if (toolchains.length > 0) {
+ tcCombo.add(String.format(LaunchMessages.CommonBuildTab_Default, toolchains[0]));
+ } else {
+ tcCombo.add(LaunchMessages.CommonBuildTab_NotFound);
+ }
+
+ for (IToolChain tc : toolchains) {
+ tcCombo.add(tc.getName());
+ }
+
+ tcCombo.select(0);
+
+ String toolchainId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_ID, (String) null);
+ if (toolchainId != null) {
+ String typeId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
+ IToolChain toolchain = tcManager.getToolChain(typeId, toolchainId);
+ if (toolchain != null) {
+ for (int i = 0; i < toolchains.length; i++) {
+ if (toolchains[i] == toolchain) {
+ tcCombo.select(i + 1);
+ break;
+ }
+ }
+ }
+ }
+
+ toolchainChanged();
+ } catch (CoreException e) {
+ LaunchUIPlugin.log(e.getStatus());
+ }
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ if (tcCombo == null) {
+ return;
+ }
+
+ int i = tcCombo.getSelectionIndex();
+ if (i == 0) {
+ configuration.removeAttribute(ICBuildConfiguration.TOOLCHAIN_ID);
+ configuration.removeAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE);
+ } else {
+ IToolChain tc = toolchains[i - 1];
+ configuration.setAttribute(ICBuildConfiguration.TOOLCHAIN_ID, tc.getId());
+ configuration.setAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, tc.getProvider().getId());
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.removeAttribute(ICBuildConfiguration.TOOLCHAIN_ID);
+ configuration.removeAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE);
+ }
+
+ private boolean toolchainChanged() {
+ int i = tcCombo.getSelectionIndex();
+ if (i < 0) {
+ buildConfig = null;
+ return false;
+ } else if (i == 0) {
+ i = 1;
+ }
+
+ IToolChain newToolchain = toolchains[i - 1];
+ if (newToolchain == currentToolchain) {
+ return false;
+ }
+ currentToolchain = newToolchain;
+
+ String mode = getLaunchConfigurationDialog().getMode();
+ try {
+ buildConfig = bcManager.getBuildConfiguration(project, newToolchain, mode, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.log(e.getStatus());
+ }
+
+ return true;
+ }
+
public ILaunchBarLaunchConfigDialog getLaunchBarLaunchConfigDialog() {
ILaunchConfigurationDialog dialog = getLaunchConfigurationDialog();
return dialog instanceof ILaunchBarLaunchConfigDialog ? (ILaunchBarLaunchConfigDialog) dialog : null;
@@ -39,17 +212,19 @@ public abstract class CommonBuildTab extends AbstractLaunchConfigurationTab {
return dialog != null ? dialog.getLaunchTarget() : null;
}
+ /**
+ * @deprecated Just use getBuildConfiguration()
+ */
+ @Deprecated
public ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration) throws CoreException {
- String mode = getLaunchConfigurationDialog().getMode();
- ILaunchTarget target = getLaunchTarget();
- if (target == null) {
- return null;
- }
+ return buildConfig;
+ }
- ICBuildConfigurationManager bcManager = LaunchUIPlugin.getService(ICBuildConfigurationManager.class);
- IProject project = CoreBuildLaunchConfigDelegate.getProject(configuration);
- Map<String, String> properties = target.getAttributes();
- return bcManager.getBuildConfiguration(project, properties, mode, new NullProgressMonitor());
+ /**
+ * @since 9.2
+ */
+ public ICBuildConfiguration getBuildConfiguration() {
+ return buildConfig;
}
}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
index ba12633a2c..3ef3b6983a 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
@@ -189,7 +189,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
@Override
public String[] getQmakeConfig() {
- String qmakeArgs = getProperties().get(QMAKE_ARGS);
+ String qmakeArgs = getProperty(QMAKE_ARGS);
if (qmakeArgs != null) {
return qmakeArgs.split(" "); //$NON-NLS-1$
}
@@ -447,7 +447,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
}
public String[] getMakeCommand() {
- String buildCommandStr = getProperties().get(BUILD_COMMAND);
+ String buildCommandStr = getProperty(BUILD_COMMAND);
if (buildCommandStr != null) {
String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$
Path command = findCommand(buildCommand[0]);
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/Activator.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/Activator.java
index 2f1f20995e..17e55adb6a 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/Activator.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/Activator.java
@@ -118,6 +118,10 @@ public class Activator extends AbstractUIPlugin {
getDefault().getLog().log(new Status(code, PLUGIN_ID, msg, e));
}
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
public static <T> T getService(Class<T> service) {
BundleContext context = plugin.getBundle().getBundleContext();
ServiceReference<T> ref = context.getServiceReference(service);
diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/launch/QtBuildTab.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/launch/QtBuildTab.java
index 7430c6cf65..e03995a708 100644
--- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/launch/QtBuildTab.java
+++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/launch/QtBuildTab.java
@@ -8,12 +8,10 @@
package org.eclipse.cdt.internal.qt.ui.launch;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
import org.eclipse.cdt.internal.qt.core.build.QtBuildConfiguration;
import org.eclipse.cdt.internal.qt.ui.Activator;
import org.eclipse.cdt.internal.qt.ui.Messages;
@@ -34,9 +32,9 @@ import org.eclipse.swt.widgets.Text;
public class QtBuildTab extends CommonBuildTab {
- Combo qmakeCombo;
- Text qmakeArgsText;
- Text buildCmdText;
+ private Combo qmakeCombo;
+ private Text qmakeArgsText;
+ private Text buildCmdText;
@Override
public void createControl(Composite parent) {
@@ -64,38 +62,15 @@ public class QtBuildTab extends CommonBuildTab {
}
@Override
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- try {
- String mode = getLaunchConfigurationDialog().getMode();
- configuration.setAttribute(CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode),
- getBuildConfiguration(configuration).getDefaultProperties());
- } catch (CoreException e) {
- Activator.log(e);
- }
- }
-
- private Map<String, String> getProperties(ILaunchConfiguration configuration) throws CoreException {
- String mode = getLaunchConfigurationDialog().getMode();
- Map<String, String> properties = configuration
- .getAttribute(CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode), new HashMap<>());
- if (properties.isEmpty()) {
- properties = getBuildConfiguration(configuration).getProperties();
- }
-
- return properties;
- }
-
- @Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- Map<String, String> properties = getProperties(configuration);
-
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
// qmake command
IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
IQtInstallManager qtManager = Activator.getService(IQtInstallManager.class);
ILaunchTarget target = getLaunchTarget();
- String qmakeCmd = properties.get(QtBuildConfiguration.QMAKE_COMMAND);
+ String qmakeCmd = buildConfig.getProperty(QtBuildConfiguration.QMAKE_COMMAND);
qmakeCombo.removeAll();
Collection<IToolChain> toolChains = tcManager.getToolChainsMatching(target.getAttributes());
int select = -1;
@@ -116,13 +91,13 @@ public class QtBuildTab extends CommonBuildTab {
}
// qmake args
- String qmakeArgs = properties.get(QtBuildConfiguration.QMAKE_ARGS);
+ String qmakeArgs = buildConfig.getProperty(QtBuildConfiguration.QMAKE_ARGS);
if (qmakeArgs != null) {
qmakeArgsText.setText(qmakeArgs);
}
// build command
- String buildCommand = properties.get(QtBuildConfiguration.BUILD_COMMAND);
+ String buildCommand = buildConfig.getProperty(QtBuildConfiguration.BUILD_COMMAND);
if (buildCommand != null) {
buildCmdText.setText(buildCommand);
}
@@ -132,17 +107,29 @@ public class QtBuildTab extends CommonBuildTab {
}
@Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+ buildConfig.removeProperty(QtBuildConfiguration.QMAKE_ARGS);
+ buildConfig.removeProperty(QtBuildConfiguration.BUILD_COMMAND);
+ }
+
+ @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- try {
- Map<String, String> properties = new HashMap<>(getProperties(configuration));
- properties.put(QtBuildConfiguration.QMAKE_COMMAND, qmakeCombo.getItem(qmakeCombo.getSelectionIndex()));
- properties.put(QtBuildConfiguration.QMAKE_ARGS, qmakeArgsText.getText().trim());
- properties.put(QtBuildConfiguration.BUILD_COMMAND, buildCmdText.getText().trim());
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+ buildConfig.setProperty(QtBuildConfiguration.QMAKE_COMMAND, qmakeCombo.getItem(qmakeCombo.getSelectionIndex()));
+
+ String qmakeArgs = qmakeArgsText.getText().trim();
+ if (qmakeArgs.isEmpty()) {
+ buildConfig.removeProperty(QtBuildConfiguration.QMAKE_ARGS);
+ } else {
+ buildConfig.setProperty(QtBuildConfiguration.QMAKE_ARGS, qmakeArgs);
+ }
- String mode = getLaunchBarLaunchConfigDialog().getMode();
- configuration.setAttribute(CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode), properties);
- } catch (CoreException e) {
- Activator.log(e);
+ String buildCmd = buildCmdText.getText().trim();
+ if (buildCmd.isEmpty()) {
+ buildConfig.removeProperty(QtBuildConfiguration.BUILD_COMMAND);
+ } else {
+ buildConfig.setProperty(QtBuildConfiguration.BUILD_COMMAND, buildCmd);
}
}

Back to the top