mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for bugzilla 76080. One of the reported errors in this bug was valid. When a directory containing source was deleted, the Gnu makefilegenerator would mistakenly place it in a list of directories to regenerate makefiles for. The fix places those directories in a list to be deleted.
This commit is contained in:
parent
06739b170f
commit
30b41b6da1
2 changed files with 61 additions and 2 deletions
|
@ -100,7 +100,6 @@ public class DefaultGCCDependencyCalculator implements IManagedDependencyGenerat
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
buildFlags +
|
buildFlags +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
|
||||||
IManagedBuilderMakefileGenerator.IN_MACRO +
|
IManagedBuilderMakefileGenerator.IN_MACRO +
|
||||||
IManagedBuilderMakefileGenerator.WHITESPACE +
|
IManagedBuilderMakefileGenerator.WHITESPACE +
|
||||||
">>" + //$NON-NLS-1$
|
">>" + //$NON-NLS-1$
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
if (!generator.isGeneratedResource(resource)) {
|
if (!generator.isGeneratedResource(resource)) {
|
||||||
// This is a source file so just add its container
|
// This is a source file so just add its container
|
||||||
if (info.buildsFileType(ext)) {
|
if (info.buildsFileType(ext)) {
|
||||||
generator.appendModifiedSubdirectory(resource);
|
generator.appendDeletedSubdirectory(resource);
|
||||||
generator.appendDeletedFile(resource);
|
generator.appendDeletedFile(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
private String buildTargetName;
|
private String buildTargetName;
|
||||||
private Vector buildTools;
|
private Vector buildTools;
|
||||||
private Vector deletedFileList;
|
private Vector deletedFileList;
|
||||||
|
private Vector deletedDirList;
|
||||||
private Vector dependencyMakefiles;
|
private Vector dependencyMakefiles;
|
||||||
private String extension;
|
private String extension;
|
||||||
private IManagedBuildInfo info;
|
private IManagedBuildInfo info;
|
||||||
|
@ -741,6 +742,27 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the container of the argument to a list of subdirectories that are part
|
||||||
|
* of an incremental rebuild of the project. The makefile fragments for these
|
||||||
|
* directories will be regenerated as a result of the build.
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
*/
|
||||||
|
protected void appendDeletedSubdirectory(IResource resource) {
|
||||||
|
IContainer container = resource.getParent();
|
||||||
|
// If the path contains a space relative to the project, reject it from the build
|
||||||
|
if (resource.getProjectRelativePath().toString().indexOf(" ") != -1) { //$NON-NLS-1$
|
||||||
|
// Only add the container once
|
||||||
|
if (!getInvalidDirList().contains(container)) {
|
||||||
|
getInvalidDirList().add(container);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!getDeletedDirList().contains(container)) {
|
||||||
|
getDeletedDirList().add(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* If a file is removed from a source folder (either because of a delete
|
* If a file is removed from a source folder (either because of a delete
|
||||||
* or move action on the part of the user), the makefilegenerator has to
|
* or move action on the part of the user), the makefilegenerator has to
|
||||||
|
@ -1071,6 +1093,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
checkCancel();
|
checkCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove deleted folders from generated build directory
|
||||||
|
iter = getDeletedDirList().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
IContainer subDir = (IContainer) iter.next();
|
||||||
|
removeGeneratedDirectory(subDir);
|
||||||
|
checkCancel();
|
||||||
|
}
|
||||||
|
|
||||||
// How did we do
|
// How did we do
|
||||||
if (!getInvalidDirList().isEmpty()) {
|
if (!getInvalidDirList().isEmpty()) {
|
||||||
status = new MultiStatus (
|
status = new MultiStatus (
|
||||||
|
@ -1110,6 +1140,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the deletedDirList.
|
||||||
|
*/
|
||||||
|
private Vector getDeletedDirList() {
|
||||||
|
if (deletedDirList == null) {
|
||||||
|
deletedDirList = new Vector();
|
||||||
|
}
|
||||||
|
return deletedDirList;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -1751,6 +1791,26 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @param subDir
|
||||||
|
*/
|
||||||
|
private void removeGeneratedDirectory(IContainer subDir) {
|
||||||
|
IPath moduleRelativePath = subDir.getProjectRelativePath();
|
||||||
|
IPath buildRoot = getBuildWorkingDir();
|
||||||
|
if (buildRoot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IPath moduleOutputPath = buildRoot.append(moduleRelativePath);
|
||||||
|
IFolder folder = project.getFolder(moduleOutputPath);
|
||||||
|
if (folder.exists()) {
|
||||||
|
try {
|
||||||
|
folder.delete(true, new SubProgressMonitor(monitor, 1));
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// TODO Log this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue