[ros-diffs] [mpiulachs] 33603: - Removed hard coded bootsector from *Iso module types and express it with rbuild syntax. - Enabled installname attribute and removed hard coded output file name from *Iso module types. We can now use properties : ReactOS_$(arch).iso > ReactOS_i386.iso

mpiulachs at svn.reactos.org mpiulachs at svn.reactos.org
Mon May 19 22:46:47 CEST 2008


Author: mpiulachs
Date: Mon May 19 15:46:46 2008
New Revision: 33603

URL: http://svn.reactos.org/svn/reactos?rev=33603&view=rev
Log:
- Removed hard coded bootsector from *Iso module types and express it with rbuild syntax. 
- Enabled installname attribute and removed hard coded output file name from *Iso module types. We can now use properties : ReactOS_$(arch).iso > ReactOS_i386.iso

Modified:
    trunk/reactos/boot/bootdata/bootcd/bootcd.rbuild
    trunk/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild
    trunk/reactos/boot/bootdata/livecd/livecd.rbuild
    trunk/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rbuild/module.cpp
    trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/boot/bootdata/bootcd/bootcd.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/bootcd/bootcd.rbuild?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/boot/bootdata/bootcd/bootcd.rbuild [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/bootcd/bootcd.rbuild [iso-8859-1] Mon May 19 15:46:46 2008
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="bootcd" type="iso">
+<module name="bootcd" type="iso" output="ReactOS.iso">
+	<bootsector>isoboot</bootsector>
 </module>

Modified: trunk/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/bootcdregtest/bootcdregtest.rbuild [iso-8859-1] Mon May 19 15:46:46 2008
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="bootcdregtest" type="isoregtest">
+<module name="bootcdregtest" type="isoregtest" output="ReactOS-RegTest.iso">
+	<bootsector>isobtrt</bootsector>
 </module>

Modified: trunk/reactos/boot/bootdata/livecd/livecd.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/livecd/livecd.rbuild?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/boot/bootdata/livecd/livecd.rbuild [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/livecd/livecd.rbuild [iso-8859-1] Mon May 19 15:46:46 2008
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="livecd" type="liveiso">
+<module name="livecd" type="liveiso" output="ReactOS-LiveCD.iso">
+	<bootsector>isoboot</bootsector>
 </module>

Modified: trunk/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/livecdregtest/livecdregtest.rbuild [iso-8859-1] Mon May 19 15:46:46 2008
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="livecdregtest" type="liveisoregtest">
-</module>
+<module name="livecdregtest" type="liveisoregtest" output="ReactOS-LiveCD-RegTest.iso">
+	<bootsector>isobtrt</bootsector>
+</module>

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Mon May 19 15:46:46 2008
@@ -3480,10 +3480,16 @@
 		vSourceFiles.push_back ( srcunattend );
 
 	// bootsector
-	const Module* bootModule;
-	bootModule = module.project.LocateModule ( module.type == IsoRegTest
-	                                               ? "isobtrt"
-	                                               : "isoboot" );
+	const Module* bootModule = module.bootSector->bootSectorModule;
+
+	if (!bootModule)
+	{
+		throw InvalidOperationException ( module.node.location.c_str(),
+										  0,
+										  "Invalid bootsector. module '%s' requires <bootsector>",
+										  module.name.c_str ());
+	}
+
 	const FileLocation *isoboot = bootModule->output;
 	vSourceFiles.push_back ( *isoboot );
 
@@ -3497,13 +3503,11 @@
 
 	vSourceFiles.push_back ( reactosDff );
 
-	string IsoName;
-
-	if (module.type == IsoRegTest)
-		IsoName = "ReactOS-RegTest.iso";
-	else
-		IsoName = "ReactOS.iso";
-
+	/* 
+		We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
+		Iso/LiveIso outputs are generated in code base root 
+	*/
+	string IsoName = module.output->name;
 
 	string sourceFiles = v2s ( backend, vSourceFiles, 5 );
 
@@ -3667,15 +3671,24 @@
 
 	string IsoName;
 
-	const Module* bootModule;
-	bootModule = module.project.LocateModule ( module.name == "livecdregtest"
-	                                               ? "isobtrt"
-	                                               : "isoboot" );
+	// bootsector
+	const Module* bootModule = module.bootSector->bootSectorModule;
+
+	if (!bootModule)
+	{
+		throw InvalidOperationException ( module.node.location.c_str(),
+										  0,
+										  "Invalid bootsector. module '%s' requires <bootsector>",
+										  module.name.c_str ());
+	}
+
 	const FileLocation *isoboot = bootModule->output;
-	if (module.name == "livecdregtest")
-		IsoName = "ReactOS-LiveCD-RegTest.iso";
-	else
-		IsoName = "ReactOS-LiveCD.iso";
+
+	/* 
+		We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
+		Iso/LiveIso outputs are generated in code base root 
+	*/
+	IsoName = module.output->name;
 
 	string reactosDirectory = "reactos";
 	string livecdReactosNoFixup = livecdDirectory + sSep + reactosDirectory;

Modified: trunk/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] Mon May 19 15:46:46 2008
@@ -242,12 +242,15 @@
 	  node (moduleNode),
 	  importLibrary (NULL),
 	  metadata (NULL),
+	  bootSector (NULL),
 	  bootstrap (NULL),
 	  autoRegister(NULL),
 	  linkerScript (NULL),
 	  pch (NULL),
 	  cplusplus (false),
-	  host (HostDefault)
+	  host (HostDefault),
+	  output (NULL),
+	  install (NULL)
 {
 	if ( node.name != "module" )
 		throw InvalidOperationException ( __FILE__,
@@ -417,13 +420,31 @@
 		                            att->value,
 		                            &moduleNode );
 	}
-	else
-	{
-		install = NULL;
+
+	att = moduleNode.GetAttribute ( "output", false );
+	if ( att != NULL )
+	{
+		if (output != NULL)
+		{
+			printf ( "%s: WARNING: 'installname' overrides 'output' also defined for this module.\n",
+				moduleNode.location.c_str() );
+		}
+		else
+		{
+			output = new FileLocation ( GetTargetDirectoryTree (),
+										modulePath,
+										att->value,
+										&moduleNode );
+		}
+	}
+
+	/* If no one has set the output file for this module set it automatically */
+	if (output == NULL)
+	{
 		output = new FileLocation ( GetTargetDirectoryTree (),
-		                            modulePath,
-		                            name + extension,
-		                            &moduleNode );
+									modulePath,
+									name + extension,
+									&moduleNode );
 	}
 
 	att = moduleNode.GetAttribute ( "allowwarnings", false );
@@ -520,6 +541,8 @@
 		delete bootstrap;
 	if ( importLibrary )
 		delete importLibrary;
+	if ( bootSector )
+		delete 	bootSector;
 	if ( dependency )
 		delete 	dependency;
 	if ( autoRegister )
@@ -741,6 +764,17 @@
 				"<dependency> is not a valid sub-element of <if>" );
 		}
 		dependencies.push_back ( new Dependency ( e, *this ) );
