mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 17:35:07 +00:00
rbuild enhancements by Marc Piulachs (marc DOT piulachs AT codexchange DOT net):
- Provided an unifed way to resolve path macros ($Output) , ($Intermediate) , ($CDOUTPUT) and ($INSTALL) - Removed some redundant code and place it in a global function - Modify media/inf/inf.rbuild to point to the correct location of the autogenerated syssetup.inf in ($Ouput) folder - Other minor enhancements and modifications See issue #2567 for more details. svn path=/trunk/; revision=28526
This commit is contained in:
parent
ef684f8eac
commit
31995f945e
|
@ -1,21 +1,23 @@
|
|||
<group>
|
||||
<installfile base="inf">acpi.inf</installfile>
|
||||
<installfile base="inf">cdrom.inf</installfile>
|
||||
<installfile base="inf">display.inf</installfile>
|
||||
<installfile base="inf">hdc.inf</installfile>
|
||||
<installfile base="inf">keyboard.inf</installfile>
|
||||
<installfile base="inf">layout.inf</installfile>
|
||||
<installfile base="inf">machine.inf</installfile>
|
||||
<installfile base="inf">msmouse.inf</installfile>
|
||||
<installfile base="inf">NET_NIC.inf</installfile>
|
||||
<installfile base="inf">netamd.inf</installfile>
|
||||
<installfile base="inf">netisa.inf</installfile>
|
||||
<installfile base="inf">netrtpnt.inf</installfile>
|
||||
<installfile base="inf">nettcpip.inf</installfile>
|
||||
<installfile base="inf">ports.inf</installfile>
|
||||
<installfile base="inf">scsi.inf</installfile>
|
||||
<installfile base="inf" root="output">syssetup.inf</installfile>
|
||||
<installfile base="inf">usbport.inf</installfile>
|
||||
<installfile base="inf">usbstor.inf</installfile>
|
||||
<installfile base="inf">xboxdisp.inf</installfile>
|
||||
<group>
|
||||
<installfile base="inf">acpi.inf</installfile>
|
||||
<installfile base="inf">cdrom.inf</installfile>
|
||||
<installfile base="inf">display.inf</installfile>
|
||||
<installfile base="inf">hdc.inf</installfile>
|
||||
<installfile base="inf">keyboard.inf</installfile>
|
||||
<installfile base="inf">layout.inf</installfile>
|
||||
<installfile base="inf">machine.inf</installfile>
|
||||
<installfile base="inf">msmouse.inf</installfile>
|
||||
<installfile base="inf">NET_NIC.inf</installfile>
|
||||
<installfile base="inf">netamd.inf</installfile>
|
||||
<installfile base="inf">netisa.inf</installfile>
|
||||
<installfile base="inf">netrtpnt.inf</installfile>
|
||||
<installfile base="inf">nettcpip.inf</installfile>
|
||||
<installfile base="inf">ports.inf</installfile>
|
||||
<installfile base="inf">scsi.inf</installfile>
|
||||
<installfile base="inf">usbport.inf</installfile>
|
||||
<installfile base="inf">usbstor.inf</installfile>
|
||||
<installfile base="inf">xboxdisp.inf</installfile>
|
||||
|
||||
<!-- Don't change this , rbuild places the generated file there-->
|
||||
<installfile base="inf" base="$(OUTPUT)">syssetup.inf</installfile>
|
||||
</group>
|
||||
|
|
|
@ -354,6 +354,7 @@ AutomaticDependency::ReplaceVariable ( const string& name,
|
|||
return path;
|
||||
}
|
||||
|
||||
/*
|
||||
string
|
||||
AutomaticDependency::ResolveVariablesInPath ( const string& path )
|
||||
{
|
||||
|
@ -362,6 +363,7 @@ AutomaticDependency::ResolveVariablesInPath ( const string& path )
|
|||
s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s );
|
||||
return s;
|
||||
}
|
||||
*/
|
||||
|
||||
bool
|
||||
AutomaticDependency::LocateIncludedFile ( const string& directory,
|
||||
|
|
|
@ -74,18 +74,6 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
|
|||
__LINE__ );
|
||||
}
|
||||
|
||||
string
|
||||
Bootstrap::ReplaceVariable ( const string& name,
|
||||
const string& value,
|
||||
string path )
|
||||
{
|
||||
size_t i = path.find ( name );
|
||||
if ( i != string::npos )
|
||||
return path.replace ( i, name.length (), value );
|
||||
else
|
||||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
Bootstrap::Initialize ()
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
/*
|
||||
string
|
||||
CDFile::ReplaceVariable ( const string& name,
|
||||
const string& value,
|
||||
|
@ -33,6 +34,7 @@ CDFile::ReplaceVariable ( const string& name,
|
|||
else
|
||||
return path;
|
||||
}
|
||||
*/
|
||||
|
||||
CDFile::CDFile ( const Project& project_,
|
||||
const XMLElement& cdfileNode,
|
||||
|
@ -42,7 +44,7 @@ CDFile::CDFile ( const Project& project_,
|
|||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value );
|
||||
base = ResolveVariablesInPath ( att->value );
|
||||
else
|
||||
base = "";
|
||||
|
||||
|
|
|
@ -116,28 +116,6 @@ Directory::CreateDirectory ( string path )
|
|||
return directoryWasCreated;
|
||||
}
|
||||
|
||||
string
|
||||
Directory::ReplaceVariable ( const string& name,
|
||||
const string& value,
|
||||
string path )
|
||||
{
|
||||
size_t i = path.find ( name );
|
||||
if ( i != string::npos )
|
||||
return path.replace ( i, name.length (), value );
|
||||
else
|
||||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
Directory::ResolveVariablesInPath ( char* buf,
|
||||
const string& path )
|
||||
{
|
||||
string s = ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path );
|
||||
s = ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s );
|
||||
s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s );
|
||||
strcpy ( buf, s.c_str () );
|
||||
}
|
||||
|
||||
void
|
||||
Directory::GenerateTree ( const string& parent,
|
||||
bool verbose )
|
||||
|
@ -152,8 +130,10 @@ Directory::GenerateTree ( const string& parent,
|
|||
path = parent + sSep + name;
|
||||
else
|
||||
path = parent;
|
||||
ResolveVariablesInPath ( buf, path );
|
||||
if ( CreateDirectory ( buf ) && verbose )
|
||||
|
||||
path = ResolveVariablesInPath ( path );
|
||||
|
||||
if ( CreateDirectory ( path ) && verbose )
|
||||
printf ( "Created %s\n", buf );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -28,7 +28,22 @@ InstallFile::InstallFile ( const Project& project_,
|
|||
: project ( project_ ),
|
||||
node ( installfileNode )
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "base", false );
|
||||
}
|
||||
|
||||
InstallFile::~InstallFile ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
InstallFile::ProcessXML()
|
||||
{
|
||||
const XMLAttribute* att = node.GetAttribute ( "root", false );
|
||||
if ( att != NULL )
|
||||
this->path = ResolveVariablesInPath ( att->value );
|
||||
else
|
||||
this->path = path;
|
||||
|
||||
att = node.GetAttribute ( "base", false );
|
||||
if ( att != NULL )
|
||||
base = att->value;
|
||||
else
|
||||
|
@ -40,28 +55,6 @@ InstallFile::InstallFile ( const Project& project_,
|
|||
else
|
||||
newname = node.value;
|
||||
name = node.value;
|
||||
|
||||
att = node.GetAttribute ( "root", false );
|
||||
if ( att != NULL)
|
||||
{
|
||||
if ( att->value == "intermediate" )
|
||||
this->path = "$(INTERMEDIATE)" + sSep + path;
|
||||
else if ( att->value == "output" )
|
||||
this->path = "$(OUTPUT)" + sSep + path;
|
||||
else
|
||||
{
|
||||
throw InvalidAttributeValueException (
|
||||
node.location,
|
||||
"root",
|
||||
att->value );
|
||||
}
|
||||
}
|
||||
else
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
InstallFile::~InstallFile ()
|
||||
{
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -70,7 +63,3 @@ InstallFile::GetPath () const
|
|||
return path + sSep + name;
|
||||
}
|
||||
|
||||
void
|
||||
InstallFile::ProcessXML()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -23,6 +23,31 @@
|
|||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
string
|
||||
ResolveVariablesInPath ( const string& path )
|
||||
{
|
||||
string s;
|
||||
|
||||
s = ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path );
|
||||
s = ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s );
|
||||
s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s );
|
||||
s = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), s );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
string
|
||||
ReplaceVariable ( const string& name,
|
||||
const string& value,
|
||||
string path )
|
||||
{
|
||||
size_t i = path.find ( name );
|
||||
if ( i != string::npos )
|
||||
return path.replace ( i, name.length (), value );
|
||||
else
|
||||
return path;
|
||||
}
|
||||
|
||||
string
|
||||
Right ( const string& s, size_t n )
|
||||
{
|
||||
|
|
|
@ -119,12 +119,9 @@ public:
|
|||
const std::string& parent );
|
||||
private:
|
||||
bool mkdir_p ( const char* path );
|
||||
std::string ReplaceVariable ( const std::string& name,
|
||||
const std::string& value,
|
||||
std::string path );
|
||||
std::string GetEnvironmentVariable ( const std::string& name );
|
||||
void ResolveVariablesInPath ( char* buf,
|
||||
const std::string& path );
|
||||
//void ResolveVariablesInPath ( char* buf,
|
||||
// const std::string& path );
|
||||
bool CreateDirectory ( std::string path );
|
||||
};
|
||||
|
||||
|
@ -783,7 +780,7 @@ private:
|
|||
std::string ReplaceVariable ( const std::string& name,
|
||||
const std::string& value,
|
||||
std::string path );
|
||||
std::string ResolveVariablesInPath ( const std::string& path );
|
||||
// std::string ResolveVariablesInPath ( const std::string& path );
|
||||
std::map<std::string, SourceFile*> sourcefile_map;
|
||||
};
|
||||
|
||||
|
@ -805,9 +802,6 @@ public:
|
|||
private:
|
||||
bool IsSupportedModuleType ( ModuleType type );
|
||||
void Initialize();
|
||||
static std::string ReplaceVariable ( const std::string& name,
|
||||
const std::string& value,
|
||||
std::string path );
|
||||
};
|
||||
|
||||
|
||||
|
@ -828,9 +822,6 @@ public:
|
|||
void ProcessXML();
|
||||
std::string GetPath () const;
|
||||
private:
|
||||
static std::string ReplaceVariable ( const std::string& name,
|
||||
const std::string& value,
|
||||
std::string path );
|
||||
};
|
||||
|
||||
|
||||
|
@ -850,6 +841,7 @@ public:
|
|||
~InstallFile ();
|
||||
void ProcessXML ();
|
||||
std::string GetPath () const;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
@ -996,6 +988,14 @@ private:
|
|||
extern void
|
||||
InitializeEnvironment ();
|
||||
|
||||
extern std::string
|
||||
ResolveVariablesInPath ( const std::string& path );
|
||||
|
||||
extern std::string
|
||||
ReplaceVariable ( const std::string& name,
|
||||
const std::string& value,
|
||||
std::string path );
|
||||
|
||||
extern std::string
|
||||
Right ( const std::string& s, size_t n );
|
||||
|
||||
|
|
Loading…
Reference in a new issue