Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java3
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainManager.java94
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java20
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java41
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java3
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.java12
-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/build/ToolChainManager.java44
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties12
12 files changed, 259 insertions, 17 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
new file mode 100644
index 00000000000..f95a509891f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -0,0 +1,28 @@
+<?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/IToolChainProvider.java" type="org.eclipse.cdt.core.build.IToolChainProvider">
+ <filter comment="This interface is still pretty new. Assuming low risk." id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="addToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="getToolChain(String)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Newish interface. Assuming low risk." id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.IToolChainProvider"/>
+ <message_argument value="removeToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="This is a newish interface. Assuming low risk." id="1211105284">
+ <message_arguments>
+ <message_argument value="removeToolChain(IToolChain)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
index a4895bdda0a..9dd1c4b31a0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
@@ -87,13 +87,14 @@ public class SemanticQueries {
* Returns all pure virtual methods of a class. Inherited pure virtual methods
* that have not been implemented are also returned.
*
- * NOTE: The method produces complete results for template instantiations
- * but doesn't take into account base classes and methods dependent on unspecified
+ * NOTE: The method produces complete results for template instantiations but
+ * doesn't take into account base classes and methods dependent on unspecified
* template parameters.
*
- * @param classType the class whose pure virtual methods should be returned
+ * @param classType
+ * the class whose pure virtual methods should be returned
* @return an array containing all pure virtual methods of the class
- * @since 6.3
+ * @since 6.4
*/
public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType) {
FinalOverriderMap finalOverriderMap = CPPInheritance.getFinalOverriderMap(classType);
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 196eb50a4dd..e2adadf98c2 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
@@ -92,7 +92,6 @@ import com.google.gson.JsonParseException;
* settings for subclasses.
*
* @since 6.0
- * @noextend This class is provisional and should be subclassed with caution.
*/
public abstract class CBuildConfiguration extends PlatformObject
implements ICBuildConfiguration, IMarkerGenerator, IConsoleParser {
@@ -138,7 +137,7 @@ public abstract class CBuildConfiguration extends PlatformObject
}
toolChain = tc;
- launchMode = settings.get(LAUNCH_MODE, null); // $NON-NLS-1$
+ launchMode = settings.get(LAUNCH_MODE, "run"); //$NON-NLS-1$
}
protected CBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain) {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
index 47f2eef8f5a..a50744deb02 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuilder.java
@@ -5,6 +5,7 @@ import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
@@ -38,14 +39,14 @@ public class CBuilder extends IncrementalProjectBuilder {
// Get the build configuration
ICBuildConfiguration config = getBuildConfig().getAdapter(ICBuildConfiguration.class);
if (config == null) {
- console.getErrorStream().write("Build not configured correctly\n");
+ console.getErrorStream().write(Messages.CBuilder_NotConfiguredCorrectly);
return null;
}
return config.build(kind, args, console, monitor);
} catch (IOException e) {
throw new CoreException(
- new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Exception while building", e));
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.CBuilder_ExceptionWhileBuilding, e));
}
}
@@ -61,14 +62,14 @@ public class CBuilder extends IncrementalProjectBuilder {
// Get the build configuration
ICBuildConfiguration config = getBuildConfig().getAdapter(ICBuildConfiguration.class);
if (config == null) {
- console.getErrorStream().write("Build not configured correctly\n");
+ console.getErrorStream().write(Messages.CBuilder_NotConfiguredCorrectly2);
return;
}
config.clean(console, monitor);
} catch (IOException e) {
throw new CoreException(
- new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Exception while building", e));
+ new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, Messages.CBuilder_ExceptionWhileBuilding2, e));
}
}
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 c6e19379537..b1b0ec270bd 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
@@ -8,23 +8,65 @@
package org.eclipse.cdt.core.build;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ISafeRunnable;
/**
* The global toolchain manager. Accessed as an OSGi service.
*
+ * @noimplement This interface is not intended to be implemented by clients.
* @since 6.0
*/
public interface IToolChainManager {
+ /**
+ * Return the provider with the given id
+ *
+ * @param providerId
+ * id
+ * @return provider
+ * @throws CoreException
+ */
IToolChainProvider getProvider(String providerId) throws CoreException;
-
+
+ /**
+ * Return the toolchain from the given provider with the given id and version.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchain
+ * @param version
+ * version of toolchain
+ * @return the toolchain
+ * @throws CoreException
+ */
IToolChain getToolChain(String providerId, String id, String version) throws CoreException;
+ /**
+ * Return the toolchains provided by the given provider
+ *
+ * @param providerId
+ * id of provider
+ * @return toolchains the provider provides
+ * @throws CoreException
+ */
Collection<IToolChain> getToolChains(String providerId) throws CoreException;
+ /**
+ * Return all versions of toolchains with the given id provided by the given
+ * provider.
+ *
+ * @param providerId
+ * id of provider
+ * @param id
+ * id of toolchains
+ * @return toolchains with the given id provided by the provider
+ * @throws CoreException
+ */
Collection<IToolChain> getToolChains(String providerId, String id) throws CoreException;
/**
@@ -36,8 +78,58 @@ public interface IToolChainManager {
*/
Collection<IToolChain> getToolChainsMatching(Map<String, String> properties) throws CoreException;
+ /**
+ * Return all of the toolchains.
+ *
+ * @since 6.4
+ */
+ Collection<IToolChain> getAllToolChains() throws CoreException;
+
+ /**
+ * Set the preference order of the toolchains. This controls the order
+ * toolchains are returned in the other methods in this interface. Often, the
+ * first toolchain in a list is the default toolchain to use in a build
+ * configuration.
+ *
+ * @param orderedToolchains
+ * @throws CoreException
+ * @since 6.4
+ */
+ void setToolChainOrder(List<IToolChain> orderedToolchains) throws CoreException;
+
+ /**
+ * Add a toolchain.
+ *
+ * @param toolChain
+ * the toolchain
+ */
void addToolChain(IToolChain toolChain);
+ /**
+ * Remove a toolchain
+ *
+ * @param toolChain
+ * the toolchain
+ */
void removeToolChain(IToolChain toolChain);
+ /**
+ * Add a listener for toolchains added or removed. The listener is a simple
+ * runnable that is called when an event occurs.
+ *
+ * @param listener
+ * runnable that is called when a toolchain is added or removed
+ * @since 6.4
+ */
+ void addToolChainListener(ISafeRunnable listener);
+
+ /**
+ * Remove a listener.
+ *
+ * @param listener
+ * the listener to remove
+ * @since 6.4
+ */
+ void removeToolChainListener(ISafeRunnable listener);
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
index 0b9c78ef7cc..d1c11e2fbbe 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChainProvider.java
@@ -36,15 +36,27 @@ public interface IToolChainProvider {
/**
* Called by the manager to dynamically create the toolchain.
*
- * @param name
- * the name of the toolchain
+ * @deprecated We have dropped the concept of version. All ids must be unique.
+ * @param id
+ * the id of the toolchain
* @param version
* the version of the toolchain
- * @param properties
- * the persisted settings for the toolchain
* @return the toolchain initialized with the settings.
*/
+ @Deprecated
default IToolChain getToolChain(String id, String version) throws CoreException {
+ return getToolChain(id);
+ }
+
+ /**
+ * Called by the manager to dynamically create the toolchain.
+ *
+ * @param id
+ * the id of the toolchain
+ * @return the toolchain initialized with the settings.
+ * @since 6.4
+ */
+ default IToolChain getToolChain(String id) throws CoreException {
// By default, assumes all toolchains were added at init time.
return null;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java
new file mode 100644
index 00000000000..14f2f21c996
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IUserToolChainProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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 org.eclipse.core.runtime.CoreException;
+
+/**
+ * A toolchain provider that is managed by the user. The user can manually add
+ * and remove toolchains.
+ *
+ * It is the responsibility of the provider to manage persistence and to
+ * populate the toolchains with the toolchain manager.
+ *
+ * @since 6.4
+ */
+public interface IUserToolChainProvider extends IToolChainProvider {
+
+ /**
+ * Manually add a toolchain to be managed by this provider.
+ *
+ * @param toolChain
+ * toolchain to be added
+ * @since 6.4
+ */
+ void addToolChain(IToolChain toolChain) throws CoreException;
+
+ /**
+ * Manually remove a toolchain managed by this provider.
+ *
+ * @param toolChain
+ * toolchain to be removed
+ * @throws CoreException
+ */
+ void removeToolChain(IToolChain toolChain) throws CoreException;
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
index ceeb95c4995..50f28769f26 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
@@ -77,7 +78,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
Path buildDir = getBuildDirectory();
- outStream.write(String.format("Building in: %s\n", buildDir.toString()));
+ outStream.write(String.format(Messages.StandardBuildConfiguration_0, buildDir.toString()));
String[] command = new String[buildCommand.length];
Path make = findCommand(buildCommand[0]);
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 34174d410fc..e94820da9da 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
@@ -1,3 +1,10 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.internal.core.build;
import org.eclipse.osgi.util.NLS;
@@ -5,6 +12,11 @@ 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 CBuilder_ExceptionWhileBuilding;
+ public static String CBuilder_ExceptionWhileBuilding2;
+ public static String CBuilder_NotConfiguredCorrectly;
+ public static String CBuilder_NotConfiguredCorrectly2;
+ public static String StandardBuildConfiguration_0;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties
deleted file mode 100644
index d1a49530f37..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/Messages.properties
+++ /dev/null
@@ -1 +0,0 @@
-CBuildConfigurationtoolchainMissing=Toolchain missing for config: %s
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 7be272a5109..2333ee5e066 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
@@ -21,13 +21,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
public class ToolChainManager implements IToolChainManager {
private Map<String, IConfigurationElement> providerElements;
private Map<String, IToolChainProvider> providers;
private Map<List<String>, IToolChain> toolChains;
+ private List<IToolChain> orderedToolChains;
+ private List<ISafeRunnable> listeners = new ArrayList<>();
private void init() {
if (providerElements == null) {
@@ -45,6 +49,7 @@ public class ToolChainManager implements IToolChainManager {
// Load the discovered toolchains
toolChains = new HashMap<>();
+ orderedToolChains = new ArrayList<>();
for (IConfigurationElement element : providerElements.values()) {
// TODO check for enablement
try {
@@ -69,12 +74,16 @@ public class ToolChainManager implements IToolChainManager {
@Override
public void addToolChain(IToolChain toolChain) {
+ orderedToolChains.add(toolChain);
toolChains.put(getId(toolChain), toolChain);
+ fireChange();
}
@Override
public void removeToolChain(IToolChain toolChain) {
+ orderedToolChains.remove(toolChain);
toolChains.remove(getId(toolChain));
+ fireChange();
}
@Override
@@ -172,4 +181,39 @@ public class ToolChainManager implements IToolChainManager {
return tcs;
}
+ @Override
+ public Collection<IToolChain> getAllToolChains() throws CoreException {
+ init();
+ return orderedToolChains;
+ }
+
+ @Override
+ public void setToolChainOrder(List<IToolChain> orderedToolchains) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addToolChainListener(ISafeRunnable listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ @Override
+ public void removeToolChainListener(ISafeRunnable listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ private void fireChange() {
+ List<ISafeRunnable> runners;
+ synchronized (listeners) {
+ runners = new ArrayList<>(listeners);
+ }
+ for (ISafeRunnable runner : runners) {
+ SafeRunner.run(runner);
+ }
+ }
}
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
new file mode 100644
index 00000000000..318235d700b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/messages.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2017 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
+################################################################################
+CBuilder_ExceptionWhileBuilding=Exception while building
+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

Back to the top