+		subs_invalid = true;
+	}
+	else if ( e.name == "bootsector" )
+	{
+		if ( parseContext.ifData )
+		{
+			throw XMLInvalidBuildFileException (
+				e.location,
+				"<bootsector> is not a valid sub-element of <if>" );
+		}
+		bootSector = new Bootsector ( e, this );
 		subs_invalid = true;
 	}
 	else if ( e.name == "importlibrary" )
@@ -1592,6 +1626,57 @@
 	}
 }
 
+Bootsector::Bootsector ( const XMLElement& _node,
+                         const Module* _module )
+	: node (_node),
+	  module (_module),
+	  bootSectorModule (NULL)
+{
+	if ( !IsSupportedModuleType ( module->type ) )
+	{
+		throw XMLInvalidBuildFileException (
+			node.location,
+			"<bootsector> is not applicable for this module type." );
+	}
+
+	bootSectorModule = module->project.LocateModule ( node.value );
+	if ( bootSectorModule == NULL )
+	{
+		throw XMLInvalidBuildFileException (
+			node.location,
+			"module '%s' depend on non-existant module '%s'",
+			module->name.c_str(),
+			node.value.c_str() );
+	}
+
+	if (bootSectorModule->type != BootSector)
+	{
+		throw XMLInvalidBuildFileException (
+			node.location,
+			"module '%s' is referencing non BootSector module '%s'",
+			module->name.c_str(),
+			node.value.c_str() );
+	}
+}
+
+void
+Bootsector::ProcessXML()
+{
+}
+
+bool
+Bootsector::IsSupportedModuleType ( ModuleType type )
+{
+	if ( type == Iso ||
+	     type == LiveIso ||
+ 	     type == IsoRegTest ||
+		 type == LiveIsoRegTest )
+	{
+		return true;
+	}
+
+	return false;
+}
 
 Metadata::Metadata ( const XMLElement& _node,
                      const Module& _module )

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=33603&r1=33602&r2=33603&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Mon May 19 15:46:46 2008
@@ -102,6 +102,7 @@
 
 class SourceFileTest;
 class Metadata;
+class Bootsector;
 
 typedef std::map<std::string,Directory*> directory_map;
 
@@ -352,6 +353,7 @@
 	ModuleType type;
 	ImportLibrary* importLibrary;
 	Metadata* metadata;
+	Bootsector* bootSector;
 	bool mangledSymbols;
 	bool underscoreSymbols;
 	bool isUnicode;
@@ -546,6 +548,21 @@
 	             const Module& _module );
 
 	void ProcessXML();
+};
+
+class Bootsector
+{
+public:
+	const XMLElement& node;
+	const Module* module;
+	const Module* bootSectorModule;
+
+	Bootsector ( const XMLElement& _node,
+	             const Module* _module );
+
+	void ProcessXML();
+private:
+	bool IsSupportedModuleType ( ModuleType type );
 };
 
 class Metadata



More information about the Ros-diffs mailing list