Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff2017-06-28 21:37:02 +0000
committerJeff Johnston2017-06-28 21:42:35 +0000
commit379e33af43ddae0181320cc0ba86c17d714019a7 (patch)
treec8b87e044f7fa550f7f87e559c7793a76005a199
parent49c2109ff63c93c2e6e06ec6d2ef53e5b74e40e3 (diff)
downloadorg.eclipse.cdt-379e33af43ddae0181320cc0ba86c17d714019a7.tar.gz
org.eclipse.cdt-379e33af43ddae0181320cc0ba86c17d714019a7.tar.xz
org.eclipse.cdt-379e33af43ddae0181320cc0ba86c17d714019a7.zip
More Windows fixes for Container build
- change ICommandLauncherFactory to have two getCommandLauncher() methods that take an IProject and an ICConfigurationDescription rather than one method that takes an Object - change CommandLauncherManager and ContainerCommandLauncherFactory classes to have the same two methods - fix ContainerPropertyTab to add Elf and GNU Elf binary parsers when build in Container is chosen so that output executables are treated as Binaries by the CDT project
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CommandLauncherManager.java27
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICommandLauncherFactory.java16
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerCommandLauncherFactory.java40
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java33
4 files changed, 90 insertions, 26 deletions
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 8378a37133..a1b36ce78c 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
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -160,17 +161,37 @@ public class CommandLauncherManager {
}
}
+
+ /**
+ * Get a command launcher.
+ *
+ * @param project - IProject to determine launcher for.
+ * @return an ICommandLauncher for running commands
+ */
+ public ICommandLauncher getCommandLauncher(IProject project) {
+ // loop through list of factories and return first launcher
+ // returned
+ for (ICommandLauncherFactory factory : factories) {
+ ICommandLauncher launcher = factory.getCommandLauncher(project);
+ if (launcher != null) {
+ return launcher;
+ }
+ }
+ // default to local CommandLauncher
+ return new CommandLauncher();
+ }
+
/**
* Get a command launcher.
*
- * @param project - optional input to determine launcher.
+ * @param cfgd - ICConfigurationDescription to get command launcher for.
* @return an ICommandLauncher for running commands
*/
- public ICommandLauncher getCommandLauncher(Object object) {
+ public ICommandLauncher getCommandLauncher(ICConfigurationDescription cfgd) {
// loop through list of factories and return first launcher
// returned
for (ICommandLauncherFactory factory : factories) {
- ICommandLauncher launcher = factory.getCommandLauncher(object);
+ ICommandLauncher launcher = factory.getCommandLauncher(cfgd);
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 8ea8d5b439..7da2397e78 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
@@ -12,6 +12,7 @@ package org.eclipse.cdt.core;
import java.util.List;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.core.resources.IProject;
@@ -21,11 +22,18 @@ import org.eclipse.core.resources.IProject;
public interface ICommandLauncherFactory {
/**
- * 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
+ * Get a Command Launcher for a project (based on active configuration)
+ * @param project - IProject to get command launcher for
+ * @return ICommandLauncher
*/
- public ICommandLauncher getCommandLauncher(Object object);
+ public ICommandLauncher getCommandLauncher(IProject project);
+
+ /**
+ * Get a Command Launcher for a build configuration descriptor
+ * @param cfgd - ICConfigurationDescription to get command launcher for
+ * @return ICommandLauncher
+ */
+ public ICommandLauncher getCommandLauncher(ICConfigurationDescription cfgd);
/**
* 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 a077584902..a5453eeb8c 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,24 +39,34 @@ public class ContainerCommandLauncherFactory
implements ICommandLauncherFactory {
@Override
- public ICommandLauncher getCommandLauncher(Object object) {
+ public ICommandLauncher getCommandLauncher(IProject project) {
// check if container build enablement has been checked
- 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)
+ ICConfigurationDescription 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();
+ if (props != null) {
+ String enablementProperty = props.getProperty(
+ ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
+ if (enablementProperty != null) {
+ boolean enableContainer = Boolean
+ .parseBoolean(enablementProperty);
+ // enablement has occurred, we can return a
+ // ContainerCommandLauncher
+ if (enableContainer) {
+ return new ContainerCommandLauncher();
+ }
+ }
}
+ return null;
+ }
+
+ @Override
+ public ICommandLauncher getCommandLauncher(
+ ICConfigurationDescription cfgd) {
+ // check if container build enablement has been checked
IConfiguration cfg = ManagedBuildManager
.getConfigurationForDescription(cfgd);
IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
index 3d2496f4eb..247c8a6386 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.docker.launcher;
import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -21,9 +22,11 @@ import java.util.Set;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
+import org.eclipse.cdt.core.model.CoreModelUtil;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
+import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
import org.eclipse.cdt.internal.docker.launcher.ContainerPropertyVolumesModel.MountType;
import org.eclipse.cdt.managedbuilder.buildproperties.IOptionalBuildProperties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -82,6 +85,9 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
public final static String VOLUME_SEPARATOR = "|"; //$NON-NLS-1$
+ private final static String GNU_ELF_PARSER_ID = "org.eclipse.cdt.core.GNU_ELF"; //$NON-NLS-1$
+ private final static String ELF_PARSER_ID = "org.eclipse.cdt.core.ELF"; //$NON-NLS-1$
+
private Combo imageCombo;
private Combo connectionSelector;
private Button enableButton;
@@ -104,6 +110,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private List<IDockerImage> displayedImages = new ArrayList<>();
private IConfiguration iCfg;
+ private ICConfigurationDescription iCfgd;
private final DataBindingContext dbc = new DataBindingContext();
private final ContainerPropertyVolumesModel model;
@@ -156,6 +163,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
enableButton.setText(Messages.ContainerPropertyTab_Enable_Msg);
iCfg = getCfg();
+ iCfgd = getResDesc().getConfiguration();
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 5;
@@ -572,6 +580,20 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
p.setProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED,
Boolean.toString(enableButton.getSelection()));
}
+ // if enabled, make sure we have ELF binary parsers specified
+ if (enabled) {
+ String[] ids = CoreModelUtil
+ .getBinaryParserIds(page.getCfgsEditable());
+ List<String> idList = new ArrayList<>(Arrays.asList(ids));
+ if (!idList.contains(GNU_ELF_PARSER_ID)) {
+ idList.add(GNU_ELF_PARSER_ID);
+ }
+ if (!idList.contains(ELF_PARSER_ID)) {
+ idList.add(ELF_PARSER_ID);
+ }
+ CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(),
+ idList.toArray(new String[0]));
+ }
}
private void setImageId(String imageId) {
@@ -783,6 +805,12 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
IOptionalBuildProperties prop1 = cfg01.getOptionalBuildProperties();
IOptionalBuildProperties prop2 = cfg02.getOptionalBuildProperties();
boolean needToRecalculate = false;
+
+ ICTargetPlatformSetting tps = c1.getTargetPlatformSetting();
+ String[] pids = tps.getBinaryParserIds();
+ ICTargetPlatformSetting tps2 = c2.getTargetPlatformSetting();
+ tps2.setBinaryParserIds(pids);
+
String enablementProperty = prop1
.getProperty(ContainerCommandLauncher.CONTAINER_BUILD_ENABLED);
String enablementProperty2 = prop2
@@ -816,14 +844,10 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
String volumesProperty = prop1
.getProperty(ContainerCommandLauncher.VOLUMES_ID);
- String volumesProperty2 = prop2
- .getProperty(ContainerCommandLauncher.VOLUMES_ID);
prop2.setProperty(ContainerCommandLauncher.VOLUMES_ID, volumesProperty);
String selectedVolumesProperty = prop1
.getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
- String selectedVolumesProperty2 = prop2
- .getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
prop2.setProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID,
selectedVolumesProperty);
@@ -944,6 +968,7 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
if (cfgd == null)
return;
iCfg = getCfg(cfgd.getConfiguration());
+ iCfgd = cfgd.getConfiguration();
multiChange = false;

Back to the top