mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:52:58 +00:00
Handle modules.
svn path=/branches/xmlbuildsystem/; revision=12836
This commit is contained in:
parent
b9bffbca54
commit
222bde955c
10 changed files with 120 additions and 16 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "../Rbuild.h"
|
||||
#include "backend.h"
|
||||
|
||||
Backend::Backend ( Project& project ) : ProjectNode(project)
|
||||
Backend::Backend ( Project& project )
|
||||
: ProjectNode ( project )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
class Backend
|
||||
{
|
||||
public:
|
||||
Backend ( Project& );
|
||||
Backend ( Project& project );
|
||||
virtual void Process () = 0;
|
||||
protected:
|
||||
Project& ProjectNode;
|
||||
};
|
||||
|
|
|
@ -3,7 +3,39 @@
|
|||
|
||||
#include "mingw.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
MingwBackend::MingwBackend ( Project& project )
|
||||
: Backend ( project )
|
||||
{
|
||||
}
|
||||
|
||||
void MingwBackend::Process ()
|
||||
{
|
||||
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
|
||||
{
|
||||
Module& module = *ProjectNode.modules[i];
|
||||
ProcessModule ( module );
|
||||
}
|
||||
}
|
||||
|
||||
void MingwBackend::ProcessModule ( Module& module )
|
||||
{
|
||||
MingwModuleHandlerList moduleHandlers;
|
||||
GetModuleHandlers ( moduleHandlers );
|
||||
for (size_t i = 0; i < moduleHandlers.size(); i++)
|
||||
{
|
||||
MingwModuleHandler& moduleHandler = *moduleHandlers[i];
|
||||
if (moduleHandler.CanHandleModule ( module ) )
|
||||
{
|
||||
moduleHandler.Process ( module );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers )
|
||||
{
|
||||
moduleHandlers.push_back ( new MingwKernelModuleHandler () );
|
||||
}
|
||||
|
|
|
@ -2,11 +2,29 @@
|
|||
#define MINGW_H
|
||||
|
||||
#include "../backend.h"
|
||||
#include "modulehandler.h"
|
||||
|
||||
class MingwModuleHandlerList : public std::vector<MingwModuleHandler*>
|
||||
{
|
||||
public:
|
||||
~MingwModuleHandlerList()
|
||||
{
|
||||
for ( size_t i = 0; i < size(); i++ )
|
||||
{
|
||||
delete (*this)[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class MingwBackend : public Backend
|
||||
{
|
||||
public:
|
||||
MingwBackend ( Project& );
|
||||
MingwBackend ( Project& project );
|
||||
virtual void Process ();
|
||||
private:
|
||||
void ProcessModule ( Module& module );
|
||||
void GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers );
|
||||
};
|
||||
|
||||
#endif /* MINGW_H */
|
||||
|
|
24
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Normal file
24
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
#include "../../pch.h"
|
||||
|
||||
#include "../../rbuild.h"
|
||||
#include "mingw.h"
|
||||
#include "modulehandler.h"
|
||||
|
||||
MingwModuleHandler::MingwModuleHandler ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MingwKernelModuleHandler::MingwKernelModuleHandler ()
|
||||
{
|
||||
}
|
||||
|
||||
bool MingwKernelModuleHandler::CanHandleModule ( Module& module )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void MingwKernelModuleHandler::Process ( Module& module )
|
||||
{
|
||||
}
|
23
reactos/tools/rbuild/backend/mingw/modulehandler.h
Normal file
23
reactos/tools/rbuild/backend/mingw/modulehandler.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef MINGW_MODULEHANDLER_H
|
||||
#define MINGW_MODULEHANDLER_H
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
class MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwModuleHandler ();
|
||||
virtual bool CanHandleModule ( Module& module ) = 0;
|
||||
virtual void Process ( Module& module ) = 0;
|
||||
};
|
||||
|
||||
|
||||
class MingwKernelModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwKernelModuleHandler ();
|
||||
virtual bool CanHandleModule ( Module& module );
|
||||
virtual void Process ( Module& module );
|
||||
};
|
||||
|
||||
#endif /* MINGW_MODULEHANDLER_H */
|
|
@ -5,7 +5,8 @@ TARGET = rbuild$(EXE_POSTFIX)
|
|||
all: $(TARGET)
|
||||
|
||||
BACKEND_MINGW_BASE_OBJECTS = \
|
||||
backend/mingw/mingw.cpp
|
||||
backend/mingw/mingw.cpp \
|
||||
backend/mingw/modulehandler.cpp
|
||||
|
||||
BACKEND_BASE_OBJECTS = \
|
||||
$(BACKEND_MINGW_BASE_OBJECTS) \
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "rbuild.h"
|
||||
#include "backend/backend.h"
|
||||
#include "backend/mingw/mingw.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
@ -18,8 +20,9 @@ main ( int argc, char** argv )
|
|||
try
|
||||
{
|
||||
string projectFilename ( "ReactOS.xml" );
|
||||
Project project ( projectFilename );
|
||||
project.GenerateOutput();
|
||||
Project project = Project ( projectFilename );
|
||||
Backend* backend = new MingwBackend ( project );
|
||||
backend->Process ();
|
||||
|
||||
// REM TODO FIXME actually do something with Project object...
|
||||
#if 0
|
||||
|
|
|
@ -20,7 +20,8 @@ public:
|
|||
Project ();
|
||||
Project ( const std::string& filename );
|
||||
~Project ();
|
||||
void ProcessXML ( const XMLElement& e, const std::string& path );
|
||||
void ProcessXML ( const XMLElement& e,
|
||||
const std::string& path );
|
||||
bool GenerateOutput();
|
||||
private:
|
||||
void ReadXml ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue