Add bootstrap tag to specify that files are to be copied to the CD

svn path=/branches/xmlbuildsystem/; revision=13797
This commit is contained in:
Casper Hornstrup 2005-03-02 21:24:02 +00:00
parent 633526eb0b
commit 7f24916383
8 changed files with 174 additions and 7 deletions

View file

@ -1873,7 +1873,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& mod
{
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 );
@ -1951,6 +1951,44 @@ MingwIsoModuleHandler::Process ( const Module& module )
GenerateInvocations ( module );
}
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 )
{
@ -1961,6 +1999,8 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
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 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
"%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 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
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 (),

View file

@ -291,6 +291,10 @@ public:
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 */

View file

@ -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()
{
}

View file

@ -30,14 +30,14 @@ LinkerFlag::~LinkerFlag ()
}
void
LinkerFlag::Initialize()
LinkerFlag::Initialize ()
{
}
void
LinkerFlag::ProcessXML()
LinkerFlag::ProcessXML ()
{
if (node.value.size () == 0)
if ( node.value.size () == 0 )
{
throw InvalidBuildFileException (
node.location,

View file

@ -21,6 +21,7 @@ RBUILD_BACKEND_BASE_SOURCES = \
RBUILD_BASE_SOURCES = \
$(RBUILD_BACKEND_BASE_SOURCES) \
automaticdependency.cpp \
bootstrap.cpp \
compilerflag.cpp \
define.cpp \
exception.cpp \

View file

@ -55,7 +55,8 @@ Module::Module ( const Project& project,
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 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
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,

View file

@ -51,6 +51,7 @@ class CompilerFlag;
class LinkerFlag;
class Property;
class AutomaticDependency;
class Bootstrap;
class SourceFileTest;
@ -127,6 +128,7 @@ public:
ModuleType type;
ImportLibrary* importLibrary;
bool mangledSymbols;
Bootstrap* bootstrap;
std::vector<File*> files;
std::vector<Library*> libraries;
std::vector<Include*> includes;
@ -450,6 +452,26 @@ private:
};
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 );

View file

@ -123,7 +123,7 @@ Value:
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 @@ The module type determines the actions that is to be carried out to process the
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.