Add bootstrap tag to specify that files are to be copied to the CD
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
Added: branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/linkerflag.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-03-02 21:24:02 UTC (rev 13797)
@@ -1873,7 +1873,7 @@
 {
 	static string ros_junk ( "$(ROS_TEMPORARY)" );
 	string targetName ( module.GetTargetName () );
-	string target ( FixupTargetFilename (module.GetPath ()) );
+	string target ( FixupTargetFilename ( module.GetPath () ) );
 	string workingDirectory = GetWorkingDirectory ();
 	string junk_tmp = ros_junk + module.name + ".junk.tmp";
 	string objectsMacro = GetObjectsMacro ( module );
@@ -1952,6 +1952,44 @@
 }
 
 void
+MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string bootcdDirectory,
+	                                                     const Module& module ) const
+{
+	for ( size_t i = 0; i < module.project.modules.size (); i++ )
+	{
+		const Module& m = *module.project.modules[i];
+		if ( m.bootstrap != NULL )
+		{
+			string targetFilenameNoFixup = bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd;
+			string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) );
+			fprintf ( fMakefile,
+			          "\t${cp} %s %s\n",
+			          m.GetPath ().c_str (),
+			          targetFilename.c_str () );
+		}
+	}
+}
+
+string
+MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory,
+	                                      const Module& module ) const
+{
+	string directories;
+	for ( size_t i = 0; i < module.project.modules.size (); i++ )
+	{
+		const Module& m = *module.project.modules[i];
+		if ( m.bootstrap != NULL )
+		{
+			string targetDirecctory = bootcdDirectory + SSEP + m.bootstrap->base;
+			if ( directories.size () > 0 )
+				directories += " ";
+			directories += FixupTargetFilename ( targetDirecctory );
+		}
+	}
+	return directories;
+}
+
+void
 MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
 {
 	string bootcdDirectory = "cd";
@@ -1961,6 +1999,8 @@
 	PassThruCacheDirectory ( bootcdReactos + SSEP );
 	string reactosInf = FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" );
 	string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" );
+	string cdDirectories = bootcdReactos + " " + GetCdDirectories ( bootcdDirectory,
+	                                                                module );
 
 	fprintf ( fMakefile, ".PHONY: %s\n\n",
 		      module.name.c_str ());
@@ -1968,7 +2008,7 @@
 	          "%s: all %s %s\n",
 	          module.name.c_str (),
 	          isoboot.c_str (),
-	          bootcdReactos.c_str () );
+	          cdDirectories.c_str () );
 	fprintf ( fMakefile,
 	          "\t${cabman} /C %s /L %s /I\n",
 	          reactosDff.c_str (),
@@ -1981,6 +2021,8 @@
 	fprintf ( fMakefile,
 	          "\t- ${rm} %s\n",
 	          reactosInf.c_str () );
+	OutputBootstrapfileCopyCommands ( bootcdDirectory,
+	                                  module );
 	fprintf ( fMakefile,
 	          "\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n",
 	          isoboot.c_str (),

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.h	2005-03-02 21:24:02 UTC (rev 13797)
@@ -291,6 +291,10 @@
 	virtual void Process ( const Module& module );
 private:
 	void GenerateIsoModuleTarget ( const Module& module );
+	std::string GetCdDirectories ( const std::string bootcdDirectory,
+	                               const Module& module ) const;
+	void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory,
+	                                       const Module& module ) const;
 };
 
 #endif /* MINGW_MODULEHANDLER_H */

Added: branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/bootstrap.cpp	2005-03-02 21:24:02 UTC (rev 13797)
@@ -0,0 +1,74 @@
+#include "pch.h"
+#include <assert.h>
+
+#include "rbuild.h"
+
+using std::string;
+
+Bootstrap::Bootstrap ( const Project& project_,
+	                   const Module* module_,
+	                   const XMLElement& bootstrapNode )
+	: project(project_),
+	  module(module_),
+	  node(bootstrapNode)
+{
+	Initialize();
+}
+
+Bootstrap::~Bootstrap ()
+{
+}
+
+bool
+Bootstrap::IsSupportedModuleType ( ModuleType type )
+{
+	switch ( type )
+	{
+		case Kernel:
+		case KernelModeDLL:
+		case NativeDLL:
+		case NativeCUI:
+		case Win32DLL:
+		case Win32CUI:
+		case Win32GUI:
+		case KernelModeDriver:
+			return true;
+		case BuildTool:
+		case StaticLibrary:
+		case ObjectLibrary:
+		case BootLoader:
+		case BootSector:
+		case Iso:
+			return false;
+	}
+	throw InvalidOperationException ( __FILE__,
+	                                  __LINE__ );
+}
+
+void
+Bootstrap::Initialize ()
+{
+	if ( !IsSupportedModuleType ( module->type ) )
+	{
+		throw InvalidBuildFileException (
+			node.location,
+			"<bootstrap> is not applicable for this module type." );
+	}
+
+	const XMLAttribute* att = node.GetAttribute ( "base", false );
+	if ( att != NULL )
+		base = att->value;
+	else
+		base = "";
+
+	att = node.GetAttribute ( "nameoncd", false );
+	if ( att != NULL )
+		nameoncd = att->value;
+	else
+		nameoncd = module->GetTargetName ();
+}
+
+void
+Bootstrap::ProcessXML()
+{
+}

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/linkerflag.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/linkerflag.cpp	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/linkerflag.cpp	2005-03-02 21:24:02 UTC (rev 13797)
@@ -30,14 +30,14 @@
 }
 
 void
