Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Watson2014-05-13 12:56:51 -0400
committerJeff Johnston2014-05-20 12:01:40 -0400
commit009a3a7d5f835b2aedf62424dd3929c229d10559 (patch)
tree7183d0faa9b20974bc6452c5f63e3453a256146f /build/org.eclipse.cdt.autotools.core/src
parent5806deb5b87f75a5b5f2da5344705aa24eefd513 (diff)
downloadorg.eclipse.cdt-009a3a7d5f835b2aedf62424dd3929c229d10559.tar.gz
org.eclipse.cdt-009a3a7d5f835b2aedf62424dd3929c229d10559.tar.xz
org.eclipse.cdt-009a3a7d5f835b2aedf62424dd3929c229d10559.zip
[autotools] Prevent MalformedURLException when setting remote working
directory. Change-Id: Ib8a6a7d4df09a1f73a533db0a3821fcdb8cecdcb Signed-off-by: Greg Watson <g.watson@computer.org> Reviewed-on: https://git.eclipse.org/r/26428 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core/src')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java53
1 files changed, 28 insertions, 25 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
index 80b0e119aa..6367da4e91 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
@@ -84,6 +84,7 @@ import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteResource;
import org.eclipse.remote.core.IRemoteServices;
import org.eclipse.remote.core.RemoteServices;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
@SuppressWarnings("deprecation")
@@ -220,12 +221,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
newFile.setDerived(true);
}
// if successful, refresh any remote projects to notify them of the new file
- IRemoteResource remRes =
- (IRemoteResource)getProject().getAdapter(IRemoteResource.class);
- if (remRes != null) {
- remRes.refresh(new NullProgressMonitor());
- }
-
+ refresh();
} catch (CoreException e) {
// If the file already existed locally, just refresh to get contents
if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
@@ -253,17 +249,20 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
rc = f.mkdirs();
if (rc) {
// if successful, refresh any remote projects to notify them of the new directory
- IRemoteResource remRes =
- (IRemoteResource)project.getAdapter(IRemoteResource.class);
- if (remRes != null) {
- remRes.refresh(new NullProgressMonitor());
- }
-
+ refresh();
}
}
return rc;
}
+
+ private void refresh() throws CoreException{
+ IRemoteResource remRes =
+ (IRemoteResource)getProject().getAdapter(IRemoteResource.class);
+ if (remRes != null) {
+ remRes.refresh(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
+ }
+ }
/*
* (non-Javadoc)
@@ -537,6 +536,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
errMsg, console, autogenEnvs, consoleStart);
consoleStart = false;
if (rc != IStatus.ERROR) {
+ refresh();
configStatus = configfile.toFile();
// Check for config.status. If it is created, then
// autogen.sh ran configure and we should not run it
@@ -556,6 +556,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
AutotoolsPlugin.getFormattedString("MakeGenerator.autoreconf", new String[]{buildDir}), //$NON-NLS-1$
errMsg, console, null, consoleStart);
consoleStart = false;
+ refresh();
}
// Check if configure generated and if yes, run it.
if (rc != IStatus.ERROR && configurePath.toFile().exists()) {
@@ -611,6 +612,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
consoleStart = false;
// Check if configure generated and if yes, run it.
if (rc != IStatus.ERROR) {
+ refresh();
if (configurePath.toFile().exists()) {
rc = runScript(configurePath,
buildLocation,
@@ -926,7 +928,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
launcher.showCommand(true);
Process proc = launcher.execute(commandPath, configTargets, env,
- runPath, new NullProgressMonitor());
+ runPath, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
int exitValue = 0;
if (proc != null) {
try {
@@ -1036,15 +1038,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private IPath getRemotePath(IPath path) {
IRemoteResource remRes = (IRemoteResource) getProject().getAdapter(IRemoteResource.class);
if (remRes != null) {
- IPath relativePath = path.makeRelativeTo(getProject().getLocation());
- try {
- IPath remotePath =
- new Path(remRes.getActiveLocationURI().toURL().getPath()).append(relativePath);
- return remotePath;
- } catch (MalformedURLException e) {
- // fall-through to default action
- }
-
+ return RemoteCommandLauncher.makeRemote(path, remRes);
}
return path;
}
@@ -1075,7 +1069,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
new String[] { "-c", "echo $OSTYPE" }, //$NON-NLS-1$ //$NON-NLS-2$
env,
new Path("."), //$NON-NLS-1$
- new NullProgressMonitor());
+ new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
if (launcher.waitAndRead(out, out) == ICommandLauncher.OK)
winOSType = out.toString().trim();
} catch (CoreException e) {
@@ -1096,7 +1090,16 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IRemoteConnection conn =
remServices.getConnectionManager().getConnection(uri);
if (conn != null) {
- return conn.getProperty(IRemoteConnection.OS_NAME_PROPERTY);
+ 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
+ }
+ }
}
}
}
@@ -1282,7 +1285,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
launcher.showCommand(true);
// Run the shell script via shell command.
Process proc = launcher.execute(new Path(SHELL_COMMAND), configTargets, env,
- runPath, new NullProgressMonitor());
+ runPath, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
int exitValue = 0;
if (proc != null) {

Back to the top