<include> now has attribute 'base' which allows to specify subdirectory of another module
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Modified: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/module.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp

Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml	2005-01-08 04:33:01 UTC (rev 12880)
@@ -1,4 +1,6 @@
-<project name="ReactOS" makefile="Makefile.auto">
+<?xml version="1.0"?>
+<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
+<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
 	<define name="_M_IX86"></define>
 	<include>include</include>
 	<include>w32api/include</include>

Modified: branches/xmlbuildsystem/reactos/lib/kjs/module.xml
--- branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/lib/kjs/module.xml	2005-01-08 04:33:01 UTC (rev 12880)
@@ -1,7 +1,7 @@
 <module name="kjs" type="staticlibrary">
-	<include>.</include>
-	<include>src</include>
-	<include>include</include>
+	<include base="kjs">.</include>
+	<include base="kjs">src</include>
+	<include base="kjs">include</include>
 	<directory name="ksrc">
 		<file>setjmp.S</file>
 		<file>longjmp.S</file>

Modified: branches/xmlbuildsystem/reactos/ntoskrnl/module.xml
--- branches/xmlbuildsystem/reactos/ntoskrnl/module.xml	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/ntoskrnl/module.xml	2005-01-08 04:33:01 UTC (rev 12880)
@@ -4,8 +4,7 @@
 	<define name="__NTOSKRNL__" />
 	<define name="__3GB__" />
 	<include>.</include>
-	<include>./include</include>
-	<include>../lib/kjs/include</include>
+	<include base="kjs">./include</include>
 	<library>kjs</library>
 	<directory name="cc">
 		<file>cacheman.c</file>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-01-08 04:33:01 UTC (rev 12880)
@@ -140,8 +140,7 @@
 }
 
 string
-MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const string& basePath,
-	                                                         const vector<Include*>& includes ) const
+MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes ) const
 {
 	string parameters;
 	for (size_t i = 0; i < includes.size (); i++)
@@ -149,9 +148,7 @@
 		Include& include = *includes[i];
 		if (parameters.length () > 0)
 			parameters += " ";
-		parameters += "-I";
-		parameters += ConcatenatePaths ( basePath,
-		                                 include.directory );
+		parameters += "-I" + include.directory;
 	}
 	return parameters;
 }
@@ -159,10 +156,8 @@
 string
 MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const
 {
-	string parameters = GenerateGccIncludeParametersFromVector ( ".",
-	                                                             module.project.includes );
-	string s = GenerateGccIncludeParametersFromVector ( module.path,
-	                                                    module.includes );
+	string parameters = GenerateGccIncludeParametersFromVector ( module.project.includes );
+	string s = GenerateGccIncludeParametersFromVector ( module.includes );
 	if (s.length () > 0)
 	{
 		parameters += " ";

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-01-08 04:33:01 UTC (rev 12880)
@@ -26,8 +26,7 @@
 	                               const std::string& path2 ) const;
 	std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
 	std::string GenerateGccDefineParameters ( const Module& module ) const;
-	std::string GenerateGccIncludeParametersFromVector ( const std::string& basePath,
-	                                                     const std::vector<Include*>& includes ) const;
+	std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
 	std::string GenerateGccIncludeParameters ( const Module& module ) const;
 	std::string GenerateGccParameters ( const Module& module ) const;
 };

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp	2005-01-08 04:33:01 UTC (rev 12880)
@@ -10,7 +10,8 @@
                    const XMLElement& includeNode )
 	: project(project_),
 	  module(NULL),
-	  node(includeNode)
+	  node(includeNode),
+	  base(NULL)
 {
 	Initialize();
 }
@@ -20,7 +21,8 @@
 	               const XMLElement& includeNode )
 	: project(project_),
 	  module(module_),
-	  node(includeNode)
+	  node(includeNode),
+	  base(NULL)
 {
 	Initialize();
 }
