mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 12:43:05 +00:00
<include> now has attribute 'base' which allows to specify subdirectory of another module
svn path=/branches/xmlbuildsystem/; revision=12880
This commit is contained in:
parent
774f167e5e
commit
aead7a68f9
10 changed files with 67 additions and 23 deletions
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -140,8 +140,7 @@ MingwModuleHandler::ConcatenatePaths ( const string& path1,
|
|||
}
|
||||
|
||||
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 @@ MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const string& baseP
|
|||
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 @@ MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const string& baseP
|
|||
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 += " ";
|
||||
|
|
|
@ -26,8 +26,7 @@ private:
|
|||
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;
|
||||
};
|
||||
|
|
|
@ -10,7 +10,8 @@ Include::Include ( const Project& project_,
|
|||
const XMLElement& includeNode )
|
||||
: project(project_),
|
||||
module(NULL),
|
||||
node(includeNode)
|
||||
node(includeNode),
|
||||
base(NULL)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -20,7 +21,8 @@ Include::Include ( const Project& project_,
|
|||
const XMLElement& includeNode )
|
||||
: project(project_),
|
||||
module(module_),
|
||||
node(includeNode)
|
||||
node(includeNode),
|
||||
base(NULL)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -32,10 +34,27 @@ Include::~Include ()
|
|||
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 );
|
||||
}
|
||||
|
|
|
@ -62,8 +62,14 @@ Module::ProcessXML()
|
|||
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
|
||||
|
@ -136,10 +142,16 @@ Module::GetDefaultModuleExtension () const
|
|||
__LINE__);
|
||||
}
|
||||
|
||||
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 @@ File::File ( const string& _name )
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
File::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
||||
Library::Library ( const XMLElement& _node,
|
||||
const Module& _module,
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
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 @@ public:
|
|||
const Module* module;
|
||||
const XMLElement& node;
|
||||
std::string directory;
|
||||
const Module* base;
|
||||
|
||||
Include ( const Project& project,
|
||||
const XMLElement& includeNode );
|
||||
|
@ -135,6 +137,8 @@ public:
|
|||
std::string name;
|
||||
|
||||
File ( const std::string& _name );
|
||||
|
||||
void ProcessXML();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -10,10 +10,15 @@ void IncludeTest::Run()
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue