Option to disable automatic dependencies

svn path=/branches/xmlbuildsystem/; revision=15413
This commit is contained in:
Casper Hornstrup 2005-05-19 19:53:01 +00:00
parent 2342aee312
commit 083a71c9f2
11 changed files with 72 additions and 52 deletions

View file

@ -34,8 +34,7 @@ Backend::Factory::~Factory ()
/*static*/ Backend* /*static*/ Backend*
Backend::Factory::Create ( const string& name, Backend::Factory::Create ( const string& name,
Project& project, Project& project,
bool verbose, Configuration& configuration )
bool cleanAsYouGo )
{ {
string sname ( name ); string sname ( name );
strlwr ( &sname[0] ); strlwr ( &sname[0] );
@ -49,14 +48,12 @@ Backend::Factory::Create ( const string& name,
throw UnknownBackendException ( sname ); throw UnknownBackendException ( sname );
return NULL; return NULL;
} }
return (*f) ( project, verbose, cleanAsYouGo ); return (*f) ( project, configuration );
} }
Backend::Backend ( Project& project, Backend::Backend ( Project& project,
bool verbose, Configuration& configuration )
bool cleanAsYouGo )
: ProjectNode ( project ), : ProjectNode ( project ),
verbose ( verbose ), configuration ( configuration )
cleanAsYouGo ( cleanAsYouGo )
{ {
} }

View file

@ -6,7 +6,7 @@
class Backend; class Backend;
typedef Backend* BackendFactory ( Project& project, typedef Backend* BackendFactory ( Project& project,
bool verbose ); Configuration& configuration );
class Backend class Backend
{ {
@ -22,26 +22,22 @@ public:
virtual ~Factory(); virtual ~Factory();
virtual Backend* operator() ( Project&, virtual Backend* operator() ( Project&,
bool verbose, Configuration& configuration ) = 0;
bool cleanAsYouGo ) = 0;
public: public:
static Backend* Create ( const std::string& name, static Backend* Create ( const std::string& name,
Project& project, Project& project,
bool verbose, Configuration& configuration );
bool cleanAsYouGo );
}; };
protected: protected:
Backend ( Project& project, Backend ( Project& project,
bool verbose, Configuration& configuration );
bool cleanAsYouGo );
public: public:
virtual void Process () = 0; virtual void Process () = 0;
Project& ProjectNode; Project& ProjectNode;
bool verbose; Configuration& configuration;
bool cleanAsYouGo;
}; };
#endif /* __BACKEND_H */ #endif /* __BACKEND_H */

View file

@ -35,18 +35,16 @@ static class DevCppFactory : public Backend::Factory
DevCppFactory() : Factory("devcpp") {} DevCppFactory() : Factory("devcpp") {}
Backend *operator() (Project &project, Backend *operator() (Project &project,
bool verbose, Configuration& configuration)
bool cleanAsYouGo)
{ {
return new DevCppBackend(project, verbose, cleanAsYouGo); return new DevCppBackend(project, configuration);
} }
} factory; } factory;
DevCppBackend::DevCppBackend(Project &project, DevCppBackend::DevCppBackend(Project &project,
bool verbose, Configuration& configuration) : Backend(project, configuration)
bool cleanAsYouGo) : Backend(project, verbose, cleanAsYouGo)
{ {
m_unitCount = 0; m_unitCount = 0;
} }
@ -113,8 +111,7 @@ void DevCppBackend::Process()
Backend *backend = Backend::Factory::Create("mingw", Backend *backend = Backend::Factory::Create("mingw",
ProjectNode, ProjectNode,
verbose, configuration );
cleanAsYouGo );
backend->Process(); backend->Process();
delete backend; delete backend;

View file

@ -20,8 +20,7 @@ class DevCppBackend : public Backend
public: public:
DevCppBackend(Project &project, DevCppBackend(Project &project,
bool verbose, Configuration& configuration);
bool cleanAsYouGo);
virtual ~DevCppBackend() {} virtual ~DevCppBackend() {}
virtual void Process(); virtual void Process();

View file

