mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 459972 - Update CDT to use o.e.remote 2.0.
Requires a couple of changes in the autotools plug-ins. Change the 4.5 target to refer to the remote 2.0 build and update the pom to use the 4.5 target. Also fixes autotools test so they run on the Mac. Change-Id: I145de3ea3f14d61ffba7354ad0fa3e0ec2467e26
This commit is contained in:
parent
9471bc7bc1
commit
cd65a29016
8 changed files with 82 additions and 28 deletions
|
@ -37,6 +37,7 @@ import org.eclipse.ui.IWorkbenchPage;
|
|||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
/**
|
||||
* The main plugin class to be used in the desktop.
|
||||
|
@ -101,6 +102,18 @@ public class AutotoolsPlugin extends AbstractUIPlugin {
|
|||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the OSGi service with the given service interface.
|
||||
*
|
||||
* @param service service interface
|
||||
* @return the specified service or null if it's not registered
|
||||
*/
|
||||
public static <T> T getService(Class<T> service) {
|
||||
BundleContext context = plugin.getBundle().getBundleContext();
|
||||
ServiceReference<T> ref = context.getServiceReference(service);
|
||||
return ref != null ? context.getService(ref) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns active shell.
|
||||
*/
|
||||
|
|
|
@ -80,12 +80,13 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.remote.core.IRemoteConnection;
|
||||
import org.eclipse.remote.core.IRemoteConnectionControlService;
|
||||
import org.eclipse.remote.core.IRemoteConnectionPropertyService;
|
||||
import org.eclipse.remote.core.IRemoteConnectionType;
|
||||
import org.eclipse.remote.core.IRemoteResource;
|
||||
import org.eclipse.remote.core.IRemoteServices;
|
||||
import org.eclipse.remote.core.RemoteServices;
|
||||
import org.eclipse.remote.core.IRemoteServicesManager;
|
||||
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
||||
|
||||
|
@ -1073,21 +1074,23 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
(IRemoteResource)getProject().getAdapter(IRemoteResource.class);
|
||||
if (remRes != null) {
|
||||
URI uri = remRes.getActiveLocationURI();
|
||||
IRemoteServices remServices = RemoteServices.getRemoteServices(uri);
|
||||
if (remServices != null) {
|
||||
IRemoteConnection conn =
|
||||
remServices.getConnectionManager().getConnection(uri);
|
||||
IRemoteServicesManager remoteServiceManager = AutotoolsPlugin.getService(IRemoteServicesManager.class);
|
||||
IRemoteConnectionType connectionType = remoteServiceManager.getConnectionType(uri);
|
||||
if (connectionType != null) {
|
||||
IRemoteConnection conn = connectionType.getConnection(uri);
|
||||
if (conn != null) {
|
||||
if (!conn.isOpen()) {
|
||||
try {
|
||||
conn.open(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
|
||||
if (conn.isOpen()) {
|
||||
return conn.getProperty(IRemoteConnection.OS_NAME_PROPERTY);
|
||||
}
|
||||
} catch (RemoteConnectionException e) {
|
||||
// Ignore and return platform OS
|
||||
}
|
||||
}
|
||||
|
||||
if (conn.isOpen()) {
|
||||
return conn.getProperty(IRemoteConnection.OS_NAME_PROPERTY);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@ bin
|
|||
@dot
|
||||
javaCompiler...args
|
||||
build.xml
|
||||
/screenshots/
|
||||
|
|
|
@ -26,11 +26,14 @@ import org.eclipse.core.resources.IWorkspace;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.bindings.keys.KeyStroke;
|
||||
import org.eclipse.jface.bindings.keys.ParseException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
|
||||
|
@ -51,6 +54,9 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
|
|||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
|
||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -88,7 +94,31 @@ public abstract class AbstractTest {
|
|||
// do nothing
|
||||
}
|
||||
// Turn off automatic building by default
|
||||
clickMainMenu("Window", "Preferences");
|
||||
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
|
||||
// On Mac, the Preferences menu is under the system menu
|
||||
final IWorkbench workbench = PlatformUI.getWorkbench();
|
||||
workbench.getDisplay().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
|
||||
if (window != null) {
|
||||
Menu appMenu = workbench.getDisplay().getSystemMenu();
|
||||
for (MenuItem item : appMenu.getItems()) {
|
||||
if (item.getText().startsWith("Preferences")) {
|
||||
Event event = new Event();
|
||||
event.time = (int) System.currentTimeMillis();
|
||||
event.widget = item;
|
||||
event.display = workbench.getDisplay();
|
||||
item.setSelection(true);
|
||||
item.notifyListeners(SWT.Selection, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
clickMainMenu("Window", "Preferences");
|
||||
}
|
||||
SWTBotShell shell = bot.shell("Preferences");
|
||||
shell.activate();
|
||||
bot.text().setText("Workspace");
|
||||
|
@ -325,13 +355,13 @@ public abstract class AbstractTest {
|
|||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus on the main window
|
||||
*/
|
||||
public static void focusMainShell() {
|
||||
SWTBotShell shell = getMainShell();
|
||||
shell.activate();
|
||||
}
|
||||
/**
|
||||
* Focus on the main window
|
||||
*/
|
||||
public static void focusMainShell() {
|
||||
SWTBotShell shell = getMainShell();
|
||||
shell.activate();
|
||||
}
|
||||
|
||||
private static SWTBotShell getMainShell() {
|
||||
for (SWTBotShell shellBot : bot.shells()) {
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
*.o
|
||||
/ltmain.sh
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -22,7 +22,7 @@
|
|||
<repo-path>tools/cdt/builds/master/nightly</repo-path>
|
||||
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
|
||||
<sonar.jacoco.reportPath>${project.basedir}/../../target/jacoco.exec</sonar.jacoco.reportPath>
|
||||
<target-platform>cdt-e4.4</target-platform>
|
||||
<target-platform>cdt-e4.5</target-platform>
|
||||
<help-docs-eclipserun-repo>http://download.eclipse.org/eclipse/updates/4.4</help-docs-eclipserun-repo>
|
||||
<tycho.scmUrl>scm:git:git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git</tycho.scmUrl>
|
||||
<base.test.vmargs>-Xms256m -Xmx512m -XX:MaxPermSize=256m -ea</base.test.vmargs>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?pde version="3.8"?><target name="cdt_e4.5" sequenceNumber="20">
|
||||
<?pde version="3.8"?><target name="cdt_e4.5" sequenceNumber="21">
|
||||
<locations>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.jetty.bundles.f.feature.group" version="0.0.0"/>
|
||||
|
@ -27,7 +27,7 @@
|
|||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.remote.feature.group" version="0.0.0"/>
|
||||
<repository location="http://download.eclipse.org/tools/ptp/updates/luna"/>
|
||||
<repository location="http://download.eclipse.org/tools/ptp/builds/remote/2.0.0/"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.license.feature.group" version="0.0.0"/>
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Properties;
|
|||
|
||||
import org.eclipse.cdt.core.CommandLauncher;
|
||||
import org.eclipse.cdt.core.ICommandLauncher;
|
||||
import org.eclipse.cdt.remote.internal.core.Activator;
|
||||
import org.eclipse.cdt.remote.internal.core.messages.Messages;
|
||||
import org.eclipse.core.filesystem.IFileStore;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -27,12 +28,14 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.remote.core.IRemoteConnection;
|
||||
import org.eclipse.remote.core.IRemoteConnectionType;
|
||||
import org.eclipse.remote.core.IRemoteFileService;
|
||||
import org.eclipse.remote.core.IRemoteProcess;
|
||||
import org.eclipse.remote.core.IRemoteProcessBuilder;
|
||||
import org.eclipse.remote.core.IRemoteProcessService;
|
||||
import org.eclipse.remote.core.IRemoteResource;
|
||||
import org.eclipse.remote.core.IRemoteServices;
|
||||
import org.eclipse.remote.core.IRemoteServicesManager;
|
||||
import org.eclipse.remote.core.RemoteProcessAdapter;
|
||||
import org.eclipse.remote.core.RemoteServices;
|
||||
|
||||
public class RemoteCommandLauncher implements ICommandLauncher {
|
||||
|
||||
|
@ -130,16 +133,19 @@ public class RemoteCommandLauncher implements ICommandLauncher {
|
|||
IRemoteResource remRes = (IRemoteResource) getProject().getAdapter(IRemoteResource.class);
|
||||
if (remRes != null) {
|
||||
URI uri = remRes.getActiveLocationURI();
|
||||
IRemoteServices remServices = RemoteServices.getRemoteServices(uri);
|
||||
if (remServices != null) {
|
||||
fConnection = remServices.getConnectionManager().getConnection(uri);
|
||||
IRemoteServicesManager remoteServicesManager = Activator.getService(IRemoteServicesManager.class);
|
||||
IRemoteConnectionType connectionType = remoteServicesManager.getConnectionType(uri);
|
||||
if (connectionType != null) {
|
||||
fConnection = connectionType.getConnection(uri);
|
||||
if (fConnection != null) {
|
||||
parseEnvironment(env);
|
||||
fCommandArgs = constructCommandArray(commandPath.toString(), args, remRes);
|
||||
IRemoteProcessBuilder processBuilder = fConnection.getProcessBuilder(fCommandArgs);
|
||||
IRemoteProcessService processService = fConnection.getService(IRemoteProcessService.class);
|
||||
IRemoteProcessBuilder processBuilder = processService.getProcessBuilder(fCommandArgs);
|
||||
if (workingDirectory != null) {
|
||||
String remoteWorkingPath = makeRemote(workingDirectory.toString(), remRes);
|
||||
IFileStore wd = fConnection.getFileManager().getResource(remoteWorkingPath);
|
||||
IRemoteFileService fileManager = fConnection.getService(IRemoteFileService.class);
|
||||
IFileStore wd = fileManager.getResource(remoteWorkingPath);
|
||||
processBuilder.directory(wd);
|
||||
}
|
||||
Map<String, String> processEnv = processBuilder.environment();
|
||||
|
|
Loading…
Add table
Reference in a new issue