From c96d126b86382356caec9b8ee961e37b84313f6b Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 9 Feb 2017 18:43:05 -0500 Subject: Bug 513589 - Add support to build CDT projects in a Docker Container - add IOptionalBuildObjectPropertiesContainer interface to use for objects that supply optional build properties - add new IOptionalBuildProperties interface that defines optional build properties donated by external plug-ins - add new - change IConfiguration to an IOptionalBuildObjectPropertiesContainer - change IManagedProject to be an IOptionalBuildObjectPropertiesContainer - fix ProcessClosure to ensure that readers are not null before accessing them - fix Container launch delegate to look at project optional build properties for active configuration to fetch connection and image info and use said info to find a matching launch or create a new one - have Container launch delegate use the image name as part of the launch config name - have Container launch short-cut also use the project's optional build properties for the active config to get connection and image information before any defaulting - change AutotoolsNewMarkerGenerator to store the command launcher as an ICommandLauncher - add new CommandLauncherFactory extension to cdt.core that allows plug-ins to specify a CommandLauncherFactory that will return an ICommandLauncher based on the project - add macros for new extension to CCorePlugin - add new CommandLauncherManager class that loads CommandLauncherFactory extensions and is used to give an ICommandLauncher wrapper that will go through the list of CommandLauncherFactory extensions until one returns non-null ICommandLauncher - add code to RemoteCommandLauncher so it will use the CommandLauncherManager to get the local launcher - also change RemoteCommandLauncher to check at execution time whether the command is local and in that case use the local command launcher - add new ICommandLauncherFactory interface - add new ContainerCommandLauncher to launch - add new ContainerCommandLauncherFactory class for returning a ContainerCommandLauncher instance to launch commands in a Docker Container - change MakeBuilder to use CommandLauncherManager to get its ICommandLauncher - change CommandBuilder to use CommandLauncherManager too - ditto for Builder and AbstractBuiltinSpecsDetector and ExternalToolInvoker - change Configuration to load/store optional build properties as well as return the properties to get/set - ditto for MultiConfiguration - change ManagedProject to implement IOptionalBuildOptionProperties interface - ditto for ProjectType - create new OptionalBuildProperties class to store optional build properties for a configuration - bump cdt.docker.launcher to 1.1.0 - use CommandLauncherFactory extension to define ContainerCommandLauncherFactory - add optional ContainerPropertyTab which allows the end-user to optionally choose to build a C/C++ project in a Container and specify the connection/image to use - in LanguageSettingsSerializableSettings class, call the CommandLauncherManager getLanguageSettingEntries method to get the massaged language setting entries based on the current list - in LanguageSettingsProviderSerializer, try and get the pooled entries using the cfg description so that it will have the project and can use the CommandLauncherManager to get entries from image - in ContainerCommandLauncherFactory move cached headers under a HEADERS directory in the plug-in area - create a sub-directory for the connection and a sub-directory for the image based on cleansed names - store the real names of the connection and image to use later in the DockerHeaderPreferencePage - modify LanguageSettingsEntriesTab to force the horizontal scroll bar to appear (this is a bug in SWT SashForm support and the fix here isn't quite correct, but is better) - add new DockerHeaderPreferencePage that allows user to remove cached headers from images - change C/C++ Docker preferences to be titled: Docker Container - fix LanguageSettingsWorkspaceProvider.getSettingEntries method to use the CommandLauncherManager so entries will be transformed to use cached headers - add BaseDatabindingModel class - add DataVolumeModel class to model a volume mount - add ContainerPropertyVolumes model to model volume specification and selected volumes - add properties to ContainerCommandLauncher to represent volumes and selected volumes for a configuration - add ContainerDataVolumeDialog for specifying a volume mount by the end-user - add a null detector for cfgDescription in LanguageSettingsSerializableProvider - fix AutotoolsNewMakeGenerator.getWinOSType to not specify "." for working dir - fix GCCBuiltinSpecsDetectorCygwin to not map paths to Cygwin if the current configuration is enabled for container build - add logic to ContainerCommandLauncher to look for Windows file formats and change them to unix format and map any "." working dir to be /tmp - fix ContainerLauncherConfigurationDelegate similarly - fix AbstractBuiltinSpecsDetector to pass in the current configuration description when getting the CommandLauncher since the current configuration may not be the active configuration - change 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 - add documentationl for the ContainerPropertyTab in Build Settings and the Data Volume dialog pop-up it brings up - change CommandBuilder to accept a project as an argument to its constructor and to pass this as an argument to the CommandLauncherManager - have StepBuilder pass project when creating a CommandBuilder Change-Id: Ia78488b93056e6ec7ca83a6c87b3a9d2b9424943 --- .../cdt/remote/core/RemoteCommandLauncher.java | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'remote/org.eclipse.cdt.remote.core') diff --git a/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java b/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java index 85546854402..da2ee6f03f7 100644 --- a/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java +++ b/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java @@ -17,7 +17,7 @@ import java.net.URI; import java.util.Map; import java.util.Properties; -import org.eclipse.cdt.core.CommandLauncher; +import org.eclipse.cdt.core.CommandLauncherManager; import org.eclipse.cdt.core.ICommandLauncher; import org.eclipse.cdt.remote.internal.core.Activator; import org.eclipse.cdt.remote.internal.core.messages.Messages; @@ -40,6 +40,8 @@ import org.eclipse.remote.core.RemoteProcessAdapter; public class RemoteCommandLauncher implements ICommandLauncher { private static final String CYGWIN_PREFIX = "cygdrive"; //$NON-NLS-1$ + + private boolean usingLocalLauncher = false; /** * Convert a local (workspace) path into the remote equivalent. If the local path is not @@ -102,7 +104,7 @@ public class RemoteCommandLauncher implements ICommandLauncher { return s; } - private final ICommandLauncher fLocalLauncher = new CommandLauncher(); + private ICommandLauncher fLocalLauncher = CommandLauncherManager.getInstance().getCommandLauncher(); private boolean fShowCommand; private String[] fCommandArgs; private IRemoteConnection fConnection; @@ -129,13 +131,18 @@ public class RemoteCommandLauncher implements ICommandLauncher { @Override public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException { + ICommandLauncher localLauncher = CommandLauncherManager.getInstance().getCommandLauncher(getProject()); + localLauncher.setProject(getProject()); + localLauncher.setErrorMessage(getErrorMessage()); + usingLocalLauncher = false; + fLocalLauncher = localLauncher; if (getProject() != null) { IRemoteResource remRes = (IRemoteResource) getProject().getAdapter(IRemoteResource.class); if (remRes != null) { URI uri = remRes.getActiveLocationURI(); IRemoteServicesManager remoteServicesManager = Activator.getService(IRemoteServicesManager.class); IRemoteConnectionType connectionType = remoteServicesManager.getConnectionType(uri); - if (connectionType != null) { + if (connectionType != null && !connectionType.getScheme().equals("file")) { //$NON-NLS-1$ fConnection = connectionType.getConnection(uri); if (fConnection != null) { parseEnvironment(env); @@ -163,16 +170,23 @@ public class RemoteCommandLauncher implements ICommandLauncher { } } } + usingLocalLauncher = true; return fLocalLauncher.execute(commandPath, args, env, workingDirectory, monitor); } @Override public String[] getCommandArgs() { + if (usingLocalLauncher) { + return fLocalLauncher.getCommandArgs(); + } return fCommandArgs; } @Override public String getCommandLine() { + if (usingLocalLauncher) { + return fLocalLauncher.getCommandLine(); + } return getCommandLine(fCommandArgs); } @@ -202,6 +216,9 @@ public class RemoteCommandLauncher implements ICommandLauncher { @Override public Properties getEnvironment() { + if (usingLocalLauncher) { + return fLocalLauncher.getEnvironment(); + } return fEnvironment; } @@ -261,8 +278,15 @@ public class RemoteCommandLauncher implements ICommandLauncher { fShowCommand = show; } + @SuppressWarnings("deprecation") @Override public int waitAndRead(OutputStream out, OutputStream err) { + + if (usingLocalLauncher) { + return fLocalLauncher.waitAndRead(out, err); + } + + // otherwise remote process if (fShowCommand) { printCommandLine(out); } @@ -278,6 +302,11 @@ public class RemoteCommandLauncher implements ICommandLauncher { @Override public int waitAndRead(OutputStream out, OutputStream err, IProgressMonitor monitor) { + if (usingLocalLauncher) { + return fLocalLauncher.waitAndRead(out, err, monitor); + } + + // otherwise remote process if (fShowCommand) { printCommandLine(out); } -- cgit v1.2.3