@ -212,20 +212,17 @@ static class MingwFactory : public Backend::Factory
public: public:
MingwFactory() : Factory ( "mingw" ) {} MingwFactory() : Factory ( "mingw" ) {}
Backend* operator() ( Project& project, Backend* operator() ( Project& project,
bool verbose, Configuration& configuration )
bool cleanAsYouGo )
{ {
return new MingwBackend ( project, return new MingwBackend ( project,
verbose, configuration );
cleanAsYouGo );
} }
} factory; } factory;
MingwBackend::MingwBackend ( Project& project, MingwBackend::MingwBackend ( Project& project,
bool verbose, Configuration& configuration )
bool cleanAsYouGo ) : Backend ( project, configuration ),
: Backend ( project, verbose, cleanAsYouGo ),
intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ), intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),
outputDirectory ( new Directory ( "$(OUTPUT)" ) ), outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
installDirectory ( new Directory ( "$(INSTALL)" ) ) installDirectory ( new Directory ( "$(INSTALL)" ) )
@ -622,7 +619,7 @@ MingwBackend::UnpackWineResources ()
printf ( "Unpacking WINE resources..." ); printf ( "Unpacking WINE resources..." );
WineResource wineResource ( ProjectNode, WineResource wineResource ( ProjectNode,
GetBin2ResExecutable () ); GetBin2ResExecutable () );
wineResource.UnpackResources ( verbose ); wineResource.UnpackResources ( configuration.Verbose );
printf ( "done\n" ); printf ( "done\n" );
} }
@ -631,7 +628,7 @@ MingwBackend::GenerateTestSupportCode ()
{ {
printf ( "Generating test support code..." ); printf ( "Generating test support code..." );
TestSupportCode testSupportCode ( ProjectNode ); TestSupportCode testSupportCode ( ProjectNode );
testSupportCode.GenerateTestSupportCode ( verbose ); testSupportCode.GenerateTestSupportCode ( configuration.Verbose );
printf ( "done\n" ); printf ( "done\n" );
} }
@ -640,18 +637,21 @@ MingwBackend::GenerateProxyMakefiles ()
{ {
printf ( "Generating proxy makefiles..." ); printf ( "Generating proxy makefiles..." );
ProxyMakefile proxyMakefile ( ProjectNode ); ProxyMakefile proxyMakefile ( ProjectNode );
proxyMakefile.GenerateProxyMakefiles ( verbose ); proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose );
printf ( "done\n" ); printf ( "done\n" );
} }
void void
MingwBackend::CheckAutomaticDependencies () MingwBackend::CheckAutomaticDependencies ()
{ {
printf ( "Checking automatic dependencies..." ); if ( configuration.AutomaticDependencies )
AutomaticDependency automaticDependency ( ProjectNode ); {
automaticDependency.Process (); printf ( "Checking automatic dependencies..." );
automaticDependency.CheckAutomaticDependencies ( verbose ); AutomaticDependency automaticDependency ( ProjectNode );
printf ( "done\n" ); automaticDependency.Process ();
automaticDependency.CheckAutomaticDependencies ( configuration.Verbose );
printf ( "done\n" );
}
} }
bool bool
@ -667,9 +667,9 @@ void
MingwBackend::GenerateDirectories () MingwBackend::GenerateDirectories ()
{ {
printf ( "Creating directories..." ); printf ( "Creating directories..." );
intermediateDirectory->GenerateTree ( "", verbose ); intermediateDirectory->GenerateTree ( "", configuration.Verbose );
outputDirectory->GenerateTree ( "", verbose ); outputDirectory->GenerateTree ( "", configuration.Verbose );
installDirectory->GenerateTree ( "", verbose ); installDirectory->GenerateTree ( "", configuration.Verbose );
printf ( "done\n" ); printf ( "done\n" );
} }

View file