@@ -32,10 +34,27 @@
 void
 Include::Initialize()
 {
-	directory = FixSeparator ( node.value );
 }
 
 void
 Include::ProcessXML()
 {
+	const XMLAttribute* att;
+	att = node.GetAttribute("base",false);
+	if ( att )
+	{
+		if ( !module )
+			throw InvalidBuildFileException (
+				node.location,
+				"'base' attribute illegal from global <include>" );
+		base = project.LocateModule ( att->value );
+		if ( !base )
+			throw InvalidBuildFileException (
+				node.location,
+				"<include> attribute 'base' references non-existant module '%s'",
+				att->value.c_str() );
+		directory = FixSeparator ( base->GetBasePath() + "/" + node.value );
+	}
+	else
+		directory = FixSeparator ( node.value );
 }

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-01-08 04:33:01 UTC (rev 12880)
@@ -62,8 +62,14 @@
 	size_t i;
 	for ( i = 0; i < node.subElements.size(); i++ )
 		ProcessXMLSubElement ( *node.subElements[i], path );
+	for ( i = 0; i < files.size(); i++ )
+		files[i]->ProcessXML();
 	for ( i = 0; i < libraries.size(); i++ )
 		libraries[i]->ProcessXML();
+	for ( i = 0; i < includes.size(); i++ )
+		includes[i]->ProcessXML();
+	for ( i = 0; i < defines.size(); i++ )
+		defines[i]->ProcessXML();
 }
 
 void
@@ -137,9 +143,15 @@
 }
 
 string
+Module::GetBasePath() const
+{
+	return path;
+}
+
+string
 Module::GetPath () const
 {
-	return FixSeparator (path) + CSEP + name + extension;
+	return path + CSEP + name + extension;
 }
 
 
@@ -148,6 +160,10 @@
 {
 }
 
+void
+File::ProcessXML()
+{
+}
 
 Library::Library ( const XMLElement& _node,
                    const Module& _module,

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-01-08 04:33:01 UTC (rev 12880)
@@ -79,6 +79,7 @@
 	         const std::string& modulePath );
 	~Module ();
 	ModuleType GetModuleType (const XMLAttribute& attribute );
+	std::string GetBasePath() const;
 	std::string GetPath () const;
 	void ProcessXML();
 private:
@@ -95,6 +96,7 @@
 	const Module* module;
 	const XMLElement& node;
 	std::string directory;
+	const Module* base;
 
 	Include ( const Project& project,
 	          const XMLElement& includeNode );
@@ -135,6 +137,8 @@
 	std::string name;
 
 	File ( const std::string& _name );
+
+	void ProcessXML();
 };
 
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/include.xml	2005-01-08 04:33:01 UTC (rev 12880)
@@ -3,7 +3,12 @@
 	<include>include1</include>
 	<directory name="dir1">
 		<module name="module1" type="buildtool">
-				<include>include2</include>
+			<include>include2</include>
 		</module>
 	</directory>
+	<directory name="dir2">
+		<module name="module2" type="buildtool">
+			<include base="module1">include3</include>
+		</module>
+	</directory>
 </project>

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp	2005-01-08 03:37:32 UTC (rev 12879)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/includetest.cpp	2005-01-08 04:33:01 UTC (rev 12880)
@@ -10,10 +10,15 @@
 	Include& include1 = *project.includes[0];
 	ARE_EQUAL("include1", include1.directory);
 
-	ARE_EQUAL(1, project.modules.size());
+	ARE_EQUAL(2, project.modules.size());
 	Module& module1 = *project.modules[0];
+	Module& module2 = *project.modules[1];
 
 	ARE_EQUAL(1, module1.includes.size());
 	Include& include2 = *module1.includes[0];
 	ARE_EQUAL("include2", include2.directory);
+
+	ARE_EQUAL(1, module2.includes.size());
+	Include& include3 = *module2.includes[0];
+	ARE_EQUAL(FixSeparator("./dir1/include3"), include3.directory);
 }