Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-01-05 20:11:03 +0000
committerJeff Johnston2018-01-11 00:47:29 +0000
commit1ae56d435a608f068c66a203fcfbe9965dcd2a99 (patch)
treed2015c4f6de72c2e3adc0a64ff4f666d864eb2af /launch/org.eclipse.cdt.docker.launcher
parent7627e275ef3604b179fe8c92ca8c4ad461824a67 (diff)
downloadorg.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.tar.gz
org.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.tar.xz
org.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.zip
Bug 528169 - Run autotools commands within containers
- add new optional build property to run all Autotool commands in Container - for Autotool nature projects only, add a checkbox to the ContainerPropertyTab to turn this new option on/off - change the AbstractAutotoolsHandler class to look at the optional build properties for the project to determine if the fallback CommandLauncher used to run commands should come from the CommandLauncherManager to run in Container or to a local CommandLauncher - change AutotoolsNewMakeGenerator the same way - add new messages as needed (add a tooltip to warn user that choosing new option may cause inconsistencies for files shared among configurations) Change-Id: Id828ec3015f32f320d2247bd0577944164c71df8
Diffstat (limited to 'launch/org.eclipse.cdt.docker.launcher')
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerPropertyTab.java78
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java2
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties2
3 files changed, 81 insertions, 1 deletions
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 623a4c5acea..92d11aeb678 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
@@ -28,6 +28,7 @@ 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.docker.launcher.ContainerCommandLauncher;
+import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.cdt.internal.docker.launcher.ContainerPropertyVolumesModel.MountType;
import org.eclipse.cdt.managedbuilder.buildproperties.IOptionalBuildProperties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -42,6 +43,9 @@ import org.eclipse.core.databinding.beans.IBeanValueProperty;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.property.Properties;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
import org.eclipse.jface.databinding.viewers.ViewerSupport;
@@ -88,19 +92,23 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
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 static final String RUN_IN_CONFIGURE_LAUNCHER = "org.eclipse.cdt.autotools.core.property.launchAutotoolsInContainer"; //$NON-NLS-1$
private Combo imageCombo;
private Combo connectionSelector;
private Button enableButton;
+ private Button launchAutotoolsButton;
private Button addButton;
private IDockerConnection connection;
private IDockerConnection[] connections;
private IDockerImageListener containerTab;
+ private boolean isAutotoolsProject;
private String connectionName;
private String connectionUri = ""; //$NON-NLS-1$
private boolean initialEnabled;
+ private boolean initialAutotoolsLaunchEnabled;
private String initialConnection;
private String initialImageId;
private String initialVolumes;
@@ -235,6 +243,43 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
});
+ createVolumeSettingsContainer(usercomp);
+
+ try {
+ IProject project = iCfgd.getProjectDescription().getProject();
+ IProjectNature nature = project.getNature(
+ "org.eclipse.cdt.autotools.core.autotoolsNatureV2"); //$NON-NLS-1$
+ isAutotoolsProject = (nature != null);
+ if (isAutotoolsProject) {
+ launchAutotoolsButton = new Button(usercomp, SWT.CHECK);
+ launchAutotoolsButton.setText(
+ Messages.ContainerPropertyTab_Run_Autotools_In_Container_Msg);
+ launchAutotoolsButton.setToolTipText(
+ Messages.ContainerPropertyTab_Run_Autotools_In_Container_Tooltip);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 5;
+ launchAutotoolsButton.setLayoutData(gd);
+ initializeLaunchAutotoolsButton();
+ launchAutotoolsButton
+ .addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setLaunchAutotoolsEnablement(
+ launchAutotoolsButton.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(
+ SelectionEvent e) {
+ // ignore
+ }
+ });
+ }
+ } catch (CoreException e) {
+ DockerLaunchUIPlugin.log(e);
+ }
+
initializeEnablementButton();
enableButton.addSelectionListener(new SelectionListener() {
@@ -251,7 +296,6 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
});
- createVolumeSettingsContainer(usercomp);
}
private void createVolumeSettingsContainer(final Composite container) {
@@ -597,6 +641,23 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
}
}
+ private void setLaunchAutotoolsEnablement(boolean enabled) {
+ if (iCfg instanceof IMultiConfiguration) {
+ IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
+ .getItems();
+ for (int i = 0; i < cfs.length; i++) {
+ IConfiguration cfg = cfs[i];
+ IOptionalBuildProperties p = cfg.getOptionalBuildProperties();
+ p.setProperty(RUN_IN_CONFIGURE_LAUNCHER,
+ Boolean.toString(launchAutotoolsButton.getSelection()));
+ }
+ } else {
+ IOptionalBuildProperties p = iCfg.getOptionalBuildProperties();
+ p.setProperty(RUN_IN_CONFIGURE_LAUNCHER,
+ Boolean.toString(launchAutotoolsButton.getSelection()));
+ }
+ }
+
private void setImageId(String imageId) {
if (iCfg instanceof IMultiConfiguration) {
IConfiguration[] cfs = (IConfiguration[]) ((IMultiConfiguration) iCfg)
@@ -630,6 +691,9 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
private void setControlsEnabled(boolean enabled) {
imageCombo.setEnabled(enabled);
connectionSelector.setEnabled(enabled);
+ if (isAutotoolsProject) {
+ launchAutotoolsButton.setEnabled(enabled);
+ }
setVolumeControlsEnabled(new Button[] { addButton }, enabled);
}
@@ -646,6 +710,16 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
setControlsEnabled(initialEnabled);
}
+ private void initializeLaunchAutotoolsButton() {
+ initialEnabled = false;
+ IOptionalBuildProperties properties = iCfg.getOptionalBuildProperties();
+ String savedEnabled = properties.getProperty(RUN_IN_CONFIGURE_LAUNCHER);
+ if (savedEnabled != null) {
+ initialAutotoolsLaunchEnabled = Boolean.parseBoolean(savedEnabled);
+ }
+ launchAutotoolsButton.setSelection(initialAutotoolsLaunchEnabled);
+ }
+
private void initializeConnectionSelector() {
int defaultIndex = -1;
initialConnection = null;
@@ -871,6 +945,8 @@ public class ContainerPropertyTab extends AbstractCBuildPropertyTab
.getProperty(ContainerCommandLauncher.VOLUMES_ID);
initialSelectedVolumes = properties
.getProperty(ContainerCommandLauncher.SELECTED_VOLUMES_ID);
+ initialAutotoolsLaunchEnabled = Boolean.parseBoolean(
+ properties.getProperty(RUN_IN_CONFIGURE_LAUNCHER));
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgd)
.getLanguageSettingProviders();
for (ILanguageSettingsProvider provider : providers) {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
index dc90a4e3144..ac7ec788d2e 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/Messages.java
@@ -99,6 +99,8 @@ public class Messages extends NLS {
public static String ContainerPropertyTab_Title;
public static String ContainerPropertyTab_Enable_Msg;
+ public static String ContainerPropertyTab_Run_Autotools_In_Container_Msg;
+ public static String ContainerPropertyTab_Run_Autotools_In_Container_Tooltip;
public static String ContainerCommandLauncher_image_msg;
public static String CommandLauncher_CommandCancelled;
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties
index 06609d611cf..a545210b63a 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/messages.properties
@@ -42,6 +42,8 @@ ContainerTab_Warning_Image_Not_Found=Docker Image: {0} is not a valid pulled ima
ContainerPropertyTab_Title=Container Settings
ContainerPropertyTab_Enable_Msg=Build inside Docker Image
+ContainerPropertyTab_Run_Autotools_In_Container_Msg=Run all Autotools in Container
+ContainerPropertyTab_Run_Autotools_In_Container_Tooltip=Run Autotool commands in the Docker Container. This may cause inconsistencies between configurations sharing generated files.
HeaderPreferencePage_Connection_Label=Connection
HeaderPreferencePage_Image_Label=Image

Back to the top