1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

2004-02-24 Sean Evoy

Changed the makefile generator to escape any whitespace it finds in a dependency path. Now it is possible to build a project in a location with spaces but you still cannot have internal folders with spaces in the name. 
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
	
Tweaked the builder to put only the make command in invocation if there were no arguments spec'd. It seemed to be causing a fake error message to be reported on Linux even though make was successfully building the project.
* src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
This commit is contained in:
Sean Evoy 2004-02-24 21:25:12 +00:00
parent 35ad4ab120
commit c80f98594b
3 changed files with 46 additions and 6 deletions

View file

@ -1,3 +1,14 @@
2004-02-24 Sean Evoy
Changed the makefile generator to escape any whitespace it finds in a dependency
path. Now it is possible to build a project in a location with spaces but
you still cannot have internal folders with spaces in the name.
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
Tweaked the builder to put only the make command in invocation if there were
no arguments spec'd. It seemed to be causing a fake error message
to be reported on Linux even though make was successfully building the project.
* src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
2004-02-23 Sean Evoy 2004-02-23 Sean Evoy
Fix for bug 52647. Fix for bug 52647.
In 1.2, the target stored the raw, overridden build command the user In 1.2, the target stored the raw, overridden build command the user

View file

@ -336,9 +336,11 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Get the arguments to be passed to make from build model // Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList(); ArrayList makeArgs = new ArrayList();
String arg = info.getMakeArguments(); String arg = info.getMakeArguments();
String[] args = arg.split("\\s"); if (arg.length() > 0) {
for (int i = 0; i < args.length; ++i) { String[] args = arg.split("\\s");
makeArgs.add(args[i]); for (int i = 0; i < args.length; ++i) {
makeArgs.add(args[i]);
}
} }
makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild))); makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild)));
String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]); String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);

View file

@ -339,7 +339,7 @@ public class MakefileGenerator {
if (outputExt != null) { if (outputExt != null) {
fileName += DOT + outputExt; fileName += DOT + outputExt;
} }
// ASk the dep generator to find all the deps for this resource // Ask the dep generator to find all the deps for this resource
ArrayList dependencies = new ArrayList(); ArrayList dependencies = new ArrayList();
try { try {
indexManager.performConcurrentJob(new DependencyQueryJob(project, (IFile)resource, indexManager, dependencies), ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null, null); indexManager.performConcurrentJob(new DependencyQueryJob(project, (IFile)resource, indexManager, dependencies), ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null, null);
@ -351,8 +351,13 @@ public class MakefileGenerator {
Iterator iter = dependencies.listIterator(); Iterator iter = dependencies.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
buffer.append(LINEBREAK + NEWLINE); buffer.append(LINEBREAK + NEWLINE);
String path = (String)iter.next(); String rawPath = (String)iter.next();
buffer.append(path + WHITESPACE); // TODO Convert to relative if possible
String path = escapeWhitespaces(rawPath);
buffer.append(path);
if (iter.hasNext()) {
buffer.append(WHITESPACE);
}
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
} }
@ -361,6 +366,28 @@ public class MakefileGenerator {
return buffer; return buffer;
} }
/* (non-Javadoc)
* Answers the argument with all whitespaces replaced with an escape sequence.
*
* @param path
*/
private String escapeWhitespaces(String path) {
// Escape the spaces in the path/filename if it has any
String[] segments = path.split("\\s");
if (segments.length > 1) {
StringBuffer escapedPath = new StringBuffer();
for (int index = 0; index < segments.length; ++index) {
escapedPath.append(segments[index]);
if (index + 1 < segments.length) {
escapedPath.append("\\ ");
}
}
return escapedPath.toString().trim();
} else {
return path;
}
}
/* (non-javadoc) /* (non-javadoc)
* @param buffer * @param buffer
* @param info * @param info