Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters46
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java62
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java66
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java241
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java13
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java19
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java29
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java6
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties1
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java12
12 files changed, 361 insertions, 145 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
index f95a509891f..3f75336083e 100644
--- a/core/org.eclipse.cdt.core/.settings/.api_filters
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -1,5 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2">
+ <resource path="src/org/eclipse/cdt/core/build/ICBuildConfiguration.java" type="org.eclipse.cdt.core.build.ICBuildConfiguration">
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="TOOLCHAIN_ID"/>
+ </message_arguments>
+ </filter>
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="TOOLCHAIN_TYPE"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="getLaunchMode()"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="getProperty(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="removeProperty(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
+ <message_argument value="setProperty(String, String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java" type="org.eclipse.cdt.core.build.ICBuildConfigurationProvider">
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.ICBuildConfigurationProvider"/>
+ <message_argument value="getSupportedToolchains(Collection&lt;IToolChain&gt;)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/cdt/core/build/IToolChainProvider.java" type="org.eclipse.cdt.core.build.IToolChainProvider">
<filter comment="This interface is still pretty new. Assuming low risk." id="404000815">
<message_arguments>
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index 5b677382683..0f1ac134595 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -108,9 +108,11 @@ import com.ibm.icu.text.MessageFormat;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CCorePlugin extends Plugin {
+ // IStatus codes for our plug-in
public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
+
/**
* Status code for core exception that is thrown if a pdom grew larger than
* the supported limit.
@@ -119,6 +121,13 @@ public class CCorePlugin extends Plugin {
*/
public static final int STATUS_PDOM_TOO_LARGE = 4;
+ /**
+ * Toolchain not found when inflating a build configuration.
+ *
+ * @since 6.4
+ */
+ public static final int STATUS_TOOLCHAIN_NOT_FOUND = 5;
+
public static final String PLUGIN_ID = "org.eclipse.cdt.core"; //$NON-NLS-1$
public static final String BUILDER_MODEL_ID = PLUGIN_ID + ".CBuildModel"; //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index e2adadf98c2..d90e35e9ef6 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -24,7 +24,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -96,9 +95,6 @@ import com.google.gson.JsonParseException;
public abstract class CBuildConfiguration extends PlatformObject
implements ICBuildConfiguration, IMarkerGenerator, IConsoleParser {
- private static final String TOOLCHAIN_TYPE = "cdt.toolChain.type"; //$NON-NLS-1$
- private static final String TOOLCHAIN_ID = "cdt.toolChain.id"; //$NON-NLS-1$
- private static final String TOOLCHAIN_VERSION = "cdt.toolChain.version"; //$NON-NLS-1$
private static final String LAUNCH_MODE = "cdt.launchMode"; //$NON-NLS-1$
private static final List<String> DEFAULT_COMMAND = new ArrayList<>(0);
@@ -111,8 +107,6 @@ public abstract class CBuildConfiguration extends PlatformObject
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
private ScannerInfoCache scannerInfoCache;
- private Map<String, String> properties;
-
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
this.config = config;
this.name = name;
@@ -120,9 +114,8 @@ public abstract class CBuildConfiguration extends PlatformObject
Preferences settings = getSettings();
String typeId = settings.get(TOOLCHAIN_TYPE, ""); //$NON-NLS-1$
String id = settings.get(TOOLCHAIN_ID, ""); //$NON-NLS-1$
- String version = settings.get(TOOLCHAIN_VERSION, ""); //$NON-NLS-1$
IToolChainManager toolChainManager = CCorePlugin.getService(IToolChainManager.class);
- IToolChain tc = toolChainManager.getToolChain(typeId, id, version);
+ IToolChain tc = toolChainManager.getToolChain(typeId, id);
if (tc == null) {
// check for other versions
@@ -132,7 +125,9 @@ public abstract class CBuildConfiguration extends PlatformObject
tc = tcs.iterator().next();
} else {
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
- String.format(Messages.CBuildConfigurationtoolchainMissing, config.getName())));
+ CCorePlugin.STATUS_TOOLCHAIN_NOT_FOUND,
+ String.format(Messages.CBuildConfiguration_ToolchainMissing, config.getName()),
+ null));
}
}
toolChain = tc;
@@ -157,7 +152,6 @@ public abstract class CBuildConfiguration extends PlatformObject
Preferences settings = getSettings();
settings.put(TOOLCHAIN_TYPE, toolChain.getProvider().getId());
settings.put(TOOLCHAIN_ID, toolChain.getId());
- settings.put(TOOLCHAIN_VERSION, toolChain.getVersion());
try {
settings.flush();
} catch (BackingStoreException e) {
@@ -181,6 +175,7 @@ public abstract class CBuildConfiguration extends PlatformObject
/**
* @since 6.2
*/
+ @Override
public String getLaunchMode() {
return launchMode;
}
@@ -756,12 +751,11 @@ public abstract class CBuildConfiguration extends PlatformObject
*/
@Override
public boolean setProperties(Map<String, String> properties) {
- if (this.properties == null || !this.properties.equals(properties)) {
- this.properties = properties;
- return true;
- } else {
- return false;
+ Preferences settings = getSettings();
+ for (Entry<String, String> entry : properties.entrySet()) {
+ settings.put(entry.getKey(), entry.getValue());
}
+ return true;
}
/**
@@ -769,10 +763,42 @@ public abstract class CBuildConfiguration extends PlatformObject
*/
@Override
public Map<String, String> getProperties() {
- if (properties == null) {
- properties = getDefaultProperties();
+ Map<String, String> properties = new HashMap<>();
+ Preferences settings = getSettings();
+ try {
+ for (String key : settings.childrenNames()) {
+ String value = settings.get(key, null);
+ if (value != null) {
+ properties.put(key, value);
+ }
+ }
+ } catch (BackingStoreException e) {
+ CCorePlugin.log(e);
}
- return Collections.unmodifiableMap(properties);
+ return properties;
+ }
+
+ /**
+ * @since 6.4
+ */
+ @Override
+ public String getProperty(String name) {
+ return getSettings().get(name, null);
+ }
+
+ /**
+ * @since 6.4
+ */
+ @Override
+ public void setProperty(String name, String value) {
+ Preferences settings = getSettings();
+ settings.put(name, value);
+ }
+
+ @Override
+ public void removeProperty(String name) {
+ Preferences settings = getSettings();
+ settings.remove(name);
}
/**
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
index 0794d4f054f..b53a01e434d 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java
@@ -34,11 +34,21 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
* CDT doesn't like that the Platform default config name is an empty string.
* It needs a real name for the name of the build directory, for example.
*/
- public static String DEFAULT_NAME = "default"; //$NON-NLS-1$
+ public static final String DEFAULT_NAME = "default"; //$NON-NLS-1$
/**
- * Returns the resources build configuration that this CDT build
- * configuration is associated with.
+ * @since 6.4
+ */
+ public static final String TOOLCHAIN_TYPE = "cdt.toolChain.type"; //$NON-NLS-1$
+
+ /**
+ * @since 6.4
+ */
+ public static final String TOOLCHAIN_ID = "cdt.toolChain.id"; //$NON-NLS-1$
+
+ /**
+ * Returns the resources build configuration that this CDT build configuration
+ * is associated with.
*
* @return resources build configuration
*/
@@ -52,6 +62,15 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
IToolChain getToolChain() throws CoreException;
/**
+ * Return the launch mode associated with this build configuration.
+ *
+ * @since 6.4
+ */
+ default String getLaunchMode() {
+ return null;
+ }
+
+ /**
* Ids for the Binary Parsers to use when checking whether a file is a
* binary that can be launched.
*
@@ -73,7 +92,7 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
/**
* Return all of the build environment variables for this configuration.
*
- * @return
+ * @return environment variables
* @throws CoreException
*/
IEnvironmentVariable[] getVariables() throws CoreException;
@@ -161,6 +180,45 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
}
/**
+ * Set a property to the given value.
+ *
+ * @param name
+ * the name of the property
+ * @param the
+ * new value for the property
+ * @since 6.4
+ */
+ default void setProperty(String name, String value) {
+ Map<String, String> properties = new HashMap<>(getProperties());
+ properties.put(name, value);
+ setProperties(properties);
+ }
+
+ /**
+ * Remove the named property.
+ *
+ * @param name
+ * name of the property
+ * @since 6.4
+ */
+ default void removeProperty(String name) {
+ Map<String, String> properties = new HashMap<>(getProperties());
+ properties.remove(name);
+ setProperties(properties);
+ }
+
+ /**
+ * Return the named property.
+ *
+ * @param name
+ * the name of the property
+ * @since 6.4
+ */
+ default String getProperty(String name) {
+ return getProperties().get(name);
+ }
+
+ /**
* Returns whether this build configuration supports the given build
* properties.
*
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
index 91efa47a7e5..8a20f1412d8 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java
@@ -1,112 +1,129 @@
-/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.core.build;
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * The OSGi service that manages the mapping from platform build configuration
- * to CDT build configuration.
- *
- * @since 6.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface ICBuildConfigurationManager {
-
- /**
- * Return the build configuration provider with the given id.
- *
- * @param id
- * @return build configuration provider
- */
- ICBuildConfigurationProvider getProvider(String id);
-
- /**
- * Create a new build configuration to be owned by a provider.
- *
- * @param provider
- * @param project
- * @param configName
- * @param monitor
- * @return new build configuration
- * @throws CoreException
- */
- IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
- String configName, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Create a new build configuration for a given project using a given
- * toolchain and builds for a given launch mode.
- *
- * @param project
- * project for the config
- * @param toolChain
- * toolchain the build config will use
- * @param launchMode
- * launch mode the buld config will build for
- * @return new build configuration
- * @throws CoreException
- * @since 6.1
- */
- ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
- IProgressMonitor monitor) throws CoreException;
-
- /**
- * Create a new build configuration for a given project using a toolchain
- * with the given properties and that builds for a given launch mode.
- *
- * @param project
- * project for the config
- * @param properties
- * properties for the toolchain to be selected
- * @param launchMode
- * launch mode the buld config will build for
- * @return new build configuration
- * @throws CoreException
- * @since 6.2
- */
- ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
- String launchMode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Called by providers to add new build configurations as they are created.
- *
- * @param buildConfig
- * platform build configuration
- * @param cConfig
- * CDT build configuration
- */
- void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
-
- /**
- * Return the CDT build configuration associated with the given Platform
- * build configuration.
- *
- * @param buildConfig
- * @return the matching CDT build configuration
- */
- ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
-
- /**
- * Does this build system support this project. This is determined by
- * searching the build configuration providers looking to see if any of them
- * support this project.
- *
- * @param project
- * @return is this project supported by this build system
- * @throws CoreException
- * @since 6.1
- */
- boolean supports(IProject project) throws CoreException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.build;
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * The OSGi service that manages the mapping from platform build configuration
+ * to CDT build configuration.
+ *
+ * @since 6.0
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICBuildConfigurationManager {
+
+ /**
+ * Return the build configuration provider with the given id.
+ *
+ * @param id
+ * @return build configuration provider
+ */
+ ICBuildConfigurationProvider getProvider(String id);
+
+ /**
+ * Return whether the given project has a configuration with the given
+ * configName.
+ *
+ * @param provider
+ * @param project
+ * @param configName
+ * @return true if project has the named config
+ * @throws CoreException
+ * @since 6.4
+ */
+ boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project, String configName)
+ throws CoreException;
+
+ /**
+ * Create a new build configuration to be owned by a provider.
+ *
+ * @param provider
+ * @param project
+ * @param configName
+ * @param monitor
+ * @return new build configuration
+ * @throws CoreException
+ */
+ IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider, IProject project,
+ String configName, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Create a new build configuration for a given project using a given
+ * toolchain and builds for a given launch mode.
+ *
+ * @param project
+ * project for the config
+ * @param toolChain
+ * toolchain the build config will use
+ * @param launchMode
+ * launch mode the buld config will build for
+ * @return new build configuration
+ * @throws CoreException
+ * @since 6.1
+ */
+ ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
+ IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Create a new build configuration for a given project using a toolchain with
+ * the given properties and that builds for a given launch mode.
+ *
+ * @deprecated clients really need to pick which toolchain they want a build
+ * config for. This method pretty much picks one at random.
+ * @param project
+ * project for the config
+ * @param properties
+ * properties for the toolchain to be selected
+ * @param launchMode
+ * launch mode the buld config will build for
+ * @return new build configuration
+ * @throws CoreException
+ * @since 6.2
+ */
+ @Deprecated
+ ICBuildConfiguration getBuildConfiguration(IProject project, Map<String, String> properties,
+ String launchMode, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Called by providers to add new build configurations as they are created.
+ *
+ * @param buildConfig
+ * platform build configuration
+ * @param cConfig
+ * CDT build configuration
+ */
+ void addBuildConfiguration(IBuildConfiguration buildConfig, ICBuildConfiguration cConfig);
+
+ /**
+ * Return the CDT build configuration associated with the given Platform
+ * build configuration.
+ *
+ * @param buildConfig
+ * @return the matching CDT build configuration
+ */
+ ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
+
+ /**
+ * Does this build system support this project. This is determined by
+ * searching the build configuration providers looking to see if any of them
+ * support this project.
+ *
+ * @param project
+ * @return is this project supported by this build system
+ * @throws CoreException
+ * @since 6.1
+ */
+ boolean supports(IProject project) throws CoreException;
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
index 6de0c38e49c..f2a75174641 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationProvider.java
@@ -7,6 +7,8 @@
*******************************************************************************/
package org.eclipse.cdt.core.build;
+import java.util.Collection;
+
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -53,4 +55,15 @@ public interface ICBuildConfigurationProvider {
return null;
}
+ /**
+ * Return a collection of supported toolchains for build configurations of this
+ * type.
+ *
+ * @since 6.4
+ */
+ default Collection<IToolChain> getSupportedToolchains(Collection<IToolChain> toolchains)
+ throws CoreException {
+ return toolchains;
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
index b1b0ec270bd..08d210cf79f 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java
@@ -35,6 +35,7 @@ public interface IToolChainManager {
/**
* Return the toolchain from the given provider with the given id and version.
*
+ * @deprecated Version is now irrelevant. id's are unique.
* @param providerId
* id of provider
* @param id
@@ -44,7 +45,23 @@ public interface IToolChainManager {
* @return the toolchain
* @throws CoreException
*/
- IToolChain getToolChain(String providerId, String id, String version) throws CoreException;
+ @Deprecated
+ default IToolChain getToolChain(String providerId, String id, String version) throws CoreException {
+ return getToolChain(providerId, id);
+ }
+
+ /**
+ * Return the toolChain from the given provider with the given id.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchain
+ * @return the toolchain
+ * @throws CoreException
+ * @since 6.4
+ */
+ IToolChain getToolChain(String providerId, String id) throws CoreException;
/**
* Return the toolchains provided by the given provider
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
index 0c867535003..3f8ead11ed8 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
@@ -40,6 +40,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;
@@ -142,6 +143,13 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
}
@Override
+ public boolean hasConfiguration(ICBuildConfigurationProvider provider, IProject project,
+ String configName) throws CoreException {
+ String name = provider.getId() + '/' + configName;
+ return project.hasBuildConfig(name);
+ }
+
+ @Override
public IBuildConfiguration createBuildConfiguration(ICBuildConfigurationProvider provider,
IProject project, String configName, IProgressMonitor monitor) throws CoreException {
String name = provider.getId() + '/' + configName;
@@ -196,7 +204,15 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
}
if (provider != null) {
- config = provider.getCBuildConfiguration(buildConfig, configName);
+ try {
+ config = provider.getCBuildConfiguration(buildConfig, configName);
+ } catch (CoreException e) {
+ IStatus status = e.getStatus();
+ if (!status.getPlugin().equals(CCorePlugin.PLUGIN_ID)
+ || status.getCode() != CCorePlugin.STATUS_TOOLCHAIN_NOT_FOUND) {
+ throw e;
+ }
+ }
if (config != null) {
configs.put(buildConfig, config);
// Also make sure we reset the binary parser cache
@@ -224,8 +240,19 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
@Override
public ICBuildConfiguration getBuildConfiguration(IProject project, IToolChain toolChain,
String launchMode, IProgressMonitor monitor) throws CoreException {
+ // First see if we have one
+ for (IBuildConfiguration config : project.getBuildConfigs()) {
+ ICBuildConfiguration cconfig = getBuildConfiguration(config);
+ if (cconfig != null && cconfig.getToolChain().equals(toolChain)
+ && launchMode.equals(cconfig.getLaunchMode())) {
+ return cconfig;
+ }
+ }
+
+ // Nope, ask the provider to create one
ICBuildConfigurationProvider provider = getProvider(project);
if (provider != null) {
+ // The provider will call us back to add in the new one
return provider.createBuildConfiguration(project, toolChain, launchMode, monitor);
} else {
return null;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
index e94820da9da..f9cc33c3514 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java
@@ -11,7 +11,7 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.build.Messages"; //$NON-NLS-1$
- public static String CBuildConfigurationtoolchainMissing;
+ public static String CBuildConfiguration_ToolchainMissing;
public static String CBuilder_ExceptionWhileBuilding;
public static String CBuilder_ExceptionWhileBuilding2;
public static String CBuilder_NotConfiguredCorrectly;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
index 754f9194694..1ac9b8b7df7 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java
@@ -68,7 +68,6 @@ public class ToolChainManager implements IToolChainManager {
List<String> id = new ArrayList<>(3);
id.add(toolChain.getProvider().getId());
id.add(toolChain.getId());
- id.add(toolChain.getVersion());
return id;
}
@@ -101,12 +100,11 @@ public class ToolChainManager implements IToolChainManager {
}
@Override
- public IToolChain getToolChain(String providerId, String id, String version) throws CoreException {
+ public IToolChain getToolChain(String providerId, String id) throws CoreException {
init();
List<String> tid = new ArrayList<>(3);
tid.add(providerId);
tid.add(id);
- tid.add(version);
IToolChain toolChain = toolChains.get(tid);
if (toolChain != null) {
@@ -116,7 +114,7 @@ public class ToolChainManager implements IToolChainManager {
// Try the provider
IToolChainProvider realProvider = providers.get(providerId);
if (realProvider != null) {
- toolChain = realProvider.getToolChain(id, version);
+ toolChain = realProvider.getToolChain(id);
if (toolChain != null) {
toolChains.put(getId(toolChain), toolChain);
return toolChain;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
index 318235d700b..8a4bc16a5cc 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
@@ -10,3 +10,4 @@ CBuilder_ExceptionWhileBuilding2=Exception while building
CBuilder_NotConfiguredCorrectly=Build not configured correctly\n
CBuilder_NotConfiguredCorrectly2=Build not configured correctly\n
StandardBuildConfiguration_0=Building in: %s\n
+CBuildConfiguration_ToolchainMissing=Toolchain is missing for build configuration
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
index b00b7fae88a..b272142894e 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
@@ -446,18 +446,22 @@ public class EnvironmentVariableManager implements IEnvironmentVariableManager {
@Override
public void setEnvironment(Map<String, String> env, IBuildConfiguration config, boolean resolveMacros) {
for (IEnvironmentVariable var : getVariables(config, resolveMacros)) {
+ String name = var.getName();
+ if ("PATH".equals(name) && env.containsKey("Path")) { //$NON-NLS-1$ //$NON-NLS-2$
+ name = "Path"; //$NON-NLS-1$
+ }
switch (var.getOperation()) {
case IEnvironmentVariable.ENVVAR_REPLACE:
- env.put(var.getName(), var.getValue());
+ env.put(name, var.getValue());
break;
case IEnvironmentVariable.ENVVAR_APPEND:
- env.put(var.getName(), env.get(var.getName()) + var.getDelimiter() + var.getValue());
+ env.put(name, env.get(name) + var.getDelimiter() + var.getValue());
break;
case IEnvironmentVariable.ENVVAR_PREPEND:
- env.put(var.getName(), var.getValue() + var.getDelimiter() + env.get(var.getName()));
+ env.put(name, var.getValue() + var.getDelimiter() + env.get(name));
break;
case IEnvironmentVariable.ENVVAR_REMOVE:
- env.remove(var.getName());
+ env.remove(name);
break;
}
}

Back to the top