Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2014-07-24 21:26:47 +0000
committerJeff Johnston2014-07-30 21:51:23 +0000
commit49d1763a804a68f7acd098ab8cf9fe47c2f5ecde (patch)
treef2036f0a0f848f99288561e565f87d509e29e810 /build/org.eclipse.cdt.autotools.core/src
parent86864c02fedb88cf2d3d34199b03bd7514d21b89 (diff)
downloadorg.eclipse.cdt-49d1763a804a68f7acd098ab8cf9fe47c2f5ecde.tar.gz
org.eclipse.cdt-49d1763a804a68f7acd098ab8cf9fe47c2f5ecde.tar.xz
org.eclipse.cdt-49d1763a804a68f7acd098ab8cf9fe47c2f5ecde.zip
Bug 434275 - Autotools configuration in subfolder not found
- add getProjectLocation() method - fix getSourcePath() method to find the srcDir resource and then get its location - fix all references in code to use getProjectLocation() and getSourcePath() where appropriate Change-Id: I7d6d401a42213dbe9c4c2dee03aca306a4941683 Reviewed-on: https://git.eclipse.org/r/30466 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, 25 insertions, 28 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 5061eb26051..97ceb69f3b9 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
@@ -18,7 +18,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.net.MalformedURLException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
@@ -145,7 +144,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IPath buildDirectory = b.getBuildLocation();
if (buildDirectory == null || buildDirectory.isEmpty()) {
// default build directory to project directory
- buildDirectory = project.getLocation();
+ buildDirectory = getProjectLocation();
}
buildLocation = buildDirectory;
buildDir = buildDirectory.toString();
@@ -243,7 +242,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IPath path = new Path(dirName);
boolean rc = true;
if (dirName.length() == 0 || dirName.equals("."))
- path = project.getLocation().append(dirName);
+ path = getProjectLocation().append(dirName);
File f = path.toFile();
if (!f.exists()) {
rc = f.mkdirs();
@@ -387,9 +386,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// to
// regenerate the makefile
IPath configfile = buildLocation.append(CONFIG_STATUS);
- IPath topConfigFile = project.getLocation().append(CONFIG_STATUS);
+ IPath topConfigFile = getProjectLocation().append(CONFIG_STATUS);
IPath makefilePath = buildLocation.append(MAKEFILE);
- IPath topMakefilePath = project.getLocation().append(MAKEFILE);
+ IPath topMakefilePath = getProjectLocation().append(MAKEFILE);
File configStatus = configfile.toFile();
File topConfigStatus = topConfigFile.toFile();
File makefile = makefilePath.toFile();
@@ -419,7 +418,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
makeargs[makeargs.length - 1] = target;
rc = runCommand(makeCmd,
- project.getLocation(),
+ getProjectLocation(),
makeargs,
AutotoolsPlugin.getResourceString("MakeGenerator.clean.topdir"), //$NON-NLS-1$
errMsg, console, consoleStart);
@@ -551,7 +550,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IPath reconfCmdPath = new Path(reconfCmd);
reconfArgs[0] = "-i"; //$NON-NLS-1$
rc = runScript(reconfCmdPath,
- project.getLocation().append(srcDir),
+ getSourcePath(),
reconfArgs,
AutotoolsPlugin.getFormattedString("MakeGenerator.autoreconf", new String[]{buildDir}), //$NON-NLS-1$
errMsg, console, null, consoleStart);
@@ -584,13 +583,13 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IPath makeCmd = builder.getBuildCommand();
makeargs[0] = "-f" + getMakefileCVSPath().toOSString(); //$NON-NLS-1$
rc = runCommand(makeCmd,
- project.getLocation().append(buildDir),
+ getProjectLocation().append(buildDir),
makeargs,
AutotoolsPlugin.getFormattedString("MakeGenerator.makefile.cvs", new String[]{buildDir}), //$NON-NLS-1$
errMsg, console, consoleStart);
consoleStart = false;
if (rc != IStatus.ERROR) {
- File makefileFile = project.getLocation().append(buildDir)
+ File makefileFile = getProjectLocation().append(buildDir)
.append(MAKEFILE).toFile();
addMakeTargetsToManager(makefileFile);
toolsCfg.setDirty(false);
@@ -605,7 +604,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
IPath reconfCmdPath = new Path(reconfCmd);
reconfArgs[0] = "-i"; //$NON-NLS-1$
rc = runScript(reconfCmdPath,
- project.getLocation().append(srcDir),
+ getSourcePath(),
reconfArgs,
AutotoolsPlugin.getFormattedString("MakeGenerator.autoreconf", new String[]{buildDir}), //$NON-NLS-1$
errMsg, console, null, consoleStart);
@@ -754,6 +753,10 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
return str;
}
+ private IPath getProjectLocation() {
+ return project.getLocation();
+ }
+
private IPath getBuildPath(){
return new Path(this.buildDir);
}
@@ -761,9 +764,14 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private IPath getSourcePath(){
IPath sourcePath;
if (srcDir.equals(""))
- sourcePath = project.getLocation();
- else
- sourcePath = project.getLocation().append(srcDir);
+ sourcePath = getProjectLocation();
+ else { // find location of source directory which may be a virtual folder
+ IResource sourceResource = project.findMember(srcDir);
+ if (sourceResource.exists() && sourceResource.getType() == IResource.FOLDER)
+ sourcePath = sourceResource.getLocation();
+ else // punt and let configure fail if directory is not found by then
+ sourcePath = getProjectLocation().append(srcDir);
+ }
return sourcePath;
}
@@ -783,22 +791,14 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (Path.fromOSString(command).isAbsolute()) {
configPath = new Path(command);
} else {
- if (srcDir.equals(""))
- configPath = project.getLocation().append(command);
- else
- configPath = project.getLocation().append(srcDir)
- .append(command);
+ configPath = getSourcePath().append(command);
}
return configPath;
}
protected IPath getMakefileCVSPath() {
IPath makefileCVSPath;
- if (srcDir.equals(""))
- makefileCVSPath = project.getLocation().append(MAKEFILE_CVS);
- else
- makefileCVSPath= project.getLocation().append(srcDir).append(
- MAKEFILE_CVS);
+ makefileCVSPath = getSourcePath().append(MAKEFILE_CVS);
return makefileCVSPath;
}
@@ -821,10 +821,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
cmdParms.add(tokens[i]);
}
- if (srcDir.equals(""))
- autogenPath = project.getLocation().append(command);
- else
- autogenPath = project.getLocation().append(srcDir).append(command);
+ autogenPath = getSourcePath().append(command);
return autogenPath;
}
@@ -1613,4 +1610,4 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
return aList.toArray(new String[aList.size()]);
}
-} \ No newline at end of file
+}

Back to the top