[ros-diffs] [cfinck] 28526: rbuild enhancements by Marc Piulachs (marc DOT piulachs AT codexchange DOT net): - Provided an unifed way to resolve path macros ($Output) , ($Intermediate) , ($CDOUTPUT) and ($INSTALL) - Removed some redundant code and place it in a global function - Modify media/inf/inf.rbuild to point to the correct location of the autogenerated syssetup.inf in ($Ouput) folder - Other minor enhancements and modifications See issue #2567 for more details.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Fri Aug 24 23:31:37 CEST 2007


Author: cfinck
Date: Sat Aug 25 01:31:37 2007
New Revision: 28526

URL: http://svn.reactos.org/svn/reactos?rev=28526&view=rev
Log:
rbuild enhancements by Marc Piulachs (marc DOT piulachs AT codexchange DOT net):
- Provided an unifed way to resolve path macros ($Output) , ($Intermediate) , ($CDOUTPUT) and ($INSTALL)
- Removed some redundant code and place it in a global function 
- Modify media/inf/inf.rbuild to point to the correct location of the autogenerated syssetup.inf in ($Ouput) folder
- Other minor enhancements and modifications


See issue #2567 for more details.

Modified:
    trunk/reactos/media/inf/inf.rbuild
    trunk/reactos/tools/rbuild/automaticdependency.cpp
    trunk/reactos/tools/rbuild/bootstrap.cpp
    trunk/reactos/tools/rbuild/cdfile.cpp
    trunk/reactos/tools/rbuild/directory.cpp
    trunk/reactos/tools/rbuild/installfile.cpp
    trunk/reactos/tools/rbuild/module.cpp
    trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/media/inf/inf.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/inf.rbuild?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/media/inf/inf.rbuild (original)
+++ trunk/reactos/media/inf/inf.rbuild Sat Aug 25 01:31:37 2007
@@ -1,21 +1,23 @@
 <group>
-<installfile base="inf">acpi.inf</installfile>
-<installfile base="inf">cdrom.inf</installfile>
-<installfile base="inf">display.inf</installfile>
-<installfile base="inf">hdc.inf</installfile>
-<installfile base="inf">keyboard.inf</installfile>
-<installfile base="inf">layout.inf</installfile>
-<installfile base="inf">machine.inf</installfile>
-<installfile base="inf">msmouse.inf</installfile>
-<installfile base="inf">NET_NIC.inf</installfile>
-<installfile base="inf">netamd.inf</installfile>
-<installfile base="inf">netisa.inf</installfile>
-<installfile base="inf">netrtpnt.inf</installfile>
-<installfile base="inf">nettcpip.inf</installfile>
-<installfile base="inf">ports.inf</installfile>
-<installfile base="inf">scsi.inf</installfile>
-<installfile base="inf" root="output">syssetup.inf</installfile>
-<installfile base="inf">usbport.inf</installfile>
-<installfile base="inf">usbstor.inf</installfile>
-<installfile base="inf">xboxdisp.inf</installfile>
-<group>
+	<installfile base="inf">acpi.inf</installfile>
+	<installfile base="inf">cdrom.inf</installfile>
+	<installfile base="inf">display.inf</installfile>
+	<installfile base="inf">hdc.inf</installfile>
+	<installfile base="inf">keyboard.inf</installfile>
+	<installfile base="inf">layout.inf</installfile>
+	<installfile base="inf">machine.inf</installfile>
+	<installfile base="inf">msmouse.inf</installfile>
+	<installfile base="inf">NET_NIC.inf</installfile>
+	<installfile base="inf">netamd.inf</installfile>
+	<installfile base="inf">netisa.inf</installfile>
+	<installfile base="inf">netrtpnt.inf</installfile>
+	<installfile base="inf">nettcpip.inf</installfile>
+	<installfile base="inf">ports.inf</installfile>
+	<installfile base="inf">scsi.inf</installfile>
+	<installfile base="inf">usbport.inf</installfile>
+	<installfile base="inf">usbstor.inf</installfile>
+	<installfile base="inf">xboxdisp.inf</installfile>
+
+	<!-- Don't change this , rbuild places the generated file there-->
+	<installfile base="inf" base="$(OUTPUT)">syssetup.inf</installfile> 
+</group>

