1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 285347: JUnit failure: managedbuilder BuildDescriptionModelTests

Regression fixed (new build resource created for the same
resource)
This commit is contained in:
Andrew Gvozdev 2009-11-10 20:56:04 +00:00
parent 7bd060b64d
commit f3ca785ec5
2 changed files with 12 additions and 8 deletions

View file

@ -60,7 +60,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
@SuppressWarnings("restriction")
public class BuildDescriptionModelTests extends TestCase { public class BuildDescriptionModelTests extends TestCase {
private static final String PREFIX = "BuildDescription_"; private static final String PREFIX = "BuildDescription_";
private static final String PROJ_PATH = "testBuildDescriptionProjects"; private static final String PROJ_PATH = "testBuildDescriptionProjects";

View file

@ -102,7 +102,8 @@ public class BuildDescription implements IBuildDescription {
private Map<ITool, BuildStep> fToolToMultiStepMap = new HashMap<ITool, BuildStep>(); private Map<ITool, BuildStep> fToolToMultiStepMap = new HashMap<ITool, BuildStep>();
private BuildStep fOrderedMultiActions[]; private BuildStep fOrderedMultiActions[];
private Map<IPath, BuildResource> fLocationToRcMap = new HashMap<IPath, BuildResource>(); // private Map<IPath, BuildResource> fLocationToRcMap = new HashMap<IPath, BuildResource>();
private Map<URI, BuildResource> fLocationToRcMap = new HashMap<URI, BuildResource>();
private Map<String, Set<BuildIOType>> fVarToAddlInSetMap = new HashMap<String, Set<BuildIOType>>(); private Map<String, Set<BuildIOType>> fVarToAddlInSetMap = new HashMap<String, Set<BuildIOType>>();
@ -911,9 +912,9 @@ public class BuildDescription implements IBuildDescription {
} }
}while(foundUnused); }while(foundUnused);
Set<Entry<IPath,BuildResource>> set = fLocationToRcMap.entrySet(); Set<Entry<URI, BuildResource>> set = fLocationToRcMap.entrySet();
List<BuildResource> list = new ArrayList<BuildResource>(); List<BuildResource> list = new ArrayList<BuildResource>();
for (Entry<IPath, BuildResource> entry : set) { for (Entry<URI, BuildResource> entry : set) {
BuildResource rc = entry.getValue(); BuildResource rc = entry.getValue();
boolean doRemove = false; boolean doRemove = false;
BuildIOType producerArg = (BuildIOType)rc.getProducerIOType(); BuildIOType producerArg = (BuildIOType)rc.getProducerIOType();
@ -953,11 +954,11 @@ public class BuildDescription implements IBuildDescription {
} }
protected void resourceRemoved(BuildResource rc){ protected void resourceRemoved(BuildResource rc){
fLocationToRcMap.remove(rc.getLocation()); fLocationToRcMap.remove(rc.getLocationURI());
} }
protected void resourceCreated(BuildResource rc){ protected void resourceCreated(BuildResource rc){
fLocationToRcMap.put(rc.getLocation(), rc); fLocationToRcMap.put(rc.getLocationURI(), rc);
} }
private IManagedBuilderMakefileGenerator getMakeGenInitialized(){ private IManagedBuilderMakefileGenerator getMakeGenInitialized(){
@ -1464,9 +1465,13 @@ public class BuildDescription implements IBuildDescription {
} }
public IBuildResource getBuildResource(IPath location) { public IBuildResource getBuildResource(IPath location) {
return fLocationToRcMap.get(location); return getBuildResource(URIUtil.toURI(location));
} }
private IBuildResource getBuildResource(URI locationURI) {
return fLocationToRcMap.get(locationURI);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getResources() * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getResources()
*/ */
@ -1957,7 +1962,7 @@ public class BuildDescription implements IBuildDescription {
public BuildResource createResource(IPath fullWorkspacePath, URI locationURI){ public BuildResource createResource(IPath fullWorkspacePath, URI locationURI){
BuildResource rc = (BuildResource)getBuildResource(fullWorkspacePath); BuildResource rc = (BuildResource)getBuildResource(locationURI);
if(rc == null) if(rc == null)
rc = new BuildResource(this, fullWorkspacePath, locationURI); rc = new BuildResource(this, fullWorkspacePath, locationURI);