--- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView.java Mon Apr 12 11:44:32 2010 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestMMPView.java Mon Apr 12 14:10:48 2010 -0500
@@ -286,6 +286,74 @@
model.dispose();
}
+ /** bug 10968 */
+ public void testSourceChanging7() throws Exception {
+ makeModel("SOURCEPATH ..\\src\n"+
+ "SOURCE a.cpp b.cpp\n"+
+ "SOURCE c.cpp\n"+
+ "SOURCE d.cpp\n"+
+ "SOURCEPATH ..\\data\n" +
+ "START RESOURCE extra.rss\n"+
+ "END\n");
+
+ IMMPView view = getView(mmpConfig);
+ assertNotNull(view);
+
+ // when we add files, put them in the right section (DUH)
+ view.getSources().add(new Path("data/Foo.cpp"));
+ commitTest(view, "SOURCEPATH ..\\src\n"+
+ "SOURCE a.cpp b.cpp\n"+
+ "SOURCE c.cpp\n"+
+ "SOURCE d.cpp\n"+
+ "SOURCEPATH ..\\data\n" +
+ "START RESOURCE extra.rss\n"+
+ "END\n"+
+ "SOURCE Foo.cpp\n" +
+ "");
+
+ match(new IPath[] { new Path("src"), new Path("data") }, view.getRealSourcePaths());
+
+ assertTrue(view.getSources().contains(new Path("data/Foo.cpp")));
+
+ view.dispose();
+ model.dispose();
+ }
+
+ /** bug 10968 */
+ public void testSourceChanging7b() throws Exception {
+ makeModel("SOURCEPATH ..\\src\n"+
+ "SOURCE a.cpp b.cpp\n"+
+ "SOURCE c.cpp\n"+
+ "SOURCE d.cpp\n"+
+ "SOURCEPATH ..\\data\n" +
+ "SOURCEPATH ..\\empty\n" +
+ "START RESOURCE extra.rss\n"+
+ "END\n");
+
+ IMMPView view = getView(mmpConfig);
+ assertNotNull(view);
+
+ // when we add files, put them in the right section (DUH)
+ view.getSources().add(new Path("data/Foo.cpp"));
+ commitTest(view, "SOURCEPATH ..\\src\n"+
+ "SOURCE a.cpp b.cpp\n"+
+ "SOURCE c.cpp\n"+
+ "SOURCE d.cpp\n"+
+ "SOURCEPATH ..\\empty\n" +
+ "START RESOURCE extra.rss\n"+
+ "END\n"+
+ "SOURCEPATH ..\\data\n" +
+ "SOURCE Foo.cpp\n" +
+ "");
+
+ match(new IPath[] { new Path("src"), new Path("empty"), new Path("data") }, view.getRealSourcePaths());
+
+ assertTrue(view.getSources().contains(new Path("data/Foo.cpp")));
+
+ view.dispose();
+ model.dispose();
+ }
+
public void testSourceChangingCond1() throws Exception {
makeModel("SOURCEPATH ..\\src\n#if 1\nSOURCE a.cpp\n#endif\nSOURCE b.cpp c.cpp");
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPStatementUpdater.java Mon Apr 12 11:44:32 2010 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/mmp/MMPStatementUpdater.java Mon Apr 12 14:10:48 2010 -0500
@@ -149,6 +149,15 @@
private void updateSourcePath(IASTMMPSingleArgumentStatement sourcePath) {
changeStatement(sourcePath);
currentSourcePath = mmpView.fromMmpToProjectPath(sourcePath.getArgument());
+
+ // These statements depend on the SOURCEPATH, but such statements may
+ // not actually appear. Thus, if we add a new entry, we should not change
+ // the previous SOURCE/etc. statement until until there is an actual
+ // statement to modify (bug 10968)
+ lastListStmts.remove(EMMPStatement.SOURCE);
+ lastListStmts.remove(EMMPStatement.DOCUMENT);
+ lastListStmts.remove(EMMPStatement.RESOURCE);
+ lastListStmts.remove(EMMPStatement.SYSTEMRESOURCE);
}
/**