}\r
}\r
\r
+void\r
+MingwIsoModuleHandler::OutputCdfileCopyCommands ( const string bootcdDirectory,\r
+ const Module& module ) const\r
+{\r
+ for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
+ {\r
+ const CDFile& cdfile = *module.project.cdfiles[i];\r
+ string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd;\r
+ string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) );\r
+ fprintf ( fMakefile,\r
+ "\t${cp} %s %s\n",\r
+ cdfile.GetPath ().c_str (),\r
+ targetFilename.c_str () );\r
+ }\r
+}\r
+\r
string\r
-MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string bootcdDirectory,\r
+ const Module& module ) const\r
{\r
string directories;\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetCdFiles ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string bootcdDirectory,\r
+ const Module& module ) const\r
+{\r
+ string directories;\r
+ for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
+ {\r
+ const CDFile& cdfile = *module.project.cdfiles[i];\r
+ string targetDirecctory = bootcdDirectory + SSEP + cdfile.base;\r
+ if ( directories.size () > 0 )\r
+ directories += " ";\r
+ directories += FixupTargetFilename ( targetDirecctory );\r
+ }\r
+ return directories;\r
+}\r
+\r
+string\r
+MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory,\r
+ const Module& module ) const\r
+{\r
+ string directories = GetBootstrapCdDirectories ( bootcdDirectory,\r
+ module );\r
+ directories += " " + GetNonModuleCdDirectories ( bootcdDirectory,\r
+ module );\r
+ return directories;\r
+}\r
+\r
+string\r
+MingwIsoModuleHandler::GetBootstrapCdFiles ( const string bootcdDirectory,\r
+ const Module& module ) const\r
{\r
- string files;\r
+ string cdfiles;\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
{\r
const Module& m = *module.project.modules[i];\r
if ( m.bootstrap != NULL )\r
{\r
- if ( files.size () > 0 )\r
- files += " ";\r
- files += FixupTargetFilename ( m.GetPath () );\r
+ if ( cdfiles.size () > 0 )\r
+ cdfiles += " ";\r
+ cdfiles += FixupTargetFilename ( m.GetPath () );\r
}\r
}\r
- return files;\r
+ return cdfiles;\r
+}\r
+\r
+string\r
+MingwIsoModuleHandler::GetNonModuleCdFiles ( const string bootcdDirectory,\r
+ const Module& module ) const\r
+{\r
+ string cdfiles;\r
+ for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
+ {\r
+ const CDFile& cdfile = *module.project.cdfiles[i];\r
+ if ( cdfiles.size () > 0 )\r
+ cdfiles += " ";\r
+ cdfiles += NormalizeFilename ( cdfile.GetPath () );\r
+ }\r
+ return cdfiles;\r
+}\r
+\r
+string\r
+MingwIsoModuleHandler::GetCdFiles ( const string bootcdDirectory,\r
+ const Module& module ) const\r
+{\r
+ string cdfiles = GetBootstrapCdFiles ( bootcdDirectory,\r
+ module );\r
+ cdfiles += " " + GetNonModuleCdFiles ( bootcdDirectory,\r
+ module );\r
+ return cdfiles;\r
}\r
\r
void\r
reactosInf.c_str () );\r
OutputBootstrapfileCopyCommands ( bootcdDirectory,\r
module );\r
+ OutputCdfileCopyCommands ( bootcdDirectory,\r
+ module );\r
fprintf ( fMakefile,\r
"\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n",\r
isoboot.c_str (),\r
virtual void Process ( const Module& module );\r
private:\r
void GenerateIsoModuleTarget ( const Module& module );\r
+ std::string GetBootstrapCdDirectories ( const std::string bootcdDirectory,\r
+ const Module& module ) const;\r
+ std::string GetNonModuleCdDirectories ( const std::string bootcdDirectory,\r
+ const Module& module ) const;\r
std::string GetCdDirectories ( const std::string bootcdDirectory,\r
const Module& module ) const;\r
+ std::string GetBootstrapCdFiles ( const std::string bootcdDirectory,\r
+ const Module& module ) const;\r
+ std::string GetNonModuleCdFiles ( const std::string bootcdDirectory,\r
+ const Module& module ) const;\r
std::string GetCdFiles ( const std::string bootcdDirectory,\r
const Module& module ) const;\r
void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory,\r
const Module& module ) const;\r
+ void OutputCdfileCopyCommands ( const std::string bootcdDirectory,\r
+ const Module& module ) const;\r
};\r
\r
#endif /* MINGW_MODULEHANDLER_H */\r
--- /dev/null
+#include "pch.h"\r
+#include <assert.h>\r
+\r
+#include "rbuild.h"\r
+\r
+using std::string;\r
+\r
+CDFile::CDFile ( const Project& project_,\r
+ const XMLElement& cdfileNode,\r
+ const string& path )\r
+ : project ( project_ ),\r
+ node ( cdfileNode )\r
+{\r
+ const XMLAttribute* att = node.GetAttribute ( "base", false );\r
+ if ( att != NULL )\r
+ base = att->value;\r
+ else\r
+ base = "";\r
+\r
+ att = node.GetAttribute ( "nameoncd", false );\r
+ if ( att != NULL )\r
+ nameoncd = att->value;\r
+ else\r
+ nameoncd = node.value;\r
+ name = node.value;\r
+ this->path = path;\r
+}\r
+\r
+CDFile::~CDFile ()\r
+{\r
+}\r
+\r
+string\r
+CDFile::GetPath () const\r
+{\r
+ return path + SSEP + name;\r
+}\r
+\r
+void\r
+CDFile::ProcessXML()\r
+{\r
+}\r
$(RBUILD_BACKEND_BASE_SOURCES) \\r
automaticdependency.cpp \\r
bootstrap.cpp \\r
+ cdfile.cpp \\r
compilerflag.cpp \\r
define.cpp \\r
exception.cpp \\r
tests$(SEP)linkerflagtest.cpp \\r
tests$(SEP)moduletest.cpp \\r
tests$(SEP)projecttest.cpp \\r
- tests$(SEP)sourcefiletest.cpp\r
+ tests$(SEP)sourcefiletest.cpp \\r
+ tests$(SEP)cdfiletest.cpp\r
\r
RBUILD_TEST_SPECIAL_SOURCES = \\r
$(addprefix $(RBUILD_BASE)$(SEP), $(RBUILD_TESTS)) \\r
delete properties[i];\r
for ( i = 0; i < ifs.size (); i++ )\r
delete ifs[i];\r
+ for ( i = 0; i < cdfiles.size (); i++ )\r
+ delete cdfiles[i];\r
delete head;\r
}\r
\r
makefile = att->value;\r
\r
size_t i;\r
- for ( i = 0; i < node->subElements.size(); i++ )\r
+ for ( i = 0; i < node->subElements.size (); i++ )\r
ProcessXMLSubElement ( *node->subElements[i], path );\r
- for ( i = 0; i < modules.size(); i++ )\r
- modules[i]->ProcessXML();\r
- for ( i = 0; i < includes.size(); i++ )\r
- includes[i]->ProcessXML();\r
- for ( i = 0; i < defines.size(); i++ )\r
- defines[i]->ProcessXML();\r
- for ( i = 0; i < linkerFlags.size(); i++ )\r
- linkerFlags[i]->ProcessXML();\r
+ for ( i = 0; i < modules.size (); i++ )\r
+ modules[i]->ProcessXML ();\r
+ for ( i = 0; i < includes.size (); i++ )\r
+ includes[i]->ProcessXML ();\r
+ for ( i = 0; i < defines.size (); i++ )\r
+ defines[i]->ProcessXML ();\r
+ for ( i = 0; i < linkerFlags.size (); i++ )\r
+ linkerFlags[i]->ProcessXML ();\r
for ( i = 0; i < properties.size(); i++ )\r
- properties[i]->ProcessXML();\r
- for ( i = 0; i < ifs.size(); i++ )\r
- ifs[i]->ProcessXML();\r
+ properties[i]->ProcessXML ();\r
+ for ( i = 0; i < ifs.size (); i++ )\r
+ ifs[i]->ProcessXML ();\r
+ for ( i = 0; i < cdfiles.size (); i++ )\r
+ ifs[i]->ProcessXML ();\r
}\r
\r
void\r
Project::ProcessXMLSubElement ( const XMLElement& e,\r
const string& path,\r
- If* pIf /*= NULL*/ )\r
+ If* pIf )\r
{\r
bool subs_invalid = false;\r
string subpath(path);\r
modules.push_back ( module );\r
return; // defer processing until later\r
}\r
+ else if ( e.name == "cdfile" )\r
+ {\r
+ CDFile* cdfile = new CDFile ( *this, e, path );\r
+ cdfiles.push_back ( cdfile );\r
+ subs_invalid = true;\r
+ }\r
else if ( e.name == "directory" )\r
{\r
const XMLAttribute* att = e.GetAttribute ( "name", true );\r
class Property;\r
class AutomaticDependency;\r
class Bootstrap;\r
+class CDFile;\r
\r
class SourceFileTest;\r
\r
std::vector<LinkerFlag*> linkerFlags;\r
std::vector<Property*> properties;\r
std::vector<If*> ifs;\r
+ std::vector<CDFile*> cdfiles;\r
\r
Project ( const std::string& filename );\r
~Project ();\r
};\r
\r
\r
+class CDFile\r
+{\r
+public:\r
+ const Project& project;\r
+ const XMLElement& node;\r
+ std::string name;\r
+ std::string base;\r
+ std::string nameoncd;\r
+ std::string path;\r
+\r
+ CDFile ( const Project& project,\r
+ const XMLElement& bootstrapNode,\r
+ const std::string& path );\r
+ ~CDFile ();\r
+ void ProcessXML();\r
+ std::string GetPath () const;\r
+};\r
+\r
+\r
extern std::string\r
FixSeparator ( const std::string& s );\r
\r
None.\r
\r
\r
+CDFile element\r
+--------------\r
+A cdfile element specifies the name of a file that is to be put on the bootable CD.\r
+\r
+Syntax:\r
+ <cdfile base="reactos" nameoncd="ReadMe.txt">ReadMe.txt</cdfile>\r
+\r
+Attributes:\r
+ base - Put file in this directory on the bootable CD. This attribute is optional.\r
+ nameoncd - Name of file on the bootable CD. This attribute is optional.\r
+\r
+Value:\r
+ Name of file.\r
+\r
+Elements:\r
+ None.\r
+\r
+\r
Define element\r
--------------\r
A define element specifies the name and (optionally) value of a define for the C/C++ compiler and resource compiler.\r
None.\r
\r
Elements:\r
- directory, file, if, property.\r
+ cdfile, directory, file, if, property.\r
\r
\r
File element\r
#include "rbuild.h"\r
#include "backend/mingw/mingw.h"\r
\r
+#define RBUILD_BASE "tools" SSEP "rbuild" SSEP\r
+ \r
class BaseTest\r
{\r
public:\r
\r
};\r
\r
+\r
+class CDFileTest : public BaseTest\r
+{\r
+public:\r
+ void Run ();\r
+};\r
+\r
#endif /* __TEST_H */\r
tests.push_back(new IfTest());\r
tests.push_back(new FunctionTest());\r
tests.push_back(new SourceFileTest());\r
+ tests.push_back(new CDFileTest());\r
}\r
};\r
\r
--- /dev/null
+#include "test.h"\r
+\r
+using std::string;\r
+\r
+void CDFileTest::Run()\r
+{\r
+ string projectFilename ( RBUILD_BASE "tests/data/cdfile.xml" );\r
+ Project project( projectFilename );\r
+ ARE_EQUAL ( 3, project.cdfiles.size () );\r
+\r
+ CDFile& cdfile1 = *project.cdfiles[0];\r
+ ARE_EQUAL("dir1", cdfile1.base);\r
+ ARE_EQUAL("ReadMe1.txt", cdfile1.nameoncd);\r
+\r
+ CDFile& cdfile2 = *project.cdfiles[1];\r
+ ARE_EQUAL("dir2", cdfile2.base);\r
+ ARE_EQUAL("readme2.txt", cdfile2.nameoncd);\r
+\r
+ CDFile& cdfile3 = *project.cdfiles[2];\r
+ //ARE_EQUAL("", cdfile3.base);\r
+ ARE_EQUAL("readme3.txt", cdfile3.nameoncd);\r
+}\r
<?xml version="1.0" ?>\r
<project name="Project" makefile="Makefile">\r
- <directory name="tests">\r
- <directory name="data">\r
- <module name="module1" type="buildtool">\r
- <include base="module1">.</include>\r
- <file>sourcefile1.c</file>\r
- </module>\r
+ <directory name="tools">\r
+ <directory name="rbuild">\r
+ <directory name="tests">\r
+ <directory name="data">\r
+ <module name="module1" type="buildtool">\r
+ <include base="module1">.</include>\r
+ <file>sourcefile1.c</file>\r
+ </module>\r
+ </directory>\r
+ </directory>\r
</directory>\r
</directory>\r
</project>\r
<?xml version="1.0" ?>\r
<project name="Project" makefile="Makefile">\r
- <directory name="tests">\r
- <directory name="data">\r
- <module name="module1" type="buildtool">\r
- <include base="module1">.</include>\r
- <include base="module1">sourcefile1</include>\r
- <file>sourcefile_include.c</file>\r
- </module>\r
+ <directory name="tools">\r
+ <directory name="rbuild">\r
+ <directory name="tests">\r
+ <directory name="data">\r
+ <module name="module1" type="buildtool">\r
+ <include base="module1">.</include>\r
+ <include base="module1">sourcefile1</include>\r
+ <file>sourcefile_include.c</file>\r
+ </module>\r
+ </directory>\r
+ </directory>\r
</directory>\r
</directory>\r
</project>\r
--- /dev/null
+<?xml version="1.0" ?>\r
+<project name="Project" makefile="Makefile">\r
+ <directory name="dir1">\r
+ <cdfile base="dir1" nameoncd="ReadMe1.txt">readme1.txt</cdfile>\r
+ <cdfile base="dir2">readme2.txt</cdfile>\r
+ <cdfile>readme3.txt</cdfile>\r
+ </directory>\r
+</project>\r
\r
void DefineTest::Run()\r
{\r
- string projectFilename ( "tests/data/define.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/define.xml" );\r
Project project ( projectFilename );\r
ARE_EQUAL(1, project.defines.size());\r
Define& define1 = *project.defines[0];\r
\r
void IfTest::Run()\r
{\r
- string projectFilename ( "tests/data/if.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/if.xml" );\r
Project project ( projectFilename );\r
\r
ARE_EQUAL ( 1, project.modules.size () );\r
\r
void IncludeTest::Run()\r
{\r
- string projectFilename ( "tests/data/include.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/include.xml" );\r
Project project ( projectFilename );\r
ARE_EQUAL(1, project.includes.size());\r
Include& include1 = *project.includes[0];\r
\r
void InvokeTest::Run()\r
{\r
- string projectFilename ( "tests/data/invoke.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/invoke.xml" );\r
Project project ( projectFilename );\r
ARE_EQUAL(1, project.modules.size());\r
\r
\r
void LinkerFlagTest::Run()\r
{\r
- string projectFilename ( "tests/data/linkerflag.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/linkerflag.xml" );\r
Project project ( projectFilename );\r
ARE_EQUAL(1, project.linkerFlags.size());\r
LinkerFlag& linkerFlag1 = *project.linkerFlags[0];\r
\r
void ModuleTest::Run()\r
{\r
- string projectFilename ( "tests/data/module.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/module.xml" );\r
Project project ( projectFilename );\r
ARE_EQUAL(2, project.modules.size());\r
\r
\r
void ProjectTest::Run()\r
{\r
- string projectFilename ( "tests/data/project.xml" );\r
+ string projectFilename ( RBUILD_BASE "tests/data/project.xml" );\r
Project project( projectFilename );\r
ARE_EQUAL(2, project.modules.size());\r
}\r
void\r
SourceFileTest::IncludeTest ()\r
{\r
- const Project project ( "tests" SSEP "data" SSEP "automaticdependency_include.xml" );\r
+ const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency_include.xml" );\r
AutomaticDependency automaticDependency ( project );\r
automaticDependency.Process ();\r
ARE_EQUAL( 4, automaticDependency.sourcefile_map.size () );\r
- const SourceFile* include = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile_include.h" );\r
+ const SourceFile* include = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile_include.h" );\r
IS_NOT_NULL( include );\r
- const SourceFile* includenext = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );\r
+ const SourceFile* includenext = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1" SSEP "sourcefile_includenext.h" );\r
IS_NOT_NULL( includenext );\r
}\r
\r
void\r
SourceFileTest::FullParseTest ()\r
{\r
- const Project project ( "tests" SSEP "data" SSEP "automaticdependency.xml" );\r
+ const Project project ( RBUILD_BASE "tests" SSEP "data" SSEP "automaticdependency.xml" );\r
AutomaticDependency automaticDependency ( project );\r
automaticDependency.Process ();\r
ARE_EQUAL( 5, automaticDependency.sourcefile_map.size () );\r
- const SourceFile* header1 = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1_header1.h" );\r
+ const SourceFile* header1 = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE "tests" SSEP "data" SSEP "sourcefile1_header1.h" );\r
IS_NOT_NULL( header1 );\r
- const SourceFile* recurse = automaticDependency.RetrieveFromCache ( "." SSEP "tests" SSEP "data" SSEP "sourcefile1_recurse.h" );\r
+ const SourceFile* recurse = automaticDependency.RetrieveFromCache ( "." SSEP RBUILD_BASE"tests" SSEP "data" SSEP "sourcefile1_recurse.h" );\r
IS_NOT_NULL( recurse );\r
IS_TRUE( IsParentOf ( header1,\r
recurse ) );\r