@ -46,8 +46,7 @@ class MingwBackend : public Backend
{ {
public: public:
MingwBackend ( Project& project, MingwBackend ( Project& project,
bool verbose, Configuration& configuration );
bool cleanAsYouGo );
virtual ~MingwBackend (); virtual ~MingwBackend ();
virtual void Process (); virtual void Process ();
std::string AddDirectoryTarget ( const std::string& directory, std::string AddDirectoryTarget ( const std::string& directory,

View file

@ -1280,7 +1280,7 @@ MingwModuleHandler::GetObjectsVector ( const IfableData& data,
void void
MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
{ {
if ( backend->cleanAsYouGo ) if ( backend->configuration.CleanAsYouGo )
{ {
vector<string> objectFiles; vector<string> objectFiles;
GetObjectsVector ( module.non_if_data, GetObjectsVector ( module.non_if_data,

View file

@ -0,0 +1,15 @@
#include "pch.h"
#include <assert.h>
#include "rbuild.h"
Configuration::Configuration ()
{
Verbose = false;
CleanAsYouGo = false;
AutomaticDependencies = true;
}
Configuration::~Configuration ()
{
}

View file

@ -18,8 +18,7 @@ using std::vector;
static string BuildSystem; static string BuildSystem;
static string RootXmlFile = "ReactOS.xml"; static string RootXmlFile = "ReactOS.xml";
static bool Verbose = false; static Configuration configuration;
static bool CleanAsYouGo = false;
bool bool
ParseSwitch ( int argc, char** argv, int index ) ParseSwitch ( int argc, char** argv, int index )
@ -28,10 +27,13 @@ ParseSwitch ( int argc, char** argv, int index )
switch ( switchChar ) switch ( switchChar )
{ {
case 'v': case 'v':
Verbose = true; configuration.Verbose = true;
break; break;
case 'c': case 'c':
CleanAsYouGo = true; configuration.CleanAsYouGo = true;
break;
case 'd':
configuration.AutomaticDependencies = false;
break; break;
case 'r': case 'r':
RootXmlFile = string(&argv[index][2]); RootXmlFile = string(&argv[index][2]);
@ -74,6 +76,7 @@ main ( int argc, char** argv )
printf ( "Switches:\n" ); printf ( "Switches:\n" );
printf ( " -v Be verbose\n" ); printf ( " -v Be verbose\n" );
printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore\n" ); printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore\n" );
printf ( " -d Disable automatic dependencies.\n" );
printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml\n" ); printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml\n" );
printf ( "\n" ); printf ( "\n" );
printf ( " buildsystem Target build system. Can be one of:\n" ); printf ( " buildsystem Target build system. Can be one of:\n" );
@ -91,8 +94,7 @@ main ( int argc, char** argv )
project.ExecuteInvocations (); project.ExecuteInvocations ();
Backend* backend = Backend::Factory::Create ( BuildSystem, Backend* backend = Backend::Factory::Create ( BuildSystem,
project, project,
Verbose, configuration );
CleanAsYouGo );
backend->Process (); backend->Process ();
delete backend; delete backend;

View file

@ -68,6 +68,16 @@ class StubbedSymbol;
class SourceFileTest; class SourceFileTest;
class Configuration
{
public:
Configuration ();
~Configuration ();
bool Verbose;
bool CleanAsYouGo;
bool AutomaticDependencies;
};
class Environment class Environment
{ {
public: public:

View file

@ -115,6 +115,7 @@ RBUILD_COMMON_SOURCES = \
bootstrap.cpp \ bootstrap.cpp \
cdfile.cpp \ cdfile.cpp \
compilerflag.cpp \ compilerflag.cpp \
configuration.cpp \
define.cpp \ define.cpp \
exception.cpp \ exception.cpp \
filesupportcode.cpp \ filesupportcode.cpp \
@ -225,6 +226,10 @@ $(RBUILD_INT_)compilerflag.o: $(RBUILD_BASE_)compilerflag.cpp $(RBUILD_HEADERS)
$(ECHO_CC) $(ECHO_CC)
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
$(RBUILD_INT_)configuration.o: $(RBUILD_BASE_)configuration.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
$(ECHO_CC)
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
$(RBUILD_INT_)define.o: $(RBUILD_BASE_)define.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(RBUILD_INT_)define.o: $(RBUILD_BASE_)define.cpp $(RBUILD_HEADERS) | $(RBUILD_INT)
$(ECHO_CC) $(ECHO_CC)
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@