Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff2017-06-27 20:01:18 +0000
committerJeff Johnston2017-06-27 20:10:01 +0000
commit49c2109ff63c93c2e6e06ec6d2ef53e5b74e40e3 (patch)
tree043df8802e6e8ce04fbfaf1fa1383e7b9a95d126
parent0c1c44a47df6a9cb59980acccaf8cc26eb9a90f2 (diff)
downloadorg.eclipse.cdt-49c2109ff63c93c2e6e06ec6d2ef53e5b74e40e3.tar.gz
org.eclipse.cdt-49c2109ff63c93c2e6e06ec6d2ef53e5b74e40e3.tar.xz
org.eclipse.cdt-49c2109ff63c93c2e6e06ec6d2ef53e5b74e40e3.zip
Fix specs detection for Container Build feature
- sometimes specs detection will be for a non-active build configuration so the project cannot be used to determine eligibility for the command launcher - change ICommandLauncherFactory to accept an object in its getCommandLauncher method which can either be an IProject or ICConfigurationDesription - change ContainerCommandLauncherFactory to accept an Object instead of IProject in its getCommandLauncher() method - cast the Object received either to be an IProject or ICConfigurationDescription to determine if the build should occur in a Container or not - fix CommandLauncherManager.getCommandLauncher() to accept and pass on an Object to the list of ICommandLauncherFactory instances - fix AbstractBuiltinSpecsDetector to pass in the current configuration description when getting the CommandLauncher since the current configuration may not be the active configuration
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/AbstractBuiltinSpecsDetector.java4
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java4
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java8
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java20
4 files changed, 25 insertions, 11 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/AbstractBuiltinSpecsDetector.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/AbstractBuiltinSpecsDetector.java
index c89e5edf07..ca31fcc4d6 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/AbstractBuiltinSpecsDetector.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/language/settings/providers/AbstractBuiltinSpecsDetector.java
@@ -657,7 +657,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
}
console.start(currentProject);
- ICommandLauncher launcher = CommandLauncherManager.getInstance().getCommandLauncher();
+ ICommandLauncher launcher = CommandLauncherManager.getInstance().getCommandLauncher(currentCfgDescription);
launcher.setProject(currentProject);
IPath program = new Path(""); //$NON-NLS-1$
@@ -766,7 +766,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
// so collect them to save later when output finishes
if (entries != null) {
for (ICLanguageSettingEntry entry : entries) {
- if (!detectedSettingEntries.contains(entry)) {
+ if (detectedSettingEntries != null && !detectedSettingEntries.contains(entry)) {
detectedSettingEntries.add(entry);
}
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
index 1e6084a78e..8378a37133 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java
@@ -166,11 +166,11 @@ public class CommandLauncherManager {
* @param project - optional input to determine launcher.
* @return an ICommandLauncher for running commands
*/
- public ICommandLauncher getCommandLauncher(IProject project) {
+ public ICommandLauncher getCommandLauncher(Object object) {
// loop through list of factories and return first launcher
// returned
for (ICommandLauncherFactory factory : factories) {
- ICommandLauncher launcher = factory.getCommandLauncher(project);
+ ICommandLauncher launcher = factory.getCommandLauncher(object);
if (launcher != null) {
return launcher;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java
index 1eaf567000..8ea8d5b439 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java
@@ -21,11 +21,11 @@ import org.eclipse.core.resources.IProject;
public interface ICommandLauncherFactory {
/**
- * Get a Command Launcher for a project (optional)
- * @param project - optional parameter to help determine appropriate launcher
- * @return ICommandLauncher or null if not appropriate for project
+ * Get a Command Launcher for an object (IProject or IConfiguration) (optional)
+ * @param object - optional parameter to help determine appropriate launcher
+ * @return ICommandLauncher or null if not appropriate for object
*/
- public ICommandLauncher getCommandLauncher(IProject project);
+ public ICommandLauncher getCommandLauncher(Object object);
/**
* Register language setting entries for a project
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
index 8ed61068f7..a077584902 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java
@@ -39,10 +39,24 @@ public class ContainerCommandLauncherFactory
implements ICommandLauncherFactory {
@Override
- public ICommandLauncher getCommandLauncher(IProject project) {
+ public ICommandLauncher getCommandLauncher(Object object) {
// check if container build enablement has been checked
- ICConfigurationDescription cfgd = CoreModel.getDefault()
- .getProjectDescription(project).getActiveConfiguration();
+ ICConfigurationDescription cfgd = null;
+ // We use an object because it could be an IProject, implying the
+ // active configuration, but it could be an ICConfigurationDescription
+ // as is used when computing specs for non-active configurations. We
+ // don't want to force callers to have to declare
+ // ICConfigurationDescription
+ // which is part of Managed build.
+ if (object instanceof IProject) {
+ IProject project = (IProject) object;
+ cfgd = CoreModel.getDefault().getProjectDescription(project)
+ .getActiveConfiguration();
+ } else if (object instanceof ICConfigurationDescription) {
+ cfgd = (ICConfigurationDescription) object;
+ } else {
+ return null;
+ }
IConfiguration cfg = ManagedBuildManager
.getConfigurationForDescription(cfgd);
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();

Back to the top