Modified: trunk/reactos/tools/rbuild/automaticdependency.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/automaticdependency.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/automaticdependency.cpp (original)
+++ trunk/reactos/tools/rbuild/automaticdependency.cpp Sat Aug 25 01:31:37 2007
@@ -354,6 +354,7 @@
 		return path;
 }
 
+/*
 string
 AutomaticDependency::ResolveVariablesInPath ( const string& path )
 {
@@ -362,6 +363,7 @@
 	s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s );
 	return s;
 }
+*/
 
 bool
 AutomaticDependency::LocateIncludedFile ( const string& directory,

Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/bootstrap.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/bootstrap.cpp (original)
+++ trunk/reactos/tools/rbuild/bootstrap.cpp Sat Aug 25 01:31:37 2007
@@ -74,18 +74,6 @@
 	                                  __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 ()
 {

Modified: trunk/reactos/tools/rbuild/cdfile.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/cdfile.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/cdfile.cpp (original)
+++ trunk/reactos/tools/rbuild/cdfile.cpp Sat Aug 25 01:31:37 2007
@@ -22,6 +22,7 @@
 
 using std::string;
 
+/*
 string
 CDFile::ReplaceVariable ( const string& name,
                           const string& value,
@@ -33,6 +34,7 @@
 	else
 		return path;
 }
+*/
 
 CDFile::CDFile ( const Project& project_,
 	             const XMLElement& cdfileNode,
@@ -42,7 +44,7 @@
 {
 	const XMLAttribute* att = node.GetAttribute ( "base", false );
 	if ( att != NULL )
-		base = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value );
+		base = ResolveVariablesInPath ( att->value );
 	else
 		base = "";
 

Modified: trunk/reactos/tools/rbuild/directory.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/directory.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/directory.cpp (original)
+++ trunk/reactos/tools/rbuild/directory.cpp Sat Aug 25 01:31:37 2007
@@ -116,28 +116,6 @@
 	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 )
@@ -152,8 +130,10 @@
 			path = parent + sSep + name;
 		else
 			path = parent;
-		ResolveVariablesInPath ( buf, path );
-		if ( CreateDirectory ( buf ) && verbose )
+		
+		path = ResolveVariablesInPath ( path );
+
+		if ( CreateDirectory ( path ) && verbose )
 			printf ( "Created %s\n", buf );
 	}
 	else

Modified: trunk/reactos/tools/rbuild/installfile.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/installfile.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/installfile.cpp (original)
+++ trunk/reactos/tools/rbuild/installfile.cpp Sat Aug 25 01:31:37 2007
@@ -28,7 +28,22 @@
 	: project ( project_ ),
 	  node ( installfileNode )
 {
-	const XMLAttribute* att = node.GetAttribute ( "base", false );
+}
+
+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 );
 	if ( att != NULL )
 		base = att->value;
 	else
@@ -40,28 +55,6 @@
 	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
@@ -70,7 +63,3 @@
 	return path + sSep + name;
 }
 
-void
-InstallFile::ProcessXML()
-{
-}

Modified: trunk/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Sat Aug 25 01:31:37 2007
@@ -22,6 +22,31 @@
 
 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 )

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=28526&r1=28525&r2=28526&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Sat Aug 25 01:31:37 2007
@@ -119,12 +119,9 @@
 	                  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 );
 };
 
@@ -783,7 +780,7 @@
 	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<std::string, SourceFile*> sourcefile_map;
 };
 
@@ -805,9 +802,6 @@
 private:
 	bool IsSupportedModuleType ( ModuleType type );
 	void Initialize();
-	static std::string ReplaceVariable ( const std::string& name,
-	                                     const std::string& value,
-	                                     std::string path );
 };
 
 
@@ -828,9 +822,6 @@
 	void ProcessXML();
 	std::string GetPath () const;
 private:
-	static std::string ReplaceVariable ( const std::string& name,
-	                                     const std::string& value,
-	                                     std::string path );
 };
 
 
@@ -850,6 +841,7 @@
 	~InstallFile ();
 	void ProcessXML ();
 	std::string GetPath () const;
+private:
 };
 
 
@@ -997,6 +989,14 @@
 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 );
 
 extern std::string




More information about the Ros-diffs mailing list