-LinkerFlag::Initialize()
+LinkerFlag::Initialize ()
 {
 }
 
 void
-LinkerFlag::ProcessXML()
+LinkerFlag::ProcessXML ()
 {
-	if (node.value.size () == 0)
+	if ( node.value.size () == 0 )
 	{
 		throw InvalidBuildFileException (
 			node.location,

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
--- branches/xmlbuildsystem/reactos/tools/rbuild/makefile	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile	2005-03-02 21:24:02 UTC (rev 13797)
@@ -21,6 +21,7 @@
 RBUILD_BASE_SOURCES = \
 	$(RBUILD_BACKEND_BASE_SOURCES) \
 	automaticdependency.cpp \
+	bootstrap.cpp \
 	compilerflag.cpp \
 	define.cpp \
 	exception.cpp \

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-03-02 21:24:02 UTC (rev 13797)
@@ -55,7 +55,8 @@
                  const string& modulePath )
 	: project (project),
 	  node (moduleNode),
-	  importLibrary (NULL)
+	  importLibrary (NULL),
+	  bootstrap (NULL)
 {
 	if ( node.name != "module" )
 		throw Exception ( "internal tool error: Module created with non-<module> node" );
@@ -261,6 +262,11 @@
 			e.location,
 			"<property> is not a valid sub-element of <module>" );
 	}
+	else if ( e.name == "bootstrap" )
+	{
+		bootstrap = new Bootstrap ( project, this, e );
+		subs_invalid = true;
+	}
 	if ( subs_invalid && e.subElements.size() > 0 )
 		throw InvalidBuildFileException (
 			e.location,

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-03-02 21:24:02 UTC (rev 13797)
@@ -51,6 +51,7 @@
 class LinkerFlag;
 class Property;
 class AutomaticDependency;
+class Bootstrap;
 
 class SourceFileTest;
 
@@ -127,6 +128,7 @@
 	ModuleType type;
 	ImportLibrary* importLibrary;
 	bool mangledSymbols;
+	Bootstrap* bootstrap;
 	std::vector<File*> files;
 	std::vector<Library*> libraries;
 	std::vector<Include*> includes;
@@ -450,6 +452,26 @@
 };
 
 
+class Bootstrap
+{
+public:
+	const Project& project;
+	const Module* module;
+	const XMLElement& node;
+	std::string base;
+	std::string nameoncd;
+
+	Bootstrap ( const Project& project,
+	            const Module* module,
+	            const XMLElement& bootstrapNode );
+	~Bootstrap ();
+	void ProcessXML();
+private:
+	bool IsSupportedModuleType ( ModuleType type );
+	void Initialize();
+};
+
+
 extern std::string
 FixSeparator ( const std::string& s );
 

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt	2005-03-02 20:35:18 UTC (rev 13796)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt	2005-03-02 21:24:02 UTC (rev 13797)
@@ -123,7 +123,7 @@
 	None.
 
 Elements:
-	define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
+	bootstrap, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.
 
 
 Module types
@@ -143,6 +143,24 @@
 	iso - Builds a bootable CD. The entrypoint, baseaddress, and mangledsymbols module attributes are not applicable for this module type.
 
 
+Bootstrap element
+-----------------
+A bootstrap element specifies that the generated file should be put on the bootable CD as a bootstrap file.
+
+Syntax:
+	<bootstrap base="reactos" nameoncd="halmp.dll" />
+
+Attributes:
+	base - Put file in this directory on the bootable CD. This attribute is optional.
+	nameoncd - Name of file on the bootable CD. This attribute is optional.
+
+Value:
+	None.
+
+Elements:
+	None.
+
+
 Define element
 --------------
 A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.