Don't include files from outside a compilation unit
Modified: trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/tools/rbuild/tests/compilationunittest.cpp
Modified: trunk/reactos/tools/rbuild/tests/data/compilationunit.xml

Modified: trunk/reactos/tools/rbuild/module.cpp
--- trunk/reactos/tools/rbuild/module.cpp	2005-11-25 14:31:45 UTC (rev 19553)
+++ trunk/reactos/tools/rbuild/module.cpp	2005-11-25 14:38:59 UTC (rev 19554)
@@ -448,6 +448,7 @@
                                ParseContext& parseContext )
 {
 	If* pOldIf = parseContext.ifData;
+	CompilationUnit* pOldCompilationUnit = parseContext.compilationUnit;
 	bool subs_invalid = false;
 	string subpath ( path );
 	if ( e.name == "file" && e.value.size () > 0 )
@@ -654,6 +655,7 @@
 	for ( size_t i = 0; i < e.subElements.size (); i++ )
 		ProcessXMLSubElement ( *e.subElements[i], subpath, parseContext );
 	parseContext.ifData = pOldIf;
+	parseContext.compilationUnit = pOldCompilationUnit;
 }
 
 ModuleType

Modified: trunk/reactos/tools/rbuild/tests/compilationunittest.cpp
--- trunk/reactos/tools/rbuild/tests/compilationunittest.cpp	2005-11-25 14:31:45 UTC (rev 19553)
+++ trunk/reactos/tools/rbuild/tests/compilationunittest.cpp	2005-11-25 14:38:59 UTC (rev 19554)
@@ -29,15 +29,21 @@
 	Module& module1 = *project.modules[0];
 	IS_TRUE ( module1.type == BuildTool );
 	
-	ARE_EQUAL ( 2, module1.non_if_data.files.size());
+	ARE_EQUAL ( 3, module1.non_if_data.files.size());
 	ARE_EQUAL ( "dir1" SSEP "file1.c", module1.non_if_data.files[0]->name );
 	ARE_EQUAL ( "dir1" SSEP "file2.c", module1.non_if_data.files[1]->name );
+	ARE_EQUAL ( "dir1" SSEP "file3.c", module1.non_if_data.files[2]->name );
 
-	ARE_EQUAL ( 1, module1.non_if_data.compilationUnits.size () );
+	ARE_EQUAL ( 2, module1.non_if_data.compilationUnits.size () );
 
 	CompilationUnit& compilationUnit1 = *module1.non_if_data.compilationUnits[0];
 	ARE_EQUAL ( 2, compilationUnit1.files.size () );
 
 	ARE_EQUAL ( "dir1" SSEP "file1.c", compilationUnit1.files[0]->name );
 	ARE_EQUAL ( "dir1" SSEP "file2.c", compilationUnit1.files[1]->name );
+
+	CompilationUnit& compilationUnit2 = *module1.non_if_data.compilationUnits[1];
+	ARE_EQUAL ( 1, compilationUnit2.files.size () );
+
+	ARE_EQUAL ( "dir1" SSEP "file3.c", compilationUnit2.files[0]->name );
 }

Modified: trunk/reactos/tools/rbuild/tests/data/compilationunit.xml
--- trunk/reactos/tools/rbuild/tests/data/compilationunit.xml	2005-11-25 14:31:45 UTC (rev 19553)
+++ trunk/reactos/tools/rbuild/tests/data/compilationunit.xml	2005-11-25 14:38:59 UTC (rev 19554)
@@ -6,6 +6,7 @@
 				<file>file1.c</file>
 				<file>file2.c</file>
 			</compilationunit>
+			<file>file3.c</file>
 		</module>
 	</directory>
 </project>