mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Allow for changing manually setting toolchains for build configs.
A number of changes that clean up how build configs are done. Now build settings are stored with the build config instead of in launch configs. That makes it less launch bar specific. Add build settings UI to change the toolchain used for a given launch config. Also changed CMake so it's IToolchain based instead of property which doesn't work when multiple IToolchains match. Change-Id: I958d90ede3c1f873ab1530c2b2880808e8f7abef
This commit is contained in:
parent
f2115d3a56
commit
affb599f24
42 changed files with 1142 additions and 605 deletions
|
@ -103,7 +103,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
idBuilder.append(arch);
|
idBuilder.append(arch);
|
||||||
}
|
}
|
||||||
idBuilder.append('-');
|
idBuilder.append('-');
|
||||||
idBuilder.append(pathToToolChain.toString());
|
idBuilder.append(pathToToolChain.toString().replaceAll("\\\\", "/")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
this.id = idBuilder.toString();
|
this.id = idBuilder.toString();
|
||||||
|
|
||||||
properties.put(ATTR_ARCH, arch);
|
properties.put(ATTR_ARCH, arch);
|
||||||
|
|
|
@ -40,6 +40,9 @@ public class GCCPathToolChainProvider implements IToolChainProvider {
|
||||||
File dir = new File(dirStr);
|
File dir = new File(dirStr);
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
for (File file : dir.listFiles()) {
|
for (File file : dir.listFiles()) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Matcher matcher = gccPattern.matcher(file.getName());
|
Matcher matcher = gccPattern.matcher(file.getName());
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -9,6 +9,15 @@ package org.eclipse.cdt.cmake.core;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
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 {
|
public interface ICMakeToolChainFile {
|
||||||
|
|
||||||
Path getPath();
|
Path getPath();
|
||||||
|
@ -17,4 +26,6 @@ public interface ICMakeToolChainFile {
|
||||||
|
|
||||||
void setProperty(String key, String value);
|
void setProperty(String key, String value);
|
||||||
|
|
||||||
|
IToolChain getToolChain() throws CoreException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,13 @@ import java.nio.file.Path;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.build.IToolChain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages toolchain files for CMake.
|
* Manages toolchain files for CMake.
|
||||||
*
|
*
|
||||||
* @noimplement
|
* @noimplement
|
||||||
|
* @noextend
|
||||||
*/
|
*/
|
||||||
public interface ICMakeToolChainManager {
|
public interface ICMakeToolChainManager {
|
||||||
|
|
||||||
|
@ -28,6 +31,8 @@ public interface ICMakeToolChainManager {
|
||||||
|
|
||||||
Collection<ICMakeToolChainFile> getToolChainFilesMatching(Map<String, String> properties);
|
Collection<ICMakeToolChainFile> getToolChainFilesMatching(Map<String, String> properties);
|
||||||
|
|
||||||
|
ICMakeToolChainFile getToolChainFileFor(IToolChain toolchain);
|
||||||
|
|
||||||
Collection<ICMakeToolChainFile> getToolChainFiles();
|
Collection<ICMakeToolChainFile> getToolChainFiles();
|
||||||
|
|
||||||
void addListener(ICMakeToolChainListener listener);
|
void addListener(ICMakeToolChainListener listener);
|
||||||
|
|
|
@ -90,8 +90,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
try {
|
try {
|
||||||
Map<String, String> properties = getProperties();
|
String generator = getProperty(CMAKE_GENERATOR);
|
||||||
String generator = properties.get(CMAKE_GENERATOR);
|
|
||||||
if (generator == null) {
|
if (generator == null) {
|
||||||
generator = "Ninja"; //$NON-NLS-1$
|
generator = "Ninja"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -131,7 +130,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
|
|
||||||
command.add("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"); //$NON-NLS-1$
|
command.add("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"); //$NON-NLS-1$
|
||||||
|
|
||||||
String userArgs = properties.get(CMAKE_ARGUMENTS);
|
String userArgs = getProperty(CMAKE_ARGUMENTS);
|
||||||
if (userArgs != null) {
|
if (userArgs != null) {
|
||||||
command.addAll(Arrays.asList(userArgs.trim().split("\\s+"))); //$NON-NLS-1$
|
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,
|
try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this,
|
||||||
getToolChain().getErrorParserIds())) {
|
getToolChain().getErrorParserIds())) {
|
||||||
String buildCommand = properties.get(BUILD_COMMAND);
|
String buildCommand = getProperty(BUILD_COMMAND);
|
||||||
if (buildCommand == null) {
|
if (buildCommand == null) {
|
||||||
if (generator.equals("Ninja")) { //$NON-NLS-1$
|
if (generator.equals("Ninja")) { //$NON-NLS-1$
|
||||||
buildCommand = "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 {
|
public void clean(IConsole console, IProgressMonitor monitor) throws CoreException {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
try {
|
try {
|
||||||
Map<String, String> properties = getProperties();
|
String generator = getProperty(CMAKE_GENERATOR);
|
||||||
String generator = properties.get(CMAKE_GENERATOR);
|
|
||||||
|
|
||||||
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
|
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
|
||||||
|
|
||||||
|
@ -198,7 +196,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String cleanCommand = properties.get(CLEAN_COMMAND);
|
String cleanCommand = getProperty(CLEAN_COMMAND);
|
||||||
if (cleanCommand == null) {
|
if (cleanCommand == null) {
|
||||||
if (generator == null || generator.equals("Ninja")) { //$NON-NLS-1$
|
if (generator == null || generator.equals("Ninja")) { //$NON-NLS-1$
|
||||||
cleanCommand = "ninja clean"; //$NON-NLS-1$
|
cleanCommand = "ninja clean"; //$NON-NLS-1$
|
||||||
|
|
|
@ -73,18 +73,6 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv
|
||||||
@Override
|
@Override
|
||||||
public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
||||||
IProgressMonitor monitor) throws CoreException {
|
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
|
// get matching toolchain file if any
|
||||||
Map<String, String> properties = new HashMap<>();
|
Map<String, String> properties = new HashMap<>();
|
||||||
String os = toolChain.getProperty(IToolChain.ATTR_OS);
|
String os = toolChain.getProperty(IToolChain.ATTR_OS);
|
||||||
|
@ -108,13 +96,13 @@ public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProv
|
||||||
configName.append('.');
|
configName.append('.');
|
||||||
configName.append(os);
|
configName.append(os);
|
||||||
}
|
}
|
||||||
if (arch != null) {
|
if (arch != null && !arch.isEmpty()) {
|
||||||
configName.append('.');
|
configName.append('.');
|
||||||
configName.append(arch);
|
configName.append(arch);
|
||||||
}
|
}
|
||||||
String name = configName.toString();
|
String name = configName.toString();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (project.hasBuildConfig(name)) {
|
while (configManager.hasConfiguration(this, project, name)) {
|
||||||
name = configName.toString() + '.' + (++i);
|
name = configName.toString() + '.' + (++i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,20 @@
|
||||||
package org.eclipse.cdt.cmake.core.internal;
|
package org.eclipse.cdt.cmake.core.internal;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
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 {
|
public class CMakeToolChainFile implements ICMakeToolChainFile {
|
||||||
|
|
||||||
String n;
|
String n;
|
||||||
private final Path path;
|
private final Path path;
|
||||||
|
private IToolChain toolchain;
|
||||||
|
|
||||||
final Map<String, String> properties = new HashMap<>();
|
final Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
|
@ -40,6 +45,23 @@ public class CMakeToolChainFile implements ICMakeToolChainFile {
|
||||||
properties.put(key, value);
|
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) {
|
boolean matches(Map<String, String> properties) {
|
||||||
for (Map.Entry<String, String> property : properties.entrySet()) {
|
for (Map.Entry<String, String> property : properties.entrySet()) {
|
||||||
if (!property.getValue().equals(getProperty(property.getKey()))) {
|
if (!property.getValue().equals(getProperty(property.getKey()))) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainListener;
|
import org.eclipse.cdt.cmake.core.ICMakeToolChainListener;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainProvider;
|
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.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
@ -181,6 +182,19 @@ public class CMakeToolChainManager implements ICMakeToolChainManager {
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public void addListener(ICMakeToolChainListener listener) {
|
public void addListener(ICMakeToolChainListener listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
|
|
|
@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.debug.ui;bundle-version="3.11.200",
|
org.eclipse.debug.ui;bundle-version="3.11.200",
|
||||||
org.eclipse.cdt.launch;bundle-version="9.1.0",
|
org.eclipse.cdt.launch;bundle-version="9.1.0",
|
||||||
org.eclipse.cdt.debug.core;bundle-version="8.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-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -40,9 +40,13 @@ public class Activator extends AbstractUIPlugin {
|
||||||
return new Status(IStatus.ERROR, PLUGIN_ID, message, cause);
|
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) {
|
public static void log(Exception e) {
|
||||||
if (e instanceof CoreException) {
|
if (e instanceof CoreException) {
|
||||||
plugin.getLog().log(((CoreException) e).getStatus());
|
log(((CoreException) e).getStatus());
|
||||||
} else {
|
} else {
|
||||||
plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
|
plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,15 +7,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.cmake.ui.internal;
|
package org.eclipse.cdt.cmake.ui.internal;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
|
import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
|
||||||
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfigurationProvider;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
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.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
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.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
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.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
|
public class CMakeBuildTab extends CommonBuildTab {
|
||||||
|
|
||||||
private Button unixGenButton;
|
private Button unixGenButton;
|
||||||
private Button ninjaGenButton;
|
private Button ninjaGenButton;
|
||||||
|
@ -34,16 +35,29 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
|
||||||
private Text buildCommandText;
|
private Text buildCommandText;
|
||||||
private Text cleanCommandText;
|
private Text cleanCommandText;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBuildConfigProviderId() {
|
||||||
|
return CMakeBuildConfigurationProvider.ID;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Composite comp = new Composite(parent, SWT.NONE);
|
Composite comp = new Composite(parent, SWT.NONE);
|
||||||
comp.setLayout(new GridLayout());
|
comp.setLayout(new GridLayout());
|
||||||
setControl(comp);
|
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);
|
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));
|
genComp.setLayout(new GridLayout(2, true));
|
||||||
|
|
||||||
unixGenButton = new Button(genComp, SWT.RADIO);
|
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);
|
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.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
cmakeArgsText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
cmakeArgsText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
||||||
|
|
||||||
label = new Label(comp, SWT.NONE);
|
label = new Label(cmakeGroup, SWT.NONE);
|
||||||
label.setText(Messages.CMakeBuildTab_BuildCommand);
|
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.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
buildCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
buildCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
||||||
|
|
||||||
label = new Label(comp, SWT.NONE);
|
label = new Label(cmakeGroup, SWT.NONE);
|
||||||
label.setText(Messages.CMakeBuildTab_CleanCommand);
|
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.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
cleanCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
cleanCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
|
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
|
||||||
String mode = getLaunchConfigurationDialog().getMode();
|
// TODO
|
||||||
configuration.removeAttribute("COREBUILD_" + mode); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeFrom(ILaunchConfiguration configuration) {
|
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||||
try {
|
super.initializeFrom(configuration);
|
||||||
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);
|
ICBuildConfiguration buildConfig = getBuildConfiguration();
|
||||||
updateGeneratorButtons(generator);
|
|
||||||
|
|
||||||
String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
|
String generator = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_GENERATOR);
|
||||||
if (cmakeArgs != null) {
|
updateGeneratorButtons(generator);
|
||||||
cmakeArgsText.setText(cmakeArgs);
|
|
||||||
} else {
|
|
||||||
cmakeArgsText.setText(""); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
String buildCommand = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
|
String cmakeArgs = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
|
||||||
if (buildCommand != null) {
|
if (cmakeArgs != null) {
|
||||||
buildCommandText.setText(buildCommand);
|
cmakeArgsText.setText(cmakeArgs);
|
||||||
} else {
|
} else {
|
||||||
buildCommandText.setText(""); //$NON-NLS-1$
|
cmakeArgsText.setText(""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
String cleanCommand = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
|
String buildCommand = buildConfig.getProperty(CMakeBuildConfiguration.BUILD_COMMAND);
|
||||||
if (cleanCommand != null) {
|
if (buildCommand != null) {
|
||||||
cleanCommandText.setText(buildCommand);
|
buildCommandText.setText(buildCommand);
|
||||||
} else {
|
} else {
|
||||||
cleanCommandText.setText(""); //$NON-NLS-1$
|
buildCommandText.setText(""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
Activator.log(e);
|
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
|
@Override
|
||||||
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
|
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$
|
ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String cmakeArgs = cmakeArgsText.getText().trim();
|
String cmakeArgs = cmakeArgsText.getText().trim();
|
||||||
if (!cmakeArgs.isEmpty()) {
|
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();
|
String buildCommand = buildCommandText.getText().trim();
|
||||||
if (!buildCommand.isEmpty()) {
|
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();
|
String cleanCommand = cleanCommandText.getText().trim();
|
||||||
if (!cleanCommand.isEmpty()) {
|
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 buildAttribute = CoreBuildLaunchConfigDelegate
|
String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
|
||||||
.getBuildAttributeName(getLaunchConfigurationDialog().getMode());
|
if (cmakeArgs != null) {
|
||||||
if (!properties.isEmpty()) {
|
cmakeArgsText.setText(cmakeArgs);
|
||||||
configuration.setAttribute(buildAttribute, properties);
|
|
||||||
} else {
|
} else {
|
||||||
configuration.removeAttribute(buildAttribute);
|
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 cleanCmd = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
|
||||||
|
if (cleanCmd != null) {
|
||||||
|
cleanCommandText.setText(cleanCmd);
|
||||||
|
} else {
|
||||||
|
cleanCommandText.setText(""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
||||||
import org.eclipse.cdt.core.build.IToolChain;
|
import org.eclipse.cdt.core.build.IToolChain;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.layout.TableColumnLayout;
|
import org.eclipse.jface.layout.TableColumnLayout;
|
||||||
import org.eclipse.jface.preference.PreferencePage;
|
import org.eclipse.jface.preference.PreferencePage;
|
||||||
|
@ -59,7 +60,7 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
|
||||||
|
|
||||||
Group filesGroup = new Group(control, SWT.NONE);
|
Group filesGroup = new Group(control, SWT.NONE);
|
||||||
filesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
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));
|
filesGroup.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
Composite filesComp = new Composite(filesGroup, SWT.NONE);
|
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);
|
TableColumn pathColumn = new TableColumn(filesTable, SWT.NONE);
|
||||||
pathColumn.setText("ToolChain File");
|
pathColumn.setText(Messages.CMakePreferencePage_Path);
|
||||||
|
|
||||||
TableColumn osColumn = new TableColumn(filesTable, SWT.NONE);
|
TableColumn tcColumn = new TableColumn(filesTable, SWT.NONE);
|
||||||
osColumn.setText("OS");
|
tcColumn.setText(Messages.CMakePreferencePage_Toolchain);
|
||||||
|
|
||||||
TableColumn archColumn = new TableColumn(filesTable, SWT.NONE);
|
|
||||||
archColumn.setText("CPU");
|
|
||||||
|
|
||||||
TableColumnLayout tableLayout = new TableColumnLayout();
|
TableColumnLayout tableLayout = new TableColumnLayout();
|
||||||
tableLayout.setColumnData(pathColumn, new ColumnWeightData(75, 350, true));
|
tableLayout.setColumnData(pathColumn, new ColumnWeightData(50, 350, true));
|
||||||
tableLayout.setColumnData(osColumn, new ColumnWeightData(25, 100, true));
|
tableLayout.setColumnData(tcColumn, new ColumnWeightData(50, 350, true));
|
||||||
tableLayout.setColumnData(archColumn, new ColumnWeightData(25, 100, true));
|
|
||||||
filesComp.setLayout(tableLayout);
|
filesComp.setLayout(tableLayout);
|
||||||
|
|
||||||
Composite buttonsComp = new Composite(filesGroup, SWT.NONE);
|
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);
|
Button addButton = new Button(buttonsComp, SWT.PUSH);
|
||||||
addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
||||||
addButton.setText("Add...");
|
addButton.setText(Messages.CMakePreferencePage_Add);
|
||||||
addButton.addSelectionListener(new SelectionAdapter() {
|
addButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard(getFiles());
|
NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard();
|
||||||
WizardDialog dialog = new WizardDialog(getShell(), wizard);
|
WizardDialog dialog = new WizardDialog(getShell(), wizard);
|
||||||
if (dialog.open() == Window.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
ICMakeToolChainFile file = wizard.getNewFile();
|
ICMakeToolChainFile file = wizard.getNewFile();
|
||||||
|
@ -115,11 +112,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
|
||||||
|
|
||||||
removeButton = new Button(buttonsComp, SWT.PUSH);
|
removeButton = new Button(buttonsComp, SWT.PUSH);
|
||||||
removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
||||||
removeButton.setText("Remove");
|
removeButton.setText(Messages.CMakePreferencePage_Remove);
|
||||||
removeButton.setEnabled(false);
|
removeButton.setEnabled(false);
|
||||||
removeButton.addListener(SWT.Selection, e -> {
|
removeButton.addListener(SWT.Selection, e -> {
|
||||||
if (MessageDialog.openConfirm(getShell(), "Deregister CMake ToolChain File",
|
if (MessageDialog.openConfirm(getShell(), Messages.CMakePreferencePage_ConfirmRemoveTitle,
|
||||||
"Do you wish to deregister the selected files?")) {
|
Messages.CMakePreferencePage_ConfirmRemoveDesc)) {
|
||||||
for (TableItem item : filesTable.getSelection()) {
|
for (TableItem item : filesTable.getSelection()) {
|
||||||
ICMakeToolChainFile file = (ICMakeToolChainFile) item.getData();
|
ICMakeToolChainFile file = (ICMakeToolChainFile) item.getData();
|
||||||
if (filesToAdd.containsKey(file.getPath())) {
|
if (filesToAdd.containsKey(file.getPath())) {
|
||||||
|
@ -145,14 +142,16 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
|
||||||
for (ICMakeToolChainFile file : sorted) {
|
for (ICMakeToolChainFile file : sorted) {
|
||||||
TableItem item = new TableItem(filesTable, SWT.NONE);
|
TableItem item = new TableItem(filesTable, SWT.NONE);
|
||||||
item.setText(0, file.getPath().toString());
|
item.setText(0, file.getPath().toString());
|
||||||
String os = file.getProperty(IToolChain.ATTR_OS);
|
|
||||||
if (os != null) {
|
try {
|
||||||
item.setText(1, os);
|
IToolChain tc = file.getToolChain();
|
||||||
}
|
if (tc != null) {
|
||||||
String arch = file.getProperty(IToolChain.ATTR_ARCH);
|
item.setText(1, tc.getName());
|
||||||
if (arch != null) {
|
}
|
||||||
item.setText(2, arch);
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setData(file);
|
item.setData(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,17 @@ public class Messages extends NLS {
|
||||||
public static String CMakeBuildTab_CMakeArgs;
|
public static String CMakeBuildTab_CMakeArgs;
|
||||||
public static String CMakeBuildTab_Generator;
|
public static String CMakeBuildTab_Generator;
|
||||||
public static String CMakeBuildTab_Ninja;
|
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 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_Body;
|
||||||
public static String CMakePropertyPage_FailedToStartCMakeGui_Title;
|
public static String CMakePropertyPage_FailedToStartCMakeGui_Title;
|
||||||
public static String CMakePropertyPage_LaunchCMakeGui;
|
public static String CMakePropertyPage_LaunchCMakeGui;
|
||||||
|
@ -26,6 +36,13 @@ public class Messages extends NLS {
|
||||||
public static String NewCMakeProjectWizard_PageTitle;
|
public static String NewCMakeProjectWizard_PageTitle;
|
||||||
public static String NewCMakeProjectWizard_WindowTitle;
|
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 {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
NLS.initializeMessages("org.eclipse.cdt.cmake.ui.internal.messages", Messages.class); //$NON-NLS-1$
|
NLS.initializeMessages("org.eclipse.cdt.cmake.ui.internal.messages", Messages.class); //$NON-NLS-1$
|
||||||
|
|
|
@ -7,18 +7,20 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.cmake.ui.internal;
|
package org.eclipse.cdt.cmake.ui.internal;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
|
||||||
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
|
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.IToolChain;
|
||||||
|
import org.eclipse.cdt.core.build.IToolChainManager;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
@ -26,14 +28,13 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
public class NewCMakeToolChainFilePage extends WizardPage {
|
public class NewCMakeToolChainFilePage extends WizardPage {
|
||||||
|
|
||||||
private final Map<Path, ICMakeToolChainFile> existing;
|
|
||||||
private Text pathText;
|
private Text pathText;
|
||||||
private Text osText;
|
private Combo tcCombo;
|
||||||
private Text archText;
|
|
||||||
|
|
||||||
public NewCMakeToolChainFilePage(Map<Path, ICMakeToolChainFile> existing) {
|
private IToolChain[] toolchains;
|
||||||
super("NewCMakeToolChainFilePage", "New CMake ToolChain File", null); //$NON-NLS-1$
|
|
||||||
this.existing = existing;
|
public NewCMakeToolChainFilePage() {
|
||||||
|
super("NewCMakeToolChainFilePage", Messages.NewCMakeToolChainFilePage_Title, null); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,7 +45,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
|
||||||
|
|
||||||
Label pathLabel = new Label(comp, SWT.NONE);
|
Label pathLabel = new Label(comp, SWT.NONE);
|
||||||
pathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
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);
|
Composite pathComp = new Composite(comp, SWT.NONE);
|
||||||
pathComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
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);
|
Button pathButton = new Button(pathComp, SWT.PUSH);
|
||||||
pathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
pathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
|
||||||
pathButton.setText("Browse...");
|
pathButton.setText(Messages.NewCMakeToolChainFilePage_Browse);
|
||||||
pathButton.addListener(SWT.Selection, e -> {
|
pathButton.addListener(SWT.Selection, e -> {
|
||||||
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
|
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
|
||||||
dialog.setText("Select location for CMake toolchain file");
|
dialog.setText(Messages.NewCMakeToolChainFilePage_Select);
|
||||||
String path = dialog.open();
|
String path = dialog.open();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
pathText.setText(path);
|
pathText.setText(path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Label osLabel = new Label(comp, SWT.NONE);
|
Label tcLabel = new Label(comp, SWT.NONE);
|
||||||
osLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
tcLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
||||||
osLabel.setText("Target OS:");
|
tcLabel.setText(Messages.NewCMakeToolChainFilePage_Toolchain);
|
||||||
|
|
||||||
osText = new Text(comp, SWT.BORDER);
|
tcCombo = new Combo(comp, SWT.READ_ONLY);
|
||||||
osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
tcCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
osText.addModifyListener(e -> validate());
|
|
||||||
|
try {
|
||||||
Label archLabel = new Label(comp, SWT.NONE);
|
IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
|
||||||
archLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
toolchains = tcManager.getAllToolChains().toArray(new IToolChain[0]);
|
||||||
archLabel.setText("Target CPU:");
|
for (IToolChain tc : toolchains) {
|
||||||
|
tcCombo.add(tc.getName());
|
||||||
archText = new Text(comp, SWT.BORDER);
|
}
|
||||||
archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
tcCombo.select(0);
|
||||||
archText.addModifyListener(e -> validate());
|
} catch (CoreException e) {
|
||||||
|
Activator.log(e.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
setControl(comp);
|
setControl(comp);
|
||||||
validate();
|
validate();
|
||||||
|
@ -93,17 +96,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
|
||||||
|
|
||||||
String path = pathText.getText();
|
String path = pathText.getText();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
setErrorMessage("Please set the path to the CMake toolchain file.");
|
setErrorMessage(Messages.NewCMakeToolChainFilePage_NoPath);
|
||||||
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.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,15 +108,9 @@ public class NewCMakeToolChainFilePage extends WizardPage {
|
||||||
ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
|
ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
|
||||||
ICMakeToolChainFile file = manager.newToolChainFile(Paths.get(pathText.getText()));
|
ICMakeToolChainFile file = manager.newToolChainFile(Paths.get(pathText.getText()));
|
||||||
|
|
||||||
String os = osText.getText();
|
IToolChain tc = toolchains[tcCombo.getSelectionIndex()];
|
||||||
if (!os.isEmpty()) {
|
file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_TYPE, tc.getProvider().getId());
|
||||||
file.setProperty(IToolChain.ATTR_OS, os);
|
file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_ID, tc.getId());
|
||||||
}
|
|
||||||
|
|
||||||
String arch = archText.getText();
|
|
||||||
if (!arch.isEmpty()) {
|
|
||||||
file.setProperty(IToolChain.ATTR_ARCH, arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.cmake.ui.internal;
|
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.cdt.cmake.core.ICMakeToolChainFile;
|
||||||
import org.eclipse.jface.wizard.Wizard;
|
import org.eclipse.jface.wizard.Wizard;
|
||||||
|
|
||||||
|
@ -18,12 +15,9 @@ public class NewCMakeToolChainFileWizard extends Wizard {
|
||||||
private ICMakeToolChainFile newFile;
|
private ICMakeToolChainFile newFile;
|
||||||
private NewCMakeToolChainFilePage page;
|
private NewCMakeToolChainFilePage page;
|
||||||
|
|
||||||
public NewCMakeToolChainFileWizard(Map<Path, ICMakeToolChainFile> existing) {
|
|
||||||
page = new NewCMakeToolChainFilePage(existing);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPages() {
|
public void addPages() {
|
||||||
|
page = new NewCMakeToolChainFilePage();
|
||||||
addPage(page);
|
addPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,26 @@ CMakeBuildTab_Cmake=CMake
|
||||||
CMakeBuildTab_CMakeArgs=Additional CMake arguments:
|
CMakeBuildTab_CMakeArgs=Additional CMake arguments:
|
||||||
CMakeBuildTab_Generator=Generator
|
CMakeBuildTab_Generator=Generator
|
||||||
CMakeBuildTab_Ninja=Ninja
|
CMakeBuildTab_Ninja=Ninja
|
||||||
|
CMakeBuildTab_NoneAvailable=No Toolchains Available for this Target
|
||||||
|
CMakeBuildTab_Settings=CMake Settings
|
||||||
|
CMakeBuildTab_Toolchain=Toolchain
|
||||||
CMakeBuildTab_UnixMakefiles=Unix Makefiles
|
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_Body=Failed to run the CMake GUI:
|
||||||
CMakePropertyPage_FailedToStartCMakeGui_Title=Failed to run CMake GUI
|
CMakePropertyPage_FailedToStartCMakeGui_Title=Failed to run CMake GUI
|
||||||
CMakePropertyPage_LaunchCMakeGui=Launch CMake GUI...
|
CMakePropertyPage_LaunchCMakeGui=Launch CMake GUI...
|
||||||
NewCMakeProjectWizard_Description=Specify properties of new CMake project.
|
NewCMakeProjectWizard_Description=Specify properties of new CMake project.
|
||||||
NewCMakeProjectWizard_PageTitle=New CMake Project
|
NewCMakeProjectWizard_PageTitle=New CMake Project
|
||||||
NewCMakeProjectWizard_WindowTitle=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:
|
||||||
|
|
|
@ -1,5 +1,51 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<component id="org.eclipse.cdt.core" version="2">
|
<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<IToolChain>)"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
<resource path="src/org/eclipse/cdt/core/build/IToolChainProvider.java" type="org.eclipse.cdt.core.build.IToolChainProvider">
|
<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">
|
<filter comment="This interface is still pretty new. Assuming low risk." id="404000815">
|
||||||
<message_arguments>
|
<message_arguments>
|
||||||
|
|
|
@ -108,9 +108,11 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public class CCorePlugin extends Plugin {
|
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_EXISTS = 1;
|
||||||
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
|
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
|
||||||
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
|
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status code for core exception that is thrown if a pdom grew larger than
|
* Status code for core exception that is thrown if a pdom grew larger than
|
||||||
* the supported limit.
|
* the supported limit.
|
||||||
|
@ -119,6 +121,13 @@ public class CCorePlugin extends Plugin {
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_PDOM_TOO_LARGE = 4;
|
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 PLUGIN_ID = "org.eclipse.cdt.core"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
|
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -96,9 +95,6 @@ import com.google.gson.JsonParseException;
|
||||||
public abstract class CBuildConfiguration extends PlatformObject
|
public abstract class CBuildConfiguration extends PlatformObject
|
||||||
implements ICBuildConfiguration, IMarkerGenerator, IConsoleParser {
|
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 String LAUNCH_MODE = "cdt.launchMode"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final List<String> DEFAULT_COMMAND = new ArrayList<>(0);
|
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 final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
|
||||||
private ScannerInfoCache scannerInfoCache;
|
private ScannerInfoCache scannerInfoCache;
|
||||||
|
|
||||||
private Map<String, String> properties;
|
|
||||||
|
|
||||||
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
|
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -120,9 +114,8 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
Preferences settings = getSettings();
|
Preferences settings = getSettings();
|
||||||
String typeId = settings.get(TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
|
String typeId = settings.get(TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
|
||||||
String id = settings.get(TOOLCHAIN_ID, ""); //$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);
|
IToolChainManager toolChainManager = CCorePlugin.getService(IToolChainManager.class);
|
||||||
IToolChain tc = toolChainManager.getToolChain(typeId, id, version);
|
IToolChain tc = toolChainManager.getToolChain(typeId, id);
|
||||||
|
|
||||||
if (tc == null) {
|
if (tc == null) {
|
||||||
// check for other versions
|
// check for other versions
|
||||||
|
@ -132,7 +125,9 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
tc = tcs.iterator().next();
|
tc = tcs.iterator().next();
|
||||||
} else {
|
} else {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
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;
|
toolChain = tc;
|
||||||
|
@ -157,7 +152,6 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
Preferences settings = getSettings();
|
Preferences settings = getSettings();
|
||||||
settings.put(TOOLCHAIN_TYPE, toolChain.getProvider().getId());
|
settings.put(TOOLCHAIN_TYPE, toolChain.getProvider().getId());
|
||||||
settings.put(TOOLCHAIN_ID, toolChain.getId());
|
settings.put(TOOLCHAIN_ID, toolChain.getId());
|
||||||
settings.put(TOOLCHAIN_VERSION, toolChain.getVersion());
|
|
||||||
try {
|
try {
|
||||||
settings.flush();
|
settings.flush();
|
||||||
} catch (BackingStoreException e) {
|
} catch (BackingStoreException e) {
|
||||||
|
@ -181,6 +175,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
/**
|
/**
|
||||||
* @since 6.2
|
* @since 6.2
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getLaunchMode() {
|
public String getLaunchMode() {
|
||||||
return launchMode;
|
return launchMode;
|
||||||
}
|
}
|
||||||
|
@ -756,12 +751,11 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean setProperties(Map<String, String> properties) {
|
public boolean setProperties(Map<String, String> properties) {
|
||||||
if (this.properties == null || !this.properties.equals(properties)) {
|
Preferences settings = getSettings();
|
||||||
this.properties = properties;
|
for (Entry<String, String> entry : properties.entrySet()) {
|
||||||
return true;
|
settings.put(entry.getKey(), entry.getValue());
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -769,10 +763,42 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getProperties() {
|
public Map<String, String> getProperties() {
|
||||||
if (properties == null) {
|
Map<String, String> properties = new HashMap<>();
|
||||||
properties = getDefaultProperties();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,11 +34,21 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
||||||
* CDT doesn't like that the Platform default config name is an empty string.
|
* 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.
|
* 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
|
* @since 6.4
|
||||||
* configuration is associated with.
|
*/
|
||||||
|
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
|
* @return resources build configuration
|
||||||
*/
|
*/
|
||||||
|
@ -51,6 +61,15 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
||||||
*/
|
*/
|
||||||
IToolChain getToolChain() throws CoreException;
|
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
|
* Ids for the Binary Parsers to use when checking whether a file is a
|
||||||
* binary that can be launched.
|
* 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 all of the build environment variables for this configuration.
|
||||||
*
|
*
|
||||||
* @return
|
* @return environment variables
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
IEnvironmentVariable[] getVariables() throws CoreException;
|
IEnvironmentVariable[] getVariables() throws CoreException;
|
||||||
|
@ -160,6 +179,45 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Returns whether this build configuration supports the given build
|
||||||
* properties.
|
* properties.
|
||||||
|
|
|
@ -1,112 +1,129 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2016 QNX Software Systems and others.
|
* Copyright (c) 2016 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.build;
|
package org.eclipse.cdt.core.build;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OSGi service that manages the mapping from platform build configuration
|
* The OSGi service that manages the mapping from platform build configuration
|
||||||
* to CDT build configuration.
|
* to CDT build configuration.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICBuildConfigurationManager {
|
public interface ICBuildConfigurationManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the build configuration provider with the given id.
|
* Return the build configuration provider with the given id.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return build configuration provider
|
* @return build configuration provider
|
||||||
*/
|
*/
|
||||||
ICBuildConfigurationProvider getProvider(String id);
|
ICBuildConfigurationProvider getProvider(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new build configuration to be owned by a provider.
|
* Return whether the given project has a configuration with the given
|
||||||
*
|
* configName.
|
||||||
* @param provider
|
*
|
||||||
* @param project
|
* @param provider
|
||||||
* @param configName
|
* @param project
|
||||||
* @param monitor
|
* @param configName
|
||||||
* @return new build configuration
|
* @return true if project has the named config
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
* @since 6.4
|
||||||
IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
|
*/
|
||||||
String configName, IProgressMonitor monitor) throws CoreException;
|
boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project, String configName)
|
||||||
|
throws CoreException;
|
||||||
/**
|
|
||||||
* Create a new build configuration for a given project using a given
|
/**
|
||||||
* toolchain and builds for a given launch mode.
|
* Create a new build configuration to be owned by a provider.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param provider
|
||||||
* project for the config
|
* @param project
|
||||||
* @param toolChain
|
* @param configName
|
||||||
* toolchain the build config will use
|
* @param monitor
|
||||||
* @param launchMode
|
* @return new build configuration
|
||||||
* launch mode the buld config will build for
|
* @throws CoreException
|
||||||
* @return new build configuration
|
*/
|
||||||
* @throws CoreException
|
IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
|
||||||
* @since 6.1
|
String configName, IProgressMonitor monitor) throws CoreException;
|
||||||
*/
|
|
||||||
ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
/**
|
||||||
IProgressMonitor monitor) throws CoreException;
|
* Create a new build configuration for a given project using a given
|
||||||
|
* toolchain and builds for a given launch mode.
|
||||||
/**
|
*
|
||||||
* Create a new build configuration for a given project using a toolchain
|
* @param project
|
||||||
* with the given properties and that builds for a given launch mode.
|
* project for the config
|
||||||
*
|
* @param toolChain
|
||||||
* @param project
|
* toolchain the build config will use
|
||||||
* project for the config
|
* @param launchMode
|
||||||
* @param properties
|
* launch mode the buld config will build for
|
||||||
* properties for the toolchain to be selected
|
* @return new build configuration
|
||||||
* @param launchMode
|
* @throws CoreException
|
||||||
* launch mode the buld config will build for
|
* @since 6.1
|
||||||
* @return new build configuration
|
*/
|
||||||
* @throws CoreException
|
ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
|
||||||
* @since 6.2
|
IProgressMonitor monitor) throws CoreException;
|
||||||
*/
|
|
||||||
ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
|
/**
|
||||||
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.
|
||||||
/**
|
*
|
||||||
* Called by providers to add new build configurations as they are created.
|
* @deprecated clients really need to pick which toolchain they want a build
|
||||||
*
|
* config for. This method pretty much picks one at random.
|
||||||
* @param buildConfig
|
* @param project
|
||||||
* platform build configuration
|
* project for the config
|
||||||
* @param cConfig
|
* @param properties
|
||||||
* CDT build configuration
|
* properties for the toolchain to be selected
|
||||||
*/
|
* @param launchMode
|
||||||
void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
|
* launch mode the buld config will build for
|
||||||
|
* @return new build configuration
|
||||||
/**
|
* @throws CoreException
|
||||||
* Return the CDT build configuration associated with the given Platform
|
* @since 6.2
|
||||||
* build configuration.
|
*/
|
||||||
*
|
@Deprecated
|
||||||
* @param buildConfig
|
ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
|
||||||
* @return the matching CDT build configuration
|
String launchMode, IProgressMonitor monitor) throws CoreException;
|
||||||
*/
|
|
||||||
ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
|
/**
|
||||||
|
* Called by providers to add new build configurations as they are created.
|
||||||
/**
|
*
|
||||||
* Does this build system support this project. This is determined by
|
* @param buildConfig
|
||||||
* searching the build configuration providers looking to see if any of them
|
* platform build configuration
|
||||||
* support this project.
|
* @param cConfig
|
||||||
*
|
* CDT build configuration
|
||||||
* @param project
|
*/
|
||||||
* @return is this project supported by this build system
|
void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
|
||||||
* @throws CoreException
|
|
||||||
* @since 6.1
|
/**
|
||||||
*/
|
* Return the CDT build configuration associated with the given Platform
|
||||||
boolean supports(IProject project) throws CoreException;
|
* 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.build;
|
package org.eclipse.cdt.core.build;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -53,4 +55,15 @@ public interface ICBuildConfigurationProvider {
|
||||||
return null;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public interface IToolChainManager {
|
||||||
/**
|
/**
|
||||||
* Return the toolchain from the given provider with the given id and version.
|
* Return the toolchain from the given provider with the given id and version.
|
||||||
*
|
*
|
||||||
|
* @deprecated Version is now irrelevant. id's are unique.
|
||||||
* @param providerId
|
* @param providerId
|
||||||
* id of provider
|
* id of provider
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -44,7 +45,23 @@ public interface IToolChainManager {
|
||||||
* @return the toolchain
|
* @return the toolchain
|
||||||
* @throws CoreException
|
* @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
|
* Return the toolchains provided by the given provider
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
@ -141,6 +142,13 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project,
|
||||||
|
String configName) throws CoreException {
|
||||||
|
String name = provider.getId() + '/' + configName;
|
||||||
|
return project.hasBuildConfig(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider,
|
public IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider,
|
||||||
IProject project, String configName, IProgressMonitor monitor) throws CoreException {
|
IProject project, String configName, IProgressMonitor monitor) throws CoreException {
|
||||||
|
@ -196,7 +204,15 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider != null) {
|
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) {
|
if (config != null) {
|
||||||
configs.put(buildConfig, config);
|
configs.put(buildConfig, config);
|
||||||
// Also make sure we reset the binary parser cache
|
// Also make sure we reset the binary parser cache
|
||||||
|
@ -224,8 +240,19 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
|
||||||
@Override
|
@Override
|
||||||
public ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain,
|
public ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain,
|
||||||
String launchMode, IProgressMonitor monitor) throws CoreException {
|
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);
|
ICBuildConfigurationProvider provider = getProvider(project);
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
|
// The provider will call us back to add in the new one
|
||||||
return provider.createBuildConfiguration(project, toolChain, launchMode, monitor);
|
return provider.createBuildConfiguration(project, toolChain, launchMode, monitor);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class Messages extends NLS {
|
public class Messages extends NLS {
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.Messages"; //$NON-NLS-1$
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.Messages"; //$NON-NLS-1$
|
||||||
public static String CBuildConfigurationtoolchainMissing;
|
public static String CBuildConfiguration_ToolchainMissing;
|
||||||
public static String CBuilder_ExceptionWhileBuilding;
|
public static String CBuilder_ExceptionWhileBuilding;
|
||||||
public static String CBuilder_ExceptionWhileBuilding2;
|
public static String CBuilder_ExceptionWhileBuilding2;
|
||||||
public static String CBuilder_NotConfiguredCorrectly;
|
public static String CBuilder_NotConfiguredCorrectly;
|
||||||
|
|
|
@ -68,7 +68,6 @@ public class ToolChainManager implements IToolChainManager {
|
||||||
List<String> id = new ArrayList<>(3);
|
List<String> id = new ArrayList<>(3);
|
||||||
id.add(toolChain.getProvider().getId());
|
id.add(toolChain.getProvider().getId());
|
||||||
id.add(toolChain.getId());
|
id.add(toolChain.getId());
|
||||||
id.add(toolChain.getVersion());
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,12 +100,11 @@ public class ToolChainManager implements IToolChainManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IToolChain getToolChain(String providerId, String id, String version) throws CoreException {
|
public IToolChain getToolChain(String providerId, String id) throws CoreException {
|
||||||
init();
|
init();
|
||||||
List<String> tid = new ArrayList<>(3);
|
List<String> tid = new ArrayList<>(3);
|
||||||
tid.add(providerId);
|
tid.add(providerId);
|
||||||
tid.add(id);
|
tid.add(id);
|
||||||
tid.add(version);
|
|
||||||
|
|
||||||
IToolChain toolChain = toolChains.get(tid);
|
IToolChain toolChain = toolChains.get(tid);
|
||||||
if (toolChain != null) {
|
if (toolChain != null) {
|
||||||
|
@ -116,7 +114,7 @@ public class ToolChainManager implements IToolChainManager {
|
||||||
// Try the provider
|
// Try the provider
|
||||||
IToolChainProvider realProvider = providers.get(providerId);
|
IToolChainProvider realProvider = providers.get(providerId);
|
||||||
if (realProvider != null) {
|
if (realProvider != null) {
|
||||||
toolChain = realProvider.getToolChain(id, version);
|
toolChain = realProvider.getToolChain(id);
|
||||||
if (toolChain != null) {
|
if (toolChain != null) {
|
||||||
toolChains.put(getId(toolChain), toolChain);
|
toolChains.put(getId(toolChain), toolChain);
|
||||||
return toolChain;
|
return toolChain;
|
||||||
|
|
|
@ -10,3 +10,4 @@ CBuilder_ExceptionWhileBuilding2=Exception while building
|
||||||
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
|
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
|
||||||
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
|
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
|
||||||
StandardBuildConfiguration_0=Building in: %s\n
|
StandardBuildConfiguration_0=Building in: %s\n
|
||||||
|
CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
|
||||||
|
|
|
@ -446,18 +446,22 @@ public class EnvironmentVariableManager implements IEnvironmentVariableManager {
|
||||||
@Override
|
@Override
|
||||||
public void setEnvironment(Map<String, String> env, IBuildConfiguration config, boolean resolveMacros) {
|
public void setEnvironment(Map<String, String> env, IBuildConfiguration config, boolean resolveMacros) {
|
||||||
for (IEnvironmentVariable var : getVariables(config, 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()) {
|
switch (var.getOperation()) {
|
||||||
case IEnvironmentVariable.ENVVAR_REPLACE:
|
case IEnvironmentVariable.ENVVAR_REPLACE:
|
||||||
env.put(var.getName(), var.getValue());
|
env.put(name, var.getValue());
|
||||||
break;
|
break;
|
||||||
case IEnvironmentVariable.ENVVAR_APPEND:
|
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;
|
break;
|
||||||
case IEnvironmentVariable.ENVVAR_PREPEND:
|
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;
|
break;
|
||||||
case IEnvironmentVariable.ENVVAR_REMOVE:
|
case IEnvironmentVariable.ENVVAR_REMOVE:
|
||||||
env.remove(var.getName());
|
env.remove(name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.core.build.IToolChain;
|
||||||
import org.eclipse.cdt.core.build.IToolChainManager;
|
import org.eclipse.cdt.core.build.IToolChainManager;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
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.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -86,7 +87,7 @@ public class CoreBuildLaunchBarTracker implements ILaunchBarListener {
|
||||||
|
|
||||||
// Pick build config based on toolchain for target
|
// Pick build config based on toolchain for target
|
||||||
// Since this may create a new config, need to run it in a Job
|
// 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
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
|
@ -102,14 +103,6 @@ public class CoreBuildLaunchBarTracker implements ILaunchBarListener {
|
||||||
IProjectDescription desc = finalProject.getDescription();
|
IProjectDescription desc = finalProject.getDescription();
|
||||||
desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
|
desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
|
||||||
finalProject.setDescription(desc, monitor);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,107 +1,138 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2016 QNX Software Systems and others.
|
* Copyright (c) 2016 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.core.launch;
|
package org.eclipse.cdt.debug.core.launch;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||||
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
||||||
import org.eclipse.cdt.core.build.IToolChain;
|
import org.eclipse.cdt.core.build.IToolChain;
|
||||||
import org.eclipse.cdt.core.build.IToolChainManager;
|
import org.eclipse.cdt.core.build.IToolChainManager;
|
||||||
import org.eclipse.cdt.core.model.IBinary;
|
import org.eclipse.cdt.core.model.IBinary;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
|
import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||||
import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
|
import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common launch delegate code for core build launches.
|
* Common launch delegate code for core build launches.
|
||||||
*
|
*
|
||||||
* @since 8.1
|
* @since 8.1
|
||||||
*/
|
*/
|
||||||
public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate {
|
public abstract class CoreBuildLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate {
|
||||||
|
|
||||||
protected ICBuildConfigurationManager configManager = CDebugCorePlugin
|
protected ICBuildConfigurationManager configManager = CDebugCorePlugin
|
||||||
.getService(ICBuildConfigurationManager.class);
|
.getService(ICBuildConfigurationManager.class);
|
||||||
protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
|
protected IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
|
||||||
|
|
||||||
public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
|
public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
|
||||||
// TODO - make sure this is really the correct project
|
// TODO - make sure this is really the correct project
|
||||||
return configuration.getMappedResources()[0].getProject();
|
return configuration.getMappedResources()[0].getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICBuildConfiguration getBuildConfiguration(IProject project, String mode, ILaunchTarget target,
|
/**
|
||||||
IProgressMonitor monitor) throws CoreException {
|
* @deprecated Use the version that takes the launch config so we can see if it
|
||||||
// Pick build config based on toolchain for target
|
* know what toolchain to use.
|
||||||
Map<String, String> properties = new HashMap<>();
|
*/
|
||||||
properties.putAll(target.getAttributes());
|
@Deprecated
|
||||||
Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
|
protected ICBuildConfiguration getBuildConfiguration(IProject project, String mode, ILaunchTarget target,
|
||||||
if (!tcs.isEmpty()) {
|
IProgressMonitor monitor) throws CoreException {
|
||||||
IToolChain toolChain = tcs.iterator().next();
|
// Pick build config based on toolchain for target
|
||||||
return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
|
Map<String, String> properties = new HashMap<>();
|
||||||
} else {
|
properties.putAll(target.getAttributes());
|
||||||
return null;
|
Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
|
||||||
}
|
if (!tcs.isEmpty()) {
|
||||||
}
|
IToolChain toolChain = tcs.iterator().next();
|
||||||
|
return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
|
||||||
protected IBinary getBinary(ICBuildConfiguration buildConfig) throws CoreException {
|
} else {
|
||||||
IBinary[] binaries = buildConfig.getBuildOutput();
|
return null;
|
||||||
IBinary exeFile = null;
|
}
|
||||||
for (IBinary binary : binaries) {
|
}
|
||||||
if (binary.isExecutable()) {
|
|
||||||
exeFile = binary;
|
/**
|
||||||
break;
|
* @since 8.3
|
||||||
}
|
*/
|
||||||
}
|
protected ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration, String mode,
|
||||||
if (exeFile == null) {
|
ILaunchTarget target, IProgressMonitor monitor) throws CoreException {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, InternalDebugCoreMessages.CoreBuildLaunchConfigDelegate_noBinaries));
|
IProject project = getProject(configuration);
|
||||||
}
|
String toolchainId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_ID, (String) null);
|
||||||
return exeFile;
|
if (toolchainId != null) {
|
||||||
}
|
String providerId = configuration.getAttribute(ICBuildConfiguration.TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
|
||||||
|
IToolChain toolchain = toolChainManager.getToolChain(providerId, toolchainId);
|
||||||
@Override
|
if (toolchain != null) {
|
||||||
protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
|
return configManager.getBuildConfiguration(project, toolchain, mode, monitor);
|
||||||
// 1. Extract project from configuration
|
}
|
||||||
// TODO dependencies too.
|
}
|
||||||
IProject project = getProject(configuration);
|
|
||||||
return new IProject[] { project };
|
// Pick the first one that matches
|
||||||
}
|
Map<String, String> properties = new HashMap<>();
|
||||||
|
properties.putAll(target.getAttributes());
|
||||||
public static String getBuildAttributeName(String mode) {
|
Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
|
||||||
return "COREBUILD_" + mode; //$NON-NLS-1$
|
if (!tcs.isEmpty()) {
|
||||||
}
|
IToolChain toolChain = tcs.iterator().next();
|
||||||
|
return configManager.getBuildConfiguration(project, toolChain, mode, monitor);
|
||||||
@Override
|
}
|
||||||
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
|
|
||||||
IProgressMonitor monitor) throws CoreException {
|
return null;
|
||||||
IProject project = getProject(configuration);
|
}
|
||||||
ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
|
protected IBinary getBinary(ICBuildConfiguration buildConfig) throws CoreException {
|
||||||
if (buildConfig != null) {
|
IBinary[] binaries = buildConfig.getBuildOutput();
|
||||||
IProjectDescription desc = project.getDescription();
|
IBinary exeFile = null;
|
||||||
desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
|
for (IBinary binary : binaries) {
|
||||||
project.setDescription(desc, monitor);
|
if (binary.isExecutable()) {
|
||||||
|
exeFile = binary;
|
||||||
Map<String, String> buildProps = configuration.getAttribute(getBuildAttributeName(mode),
|
break;
|
||||||
buildConfig.getDefaultProperties());
|
}
|
||||||
buildConfig.setProperties(buildProps);
|
}
|
||||||
}
|
if (exeFile == null) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, InternalDebugCoreMessages.CoreBuildLaunchConfigDelegate_noBinaries));
|
||||||
// proceed with the build
|
}
|
||||||
return superBuildForLaunch(configuration, mode, monitor);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.core;
|
package org.eclipse.cdt.debug.internal.core;
|
||||||
|
|
||||||
import org.eclipse.core.internal.variables.VariablesMessages;
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public class InternalDebugCoreMessages extends NLS {
|
public class InternalDebugCoreMessages extends NLS {
|
||||||
|
@ -27,6 +26,7 @@ public class InternalDebugCoreMessages extends NLS {
|
||||||
public static String CDebugAdapter_0;
|
public static String CDebugAdapter_0;
|
||||||
public static String CDebugAdapter_1;
|
public static String CDebugAdapter_1;
|
||||||
public static String CDebugAdapter_Program_file_not_specified;
|
public static String CDebugAdapter_Program_file_not_specified;
|
||||||
|
public static String CoreBuildLaunchBarTracker_Job;
|
||||||
public static String CoreBuildLaunchConfigDelegate_noBinaries;
|
public static String CoreBuildLaunchConfigDelegate_noBinaries;
|
||||||
public static String CoreBuildLocalRunLaunchDelegate_ErrorLaunching;
|
public static String CoreBuildLocalRunLaunchDelegate_ErrorLaunching;
|
||||||
public static String CRegisterManager_0;
|
public static String CRegisterManager_0;
|
||||||
|
@ -39,7 +39,7 @@ public class InternalDebugCoreMessages extends NLS {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Load message values from a bundle file.
|
// Load message values from a bundle file.
|
||||||
NLS.initializeMessages(InternalDebugCoreMessages.class.getName(), VariablesMessages.class);
|
NLS.initializeMessages(InternalDebugCoreMessages.class.getName(), InternalDebugCoreMessages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ DebugConfiguration_0=This debugger no longer supports this operation
|
||||||
CDebugAdapter_0=This debugger does not support debugging external files
|
CDebugAdapter_0=This debugger does not support debugging external files
|
||||||
CDebugAdapter_1=Debugger Process
|
CDebugAdapter_1=Debugger Process
|
||||||
CDebugAdapter_Program_file_not_specified=Program file not specified
|
CDebugAdapter_Program_file_not_specified=Program file not specified
|
||||||
|
CoreBuildLaunchBarTracker_Job=Change Build Configurations
|
||||||
CoreBuildLaunchConfigDelegate_noBinaries=No binaries
|
CoreBuildLaunchConfigDelegate_noBinaries=No binaries
|
||||||
CoreBuildLocalRunLaunchDelegate_ErrorLaunching=Error launching
|
CoreBuildLocalRunLaunchDelegate_ErrorLaunching=Error launching
|
||||||
CRegisterManager_0=Unable to restore register groups - invalid memento.
|
CRegisterManager_0=Unable to restore register groups - invalid memento.
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.model.IBinary;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
||||||
import org.eclipse.cdt.debug.internal.core.InternalDebugCoreMessages;
|
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.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -31,10 +30,8 @@ public class CoreBuildLocalRunLaunchDelegate extends CoreBuildLaunchConfigDelega
|
||||||
@Override
|
@Override
|
||||||
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
|
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
IProject project = getProject(configuration);
|
|
||||||
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
||||||
|
ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
|
||||||
ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
|
|
||||||
IBinary exeFile = getBinary(buildConfig);
|
IBinary exeFile = getBinary(buildConfig);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,132 +1,130 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2016 QNX Software Systems and others.
|
* Copyright (c) 2016 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.launching;
|
package org.eclipse.cdt.dsf.gdb.internal.launching;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||||
import org.eclipse.cdt.core.build.IToolChain;
|
import org.eclipse.cdt.core.build.IToolChain;
|
||||||
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.Messages;
|
import org.eclipse.cdt.dsf.gdb.internal.Messages;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbSourceLookupDirector;
|
import org.eclipse.cdt.dsf.gdb.launching.GdbSourceLookupDirector;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
|
import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
|
||||||
import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
|
|
||||||
|
public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDelegate {
|
||||||
public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDelegate {
|
|
||||||
|
@Override
|
||||||
@Override
|
public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target)
|
||||||
public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target)
|
throws CoreException {
|
||||||
throws CoreException {
|
GdbLaunch launch = new GdbLaunch(configuration, mode, null);
|
||||||
GdbLaunch launch = new GdbLaunch(configuration, mode, null);
|
launch.setLaunchTarget(target);
|
||||||
launch.setLaunchTarget(target);
|
launch.initialize();
|
||||||
launch.initialize();
|
|
||||||
|
GdbSourceLookupDirector locator = new GdbSourceLookupDirector(launch.getSession());
|
||||||
GdbSourceLookupDirector locator = new GdbSourceLookupDirector(launch.getSession());
|
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
|
||||||
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
|
if (memento == null) {
|
||||||
if (memento == null) {
|
locator.initializeDefaults(configuration);
|
||||||
locator.initializeDefaults(configuration);
|
} else {
|
||||||
} else {
|
locator.initializeFromMemento(memento, configuration);
|
||||||
locator.initializeFromMemento(memento, configuration);
|
}
|
||||||
}
|
|
||||||
|
launch.setSourceLocator(locator);
|
||||||
launch.setSourceLocator(locator);
|
return launch;
|
||||||
return launch;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
|
||||||
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
|
throws CoreException {
|
||||||
throws CoreException {
|
GdbLaunch gdbLaunch = (GdbLaunch) launch;
|
||||||
GdbLaunch gdbLaunch = (GdbLaunch) launch;
|
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
||||||
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
|
||||||
IProject project = getProject(configuration);
|
|
||||||
ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
|
Map<String, String> buildEnv = new HashMap<>();
|
||||||
|
buildConfig.setBuildEnvironment(buildEnv);
|
||||||
Map<String, String> buildEnv = new HashMap<>();
|
Properties envProps = new Properties();
|
||||||
buildConfig.setBuildEnvironment(buildEnv);
|
envProps.putAll(buildEnv);
|
||||||
Properties envProps = new Properties();
|
gdbLaunch.setInitialEnvironment(envProps);
|
||||||
envProps.putAll(buildEnv);
|
|
||||||
gdbLaunch.setInitialEnvironment(envProps);
|
IToolChain toolChain = buildConfig.getToolChain();
|
||||||
|
Path gdbPath = toolChain.getCommandPath(Paths.get("gdb")); //$NON-NLS-1$
|
||||||
IToolChain toolChain = buildConfig.getToolChain();
|
gdbLaunch.setGDBPath(gdbPath != null ? gdbPath.toString() : "gdb"); //$NON-NLS-1$
|
||||||
Path gdbPath = toolChain.getCommandPath(Paths.get("gdb")); //$NON-NLS-1$
|
String gdbVersion = gdbLaunch.getGDBVersion();
|
||||||
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());
|
||||||
Path exeFile = Paths.get(getBinary(buildConfig).getLocationURI());
|
|
||||||
gdbLaunch.setProgramPath(exeFile.toString());
|
gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion, configuration));
|
||||||
|
|
||||||
gdbLaunch.setServiceFactory(new GdbDebugServicesFactory(gdbVersion, configuration));
|
Sequence servicesLaunchSequence = new ServicesLaunchSequence(gdbLaunch.getSession(), gdbLaunch, monitor);
|
||||||
|
gdbLaunch.getSession().getExecutor().execute(servicesLaunchSequence);
|
||||||
Sequence servicesLaunchSequence = new ServicesLaunchSequence(gdbLaunch.getSession(), gdbLaunch, monitor);
|
try {
|
||||||
gdbLaunch.getSession().getExecutor().execute(servicesLaunchSequence);
|
servicesLaunchSequence.get();
|
||||||
try {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
servicesLaunchSequence.get();
|
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
}
|
||||||
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureLaunching, e));
|
|
||||||
}
|
gdbLaunch.initializeControl();
|
||||||
|
|
||||||
gdbLaunch.initializeControl();
|
gdbLaunch.addCLIProcess(gdbLaunch.getGDBPath().toOSString() + " (" + gdbVersion + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
gdbLaunch.addCLIProcess(gdbLaunch.getGDBPath().toOSString() + " (" + gdbVersion + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
Query<Object> ready = new Query<Object>() {
|
||||||
|
@Override
|
||||||
Query<Object> ready = new Query<Object>() {
|
protected void execute(final DataRequestMonitor<Object> rm) {
|
||||||
@Override
|
DsfServicesTracker tracker = new DsfServicesTracker(
|
||||||
protected void execute(final DataRequestMonitor<Object> rm) {
|
GdbPlugin.getDefault().getBundle().getBundleContext(), gdbLaunch.getSession().getId());
|
||||||
DsfServicesTracker tracker = new DsfServicesTracker(
|
IGDBControl control = tracker.getService(IGDBControl.class);
|
||||||
GdbPlugin.getDefault().getBundle().getBundleContext(), gdbLaunch.getSession().getId());
|
tracker.dispose();
|
||||||
IGDBControl control = tracker.getService(IGDBControl.class);
|
control.completeInitialization(
|
||||||
tracker.dispose();
|
new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), monitor) {
|
||||||
control.completeInitialization(
|
@Override
|
||||||
new RequestMonitorWithProgress(ImmediateExecutor.getInstance(), monitor) {
|
protected void handleCompleted() {
|
||||||
@Override
|
if (isCanceled()) {
|
||||||
protected void handleCompleted() {
|
rm.cancel();
|
||||||
if (isCanceled()) {
|
} else {
|
||||||
rm.cancel();
|
rm.setStatus(getStatus());
|
||||||
} else {
|
}
|
||||||
rm.setStatus(getStatus());
|
rm.done();
|
||||||
}
|
}
|
||||||
rm.done();
|
});
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
|
||||||
};
|
// Start it up
|
||||||
|
gdbLaunch.getSession().getExecutor().execute(ready);
|
||||||
// Start it up
|
try {
|
||||||
gdbLaunch.getSession().getExecutor().execute(ready);
|
ready.get();
|
||||||
try {
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
ready.get();
|
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
|
||||||
} catch (ExecutionException | InterruptedException e) {
|
}
|
||||||
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, Messages.CoreBuildLocalDebugLaunchDelegate_FailureStart, e));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,18 +2,22 @@ eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
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=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=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=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.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=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.annotationSuperInterface=error
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
|
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
|
||||||
org.eclipse.jdt.core.compiler.problem.deadCode=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.deprecationInDeprecatedCode=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
|
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.noImplicitStringConversion=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
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.nullAnnotationInferenceConflict=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=error
|
org.eclipse.jdt.core.compiler.problem.nullReference=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
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.possibleAccidentalBooleanAssignment=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
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.suppressWarnings=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
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.typeParameterHiding=error
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
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.unnecessaryElse=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=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.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
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.unusedImport=error
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.launch; singleton:=true
|
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-Activator: org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -46,6 +46,9 @@ public class LaunchMessages extends NLS {
|
||||||
public static String LocalAttachLaunchDelegate_Platform_cannot_list_processes;
|
public static String LocalAttachLaunchDelegate_Platform_cannot_list_processes;
|
||||||
public static String LocalAttachLaunchDelegate_Select_Process_to_attach_debugger_to;
|
public static String LocalAttachLaunchDelegate_Select_Process_to_attach_debugger_to;
|
||||||
public static String LocalAttachLaunchDelegate_CDT_Launch_Error;
|
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_Build;
|
||||||
public static String CoreBuildTab_NoOptions;
|
public static String CoreBuildTab_NoOptions;
|
||||||
public static String CoreFileLaunchDelegate_Launching_postmortem_debugger;
|
public static String CoreFileLaunchDelegate_Launching_postmortem_debugger;
|
||||||
|
|
|
@ -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_Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
|
||||||
LocalAttachLaunchDelegate_CDT_Launch_Error=CDT Launch Error
|
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_Build=Build Settings
|
||||||
CoreBuildTab_NoOptions=No build options required.
|
CoreBuildTab_NoOptions=No build options required.
|
||||||
CoreFileLaunchDelegate_Launching_postmortem_debugger=Launching postmortem debugger
|
CoreFileLaunchDelegate_Launching_postmortem_debugger=Launching postmortem debugger
|
||||||
|
|
|
@ -7,20 +7,36 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launch.ui.corebuild;
|
package org.eclipse.cdt.launch.ui.corebuild;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||||
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
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.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
||||||
|
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||||
import org.eclipse.launchbar.ui.ILaunchBarLaunchConfigDialog;
|
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.
|
* Common utilities for Core Build launch configuration tabs.
|
||||||
|
@ -29,6 +45,163 @@ import org.eclipse.launchbar.ui.ILaunchBarLaunchConfigDialog;
|
||||||
*/
|
*/
|
||||||
public abstract class CommonBuildTab extends AbstractLaunchConfigurationTab {
|
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() {
|
public ILaunchBarLaunchConfigDialog getLaunchBarLaunchConfigDialog() {
|
||||||
ILaunchConfigurationDialog dialog = getLaunchConfigurationDialog();
|
ILaunchConfigurationDialog dialog = getLaunchConfigurationDialog();
|
||||||
return dialog instanceof ILaunchBarLaunchConfigDialog ? (ILaunchBarLaunchConfigDialog) dialog : null;
|
return dialog instanceof ILaunchBarLaunchConfigDialog ? (ILaunchBarLaunchConfigDialog) dialog : null;
|
||||||
|
@ -39,17 +212,19 @@ public abstract class CommonBuildTab extends AbstractLaunchConfigurationTab {
|
||||||
return dialog != null ? dialog.getLaunchTarget() : null;
|
return dialog != null ? dialog.getLaunchTarget() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Just use getBuildConfiguration()
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration) throws CoreException {
|
public ICBuildConfiguration getBuildConfiguration(ILaunchConfiguration configuration) throws CoreException {
|
||||||
String mode = getLaunchConfigurationDialog().getMode();
|
return buildConfig;
|
||||||
ILaunchTarget target = getLaunchTarget();
|
}
|
||||||
if (target == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICBuildConfigurationManager bcManager = LaunchUIPlugin.getService(ICBuildConfigurationManager.class);
|
/**
|
||||||
IProject project = CoreBuildLaunchConfigDelegate.getProject(configuration);
|
* @since 9.2
|
||||||
Map<String, String> properties = target.getAttributes();
|
*/
|
||||||
return bcManager.getBuildConfiguration(project, properties, mode, new NullProgressMonitor());
|
public ICBuildConfiguration getBuildConfiguration() {
|
||||||
|
return buildConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getQmakeConfig() {
|
public String[] getQmakeConfig() {
|
||||||
String qmakeArgs = getProperties().get(QMAKE_ARGS);
|
String qmakeArgs = getProperty(QMAKE_ARGS);
|
||||||
if (qmakeArgs != null) {
|
if (qmakeArgs != null) {
|
||||||
return qmakeArgs.split(" "); //$NON-NLS-1$
|
return qmakeArgs.split(" "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getMakeCommand() {
|
public String[] getMakeCommand() {
|
||||||
String buildCommandStr = getProperties().get(BUILD_COMMAND);
|
String buildCommandStr = getProperty(BUILD_COMMAND);
|
||||||
if (buildCommandStr != null) {
|
if (buildCommandStr != null) {
|
||||||
String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$
|
String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$
|
||||||
Path command = findCommand(buildCommand[0]);
|
Path command = findCommand(buildCommand[0]);
|
||||||
|
|
|
@ -118,6 +118,10 @@ public class Activator extends AbstractUIPlugin {
|
||||||
getDefault().getLog().log(new Status(code, PLUGIN_ID, msg, e));
|
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) {
|
public static <T> T getService(Class<T> service) {
|
||||||
BundleContext context = plugin.getBundle().getBundleContext();
|
BundleContext context = plugin.getBundle().getBundleContext();
|
||||||
ServiceReference<T> ref = context.getServiceReference(service);
|
ServiceReference<T> ref = context.getServiceReference(service);
|
||||||
|
|
|
@ -8,12 +8,10 @@
|
||||||
package org.eclipse.cdt.internal.qt.ui.launch;
|
package org.eclipse.cdt.internal.qt.ui.launch;
|
||||||
|
|
||||||
import java.util.Collection;
|
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.IToolChain;
|
||||||
import org.eclipse.cdt.core.build.IToolChainManager;
|
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.core.build.QtBuildConfiguration;
|
||||||
import org.eclipse.cdt.internal.qt.ui.Activator;
|
import org.eclipse.cdt.internal.qt.ui.Activator;
|
||||||
import org.eclipse.cdt.internal.qt.ui.Messages;
|
import org.eclipse.cdt.internal.qt.ui.Messages;
|
||||||
|
@ -34,9 +32,9 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
public class QtBuildTab extends CommonBuildTab {
|
public class QtBuildTab extends CommonBuildTab {
|
||||||
|
|
||||||
Combo qmakeCombo;
|
private Combo qmakeCombo;
|
||||||
Text qmakeArgsText;
|
private Text qmakeArgsText;
|
||||||
Text buildCmdText;
|
private Text buildCmdText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
@ -63,39 +61,16 @@ public class QtBuildTab extends CommonBuildTab {
|
||||||
buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
@Override
|
||||||
public void initializeFrom(ILaunchConfiguration configuration) {
|
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||||
try {
|
try {
|
||||||
Map<String, String> properties = getProperties(configuration);
|
ICBuildConfiguration buildConfig = getBuildConfiguration();
|
||||||
|
|
||||||
// qmake command
|
// qmake command
|
||||||
IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
|
IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
|
||||||
IQtInstallManager qtManager = Activator.getService(IQtInstallManager.class);
|
IQtInstallManager qtManager = Activator.getService(IQtInstallManager.class);
|
||||||
ILaunchTarget target = getLaunchTarget();
|
ILaunchTarget target = getLaunchTarget();
|
||||||
|
|
||||||
String qmakeCmd = properties.get(QtBuildConfiguration.QMAKE_COMMAND);
|
String qmakeCmd = buildConfig.getProperty(QtBuildConfiguration.QMAKE_COMMAND);
|
||||||
qmakeCombo.removeAll();
|
qmakeCombo.removeAll();
|
||||||
Collection<IToolChain> toolChains = tcManager.getToolChainsMatching(target.getAttributes());
|
Collection<IToolChain> toolChains = tcManager.getToolChainsMatching(target.getAttributes());
|
||||||
int select = -1;
|
int select = -1;
|
||||||
|
@ -116,13 +91,13 @@ public class QtBuildTab extends CommonBuildTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
// qmake args
|
// qmake args
|
||||||
String qmakeArgs = properties.get(QtBuildConfiguration.QMAKE_ARGS);
|
String qmakeArgs = buildConfig.getProperty(QtBuildConfiguration.QMAKE_ARGS);
|
||||||
if (qmakeArgs != null) {
|
if (qmakeArgs != null) {
|
||||||
qmakeArgsText.setText(qmakeArgs);
|
qmakeArgsText.setText(qmakeArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build command
|
// build command
|
||||||
String buildCommand = properties.get(QtBuildConfiguration.BUILD_COMMAND);
|
String buildCommand = buildConfig.getProperty(QtBuildConfiguration.BUILD_COMMAND);
|
||||||
if (buildCommand != null) {
|
if (buildCommand != null) {
|
||||||
buildCmdText.setText(buildCommand);
|
buildCmdText.setText(buildCommand);
|
||||||
}
|
}
|
||||||
|
@ -132,17 +107,29 @@ public class QtBuildTab extends CommonBuildTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
|
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
|
||||||
try {
|
ICBuildConfiguration buildConfig = getBuildConfiguration();
|
||||||
Map<String, String> properties = new HashMap<>(getProperties(configuration));
|
buildConfig.removeProperty(QtBuildConfiguration.QMAKE_ARGS);
|
||||||
properties.put(QtBuildConfiguration.QMAKE_COMMAND, qmakeCombo.getItem(qmakeCombo.getSelectionIndex()));
|
buildConfig.removeProperty(QtBuildConfiguration.BUILD_COMMAND);
|
||||||
properties.put(QtBuildConfiguration.QMAKE_ARGS, qmakeArgsText.getText().trim());
|
}
|
||||||
properties.put(QtBuildConfiguration.BUILD_COMMAND, buildCmdText.getText().trim());
|
|
||||||
|
|
||||||
String mode = getLaunchBarLaunchConfigDialog().getMode();
|
@Override
|
||||||
configuration.setAttribute(CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode), properties);
|
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
|
||||||
} catch (CoreException e) {
|
ICBuildConfiguration buildConfig = getBuildConfiguration();
|
||||||
Activator.log(e);
|
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 buildCmd = buildCmdText.getText().trim();
|
||||||
|
if (buildCmd.isEmpty()) {
|
||||||
|
buildConfig.removeProperty(QtBuildConfiguration.BUILD_COMMAND);
|
||||||
|
} else {
|
||||||
|
buildConfig.setProperty(QtBuildConfiguration.BUILD_COMMAND, buildCmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue