diff --git a/reactos/media/inf/inf.rbuild b/reactos/media/inf/inf.rbuild index 4ebc25226e0..0070d62ec93 100644 --- a/reactos/media/inf/inf.rbuild +++ b/reactos/media/inf/inf.rbuild @@ -1,23 +1,21 @@ - acpi.inf - cdrom.inf - display.inf - hdc.inf - keyboard.inf - layout.inf - machine.inf - msmouse.inf - NET_NIC.inf - netamd.inf - netisa.inf - netrtpnt.inf - nettcpip.inf - ports.inf - scsi.inf - usbport.inf - usbstor.inf - xboxdisp.inf - - - syssetup.inf - +acpi.inf +cdrom.inf +display.inf +hdc.inf +keyboard.inf +layout.inf +machine.inf +msmouse.inf +NET_NIC.inf +netamd.inf +netisa.inf +netrtpnt.inf +nettcpip.inf +ports.inf +scsi.inf +syssetup.inf +usbport.inf +usbstor.inf +xboxdisp.inf + \ No newline at end of file diff --git a/reactos/tools/rbuild/automaticdependency.cpp b/reactos/tools/rbuild/automaticdependency.cpp index b698418c884..17685196916 100644 --- a/reactos/tools/rbuild/automaticdependency.cpp +++ b/reactos/tools/rbuild/automaticdependency.cpp @@ -354,7 +354,6 @@ AutomaticDependency::ReplaceVariable ( const string& name, return path; } -/* string AutomaticDependency::ResolveVariablesInPath ( const string& path ) { @@ -363,7 +362,6 @@ AutomaticDependency::ResolveVariablesInPath ( const string& path ) s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s ); return s; } -*/ bool AutomaticDependency::LocateIncludedFile ( const string& directory, diff --git a/reactos/tools/rbuild/bootstrap.cpp b/reactos/tools/rbuild/bootstrap.cpp index 44d0763bde0..32127a3ab5d 100644 --- a/reactos/tools/rbuild/bootstrap.cpp +++ b/reactos/tools/rbuild/bootstrap.cpp @@ -74,6 +74,18 @@ Bootstrap::IsSupportedModuleType ( ModuleType type ) __LINE__ ); } +string +Bootstrap::ReplaceVariable ( const string& name, + const string& value, + string path ) +{ + size_t i = path.find ( name ); + if ( i != string::npos ) + return path.replace ( i, name.length (), value ); + else + return path; +} + void Bootstrap::Initialize () { diff --git a/reactos/tools/rbuild/cdfile.cpp b/reactos/tools/rbuild/cdfile.cpp index 2944d0765b5..19a3f213dc1 100644 --- a/reactos/tools/rbuild/cdfile.cpp +++ b/reactos/tools/rbuild/cdfile.cpp @@ -22,7 +22,6 @@ using std::string; -/* string CDFile::ReplaceVariable ( const string& name, const string& value, @@ -34,7 +33,6 @@ CDFile::ReplaceVariable ( const string& name, else return path; } -*/ CDFile::CDFile ( const Project& project_, const XMLElement& cdfileNode, @@ -44,7 +42,7 @@ CDFile::CDFile ( const Project& project_, { const XMLAttribute* att = node.GetAttribute ( "base", false ); if ( att != NULL ) - base = ResolveVariablesInPath ( att->value ); + base = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); else base = ""; diff --git a/reactos/tools/rbuild/directory.cpp b/reactos/tools/rbuild/directory.cpp index 257485b7db6..9531348947c 100644 --- a/reactos/tools/rbuild/directory.cpp +++ b/reactos/tools/rbuild/directory.cpp @@ -116,6 +116,28 @@ Directory::CreateDirectory ( string path ) return directoryWasCreated; } +string +Directory::ReplaceVariable ( const string& name, + const string& value, + string path ) +{ + size_t i = path.find ( name ); + if ( i != string::npos ) + return path.replace ( i, name.length (), value ); + else + return path; +} + +void +Directory::ResolveVariablesInPath ( char* buf, + const string& path ) +{ + string s = ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path ); + s = ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s ); + s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s ); + strcpy ( buf, s.c_str () ); +} + void Directory::GenerateTree ( const string& parent, bool verbose ) @@ -130,10 +152,8 @@ Directory::GenerateTree ( const string& parent, path = parent + sSep + name; else path = parent; - - path = ResolveVariablesInPath ( path ); - - if ( CreateDirectory ( path ) && verbose ) + ResolveVariablesInPath ( buf, path ); + if ( CreateDirectory ( buf ) && verbose ) printf ( "Created %s\n", buf ); } else diff --git a/reactos/tools/rbuild/installfile.cpp b/reactos/tools/rbuild/installfile.cpp index 59c781e00d8..538e413a141 100644 --- a/reactos/tools/rbuild/installfile.cpp +++ b/reactos/tools/rbuild/installfile.cpp @@ -28,22 +28,7 @@ InstallFile::InstallFile ( const Project& project_, : project ( project_ ), node ( installfileNode ) { -} - -InstallFile::~InstallFile () -{ -} - -void -InstallFile::ProcessXML() -{ - const XMLAttribute* att = node.GetAttribute ( "root", false ); - if ( att != NULL ) - this->path = ResolveVariablesInPath ( att->value ); - else - this->path = path; - - att = node.GetAttribute ( "base", false ); + const XMLAttribute* att = node.GetAttribute ( "base", false ); if ( att != NULL ) base = att->value; else @@ -55,6 +40,28 @@ InstallFile::ProcessXML() else newname = node.value; name = node.value; + + att = node.GetAttribute ( "root", false ); + if ( att != NULL) + { + if ( att->value == "intermediate" ) + this->path = "$(INTERMEDIATE)" + sSep + path; + else if ( att->value == "output" ) + this->path = "$(OUTPUT)" + sSep + path; + else + { + throw InvalidAttributeValueException ( + node.location, + "root", + att->value ); + } + } + else + this->path = path; +} + +InstallFile::~InstallFile () +{ } string @@ -63,3 +70,7 @@ InstallFile::GetPath () const return path + sSep + name; } +void +InstallFile::ProcessXML() +{ +} diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index bc9aaee211e..910c9ef6e48 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -23,31 +23,6 @@ using std::string; using std::vector; -string -ResolveVariablesInPath ( const string& path ) -{ - string s; - - s = ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path ); - s = ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s ); - s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s ); - s = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), s ); - - return s; -} - -string -ReplaceVariable ( const string& name, - const string& value, - string path ) -{ - size_t i = path.find ( name ); - if ( i != string::npos ) - return path.replace ( i, name.length (), value ); - else - return path; -} - string Right ( const string& s, size_t n ) { diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index f7897833494..19cb51cc742 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -119,9 +119,12 @@ public: const std::string& parent ); private: bool mkdir_p ( const char* path ); + std::string ReplaceVariable ( const std::string& name, + const std::string& value, + std::string path ); std::string GetEnvironmentVariable ( const std::string& name ); - //void ResolveVariablesInPath ( char* buf, - // const std::string& path ); + void ResolveVariablesInPath ( char* buf, + const std::string& path ); bool CreateDirectory ( std::string path ); }; @@ -780,7 +783,7 @@ private: std::string ReplaceVariable ( const std::string& name, const std::string& value, std::string path ); -// std::string ResolveVariablesInPath ( const std::string& path ); + std::string ResolveVariablesInPath ( const std::string& path ); std::map sourcefile_map; }; @@ -802,6 +805,9 @@ public: private: bool IsSupportedModuleType ( ModuleType type ); void Initialize(); + static std::string ReplaceVariable ( const std::string& name, + const std::string& value, + std::string path ); }; @@ -822,6 +828,9 @@ public: void ProcessXML(); std::string GetPath () const; private: + static std::string ReplaceVariable ( const std::string& name, + const std::string& value, + std::string path ); }; @@ -841,7 +850,6 @@ public: ~InstallFile (); void ProcessXML (); std::string GetPath () const; -private: }; @@ -988,14 +996,6 @@ private: extern void InitializeEnvironment (); -extern std::string -ResolveVariablesInPath ( const std::string& path ); - -extern std::string -ReplaceVariable ( const std::string& name, - const std::string& value, - std::string path ); - extern std::string Right ( const std::string& s, size_t n );