added validation for <directory>'s name attribute

create dk/nkm/lib if it doesn't exist

svn path=/branches/xmlbuildsystem/; revision=13994
This commit is contained in:
Royce Mitchell III
2005-03-13 06:31:38 +00:00
parent c181edef3c
commit 4f130648e1
5 changed files with 49 additions and 18 deletions

View File

@@ -99,16 +99,20 @@ else # mingw32-windows
NUL = NUL
endif
ifneq ($(ROS_INTERMEDIATE),)
$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE)
${nmkdir} $(ROS_INTERMEDIATE)tools
endif
ifneq ($(ROS_INTERMEDIATE),)
$(ROS_INTERMEDIATE):
${nmkdir} $(ROS_INTERMEDIATE)
$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE)
${nmkdir} $@
$(ROS_INTERMEDIATE)dk: $(ROS_INTERMEDIATE)
${nkmdir} $@
$(ROS_INTERMEDIATE)dk$(SEP)nkm: $(ROS_INTERMEDIATE)dk
${nkmdir} $@
endif
$(ROS_INTERMEDIATE)dk$(SEP)nkm$(SEP)lib: $(ROS_INTERMEDIATE)dk$(SEP)nkm
${nmkdir} $@
NTOSKRNL_MC = .$(SEP)ntoskrnl$(SEP)ntoskrnl.mc
KERNEL32_MC = .$(SEP)lib$(SEP)kernel32$(SEP)kernel32.mc
BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h

View File

@@ -179,8 +179,8 @@ Path::RelativeFromWorkingDirectory ( const string& path )
vout.push_back ( vpath[i++] );
// now merge vout into a string again
string out = ".";
for ( i = 0; i < vout.size(); i++ )
string out = vout[0];
for ( i = 1; i < vout.size(); i++ )
{
out += "/" + vout[i];
}

View File

@@ -19,6 +19,25 @@ FixSeparator ( const string& s )
return s2;
}
string
GetSubPath (
const string& location,
const string& path,
const string& att_value )
{
if ( !att_value.size() )
throw InvalidBuildFileException (
location,
"<directory> tag has empty 'name' attribute" );
if ( strpbrk ( att_value.c_str (), "/\\?*:<>|" ) )
throw InvalidBuildFileException (
location,
"<directory> tag has invalid characters in 'name' attribute" );
if ( !path.size() )
return att_value;
return FixSeparator(path + CSEP + att_value);
}
string
GetExtension ( const string& filename )
{
@@ -252,7 +271,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
assert(att);
subpath = FixSeparator ( path + CSEP + att->value );
subpath = GetSubPath ( e.location, path, att->value );
}
else if ( e.name == "include" )
{
@@ -508,10 +527,10 @@ Module::GetDependencyPath () const
{
if ( HasImportLibrary () )
{
return ssprintf ( "dk%snkm%slib%slib%s.a",
SSEP,
SSEP,
SSEP,
return ssprintf ( "dk%cnkm%clib%clib%s.a",
CSEP,
CSEP,
CSEP,
name.c_str () );
}
else

View File

@@ -182,7 +182,8 @@ Project::ReadXml ()
if ( head->subElements[i]->name == "project" )
{
node = head->subElements[i];
this->ProcessXML ( "." );
string path;
this->ProcessXML ( path );
return;
}
}
@@ -254,7 +255,7 @@ Project::ProcessXMLSubElement ( const XMLElement& e,
{
const XMLAttribute* att = e.GetAttribute ( "name", true );
assert(att);
subpath = path + CSEP + att->value;
subpath = GetSubPath ( e.location, path, att->value );
}
else if ( e.name == "include" )
{

View File

@@ -6,15 +6,17 @@
#ifdef WIN32
#include <direct.h>
#include <io.h>
#endif
#endif/*WIN32*/
#include <sys/stat.h>
#include <time.h>
#ifdef _MSC_VER
#include <sys/utime.h>
#else
#else/*_MSC_VER*/
#include <utime.h>
#ifdef WIN32
#include <process.h>
#endif
#endif/*WIN32*/
#endif/*_MSC_VER*/
#include "ssprintf.h"
#include "exception.h"
@@ -524,10 +526,15 @@ public:
void ProcessXML();
};
extern std::string
FixSeparator ( const std::string& s );
extern std::string
GetSubPath (
const std::string& location,
const std::string& path,
const std::string& att_value );
extern std::string
GetExtension ( const std::string& filename );