store pointer to Backend in the Project class so properties of the Backend object...
authorRoyce Mitchell III <royce3@ev1.net>
Fri, 2 Dec 2005 13:59:35 +0000 (13:59 +0000)
committerRoyce Mitchell III <royce3@ev1.net>
Fri, 2 Dec 2005 13:59:35 +0000 (13:59 +0000)
svn path=/trunk/; revision=19827

reactos/tools/rbuild/project.cpp
reactos/tools/rbuild/rbuild.cpp
reactos/tools/rbuild/rbuild.h

index 4e398fa..be314f8 100644 (file)
@@ -19,6 +19,7 @@
 #include <assert.h>
 
 #include "rbuild.h"
+#include "backend/backend.h"
 
 using std::string;
 using std::vector;
@@ -87,13 +88,15 @@ Project::Project ( const Configuration& configuration,
          node (NULL),
          head (NULL),
          configuration (configuration)
-{  
+{
        ReadXml();
 }
 
 Project::~Project ()
 {
        size_t i;
+       if ( _backend )
+               delete _backend;
        for ( i = 0; i < modules.size (); i++ )
                delete modules[i];
        for ( i = 0; i < linkerFlags.size (); i++ )
index e8f9636..e838e86 100644 (file)
@@ -243,17 +243,19 @@ main ( int argc, char** argv )
        try
        {
                string projectFilename ( RootXmlFile );
+
                printf ( "Reading build files..." );
                Project project ( configuration, projectFilename );
                printf ( "done\n" );
-               project.WriteConfigurationFile ();
-               project.ExecuteInvocations ();
-               Backend* backend = Backend::Factory::Create (
+
+               project.SetBackend ( Backend::Factory::Create (
                        BuildSystem,
                        project,
-                       configuration );
-               backend->Process ();
-               delete backend;
+                       configuration ) );
+
+               project.WriteConfigurationFile ();
+               project.ExecuteInvocations ();
+               project.GetBackend().Process();
 
                return 0;
        }
index e45b206..4cdb08d 100644 (file)
 #endif/*WIN32*/
 #endif/*_MSC_VER*/
 
+#include <infhost.h>
+
 #include "ssprintf.h"
 #include "exception.h"
 #include "xml.h"
-#include <infhost.h>
+
+class Backend; // forward declaration
 
 typedef std::vector<std::string> string_list;
 
@@ -191,6 +194,7 @@ class Project
 {
        std::string xmlfile;
        XMLElement *node, *head;
+       Backend* _backend;
 public:
        const Configuration& configuration;
        std::string name;
@@ -205,8 +209,11 @@ public:
        Project ( const Configuration& configuration,
                  const std::string& filename );
        ~Project ();
+       void SetBackend ( Backend* backend ) { _backend = backend; }
+       Backend& GetBackend() { return *_backend; }
        void WriteConfigurationFile ();
        void ExecuteInvocations ();
+
        void ProcessXML ( const std::string& path );
        Module* LocateModule ( const std::string& name );
        const Module* LocateModule ( const std::string& name ) const;