diff --git a/reactos/hal/halx86/mp/halmp.xml b/reactos/hal/halx86/mp/halmp.xml index 6b2d2e1a354..6d1cb4aa4ea 100644 --- a/reactos/hal/halx86/mp/halmp.xml +++ b/reactos/hal/halx86/mp/halmp.xml @@ -1,4 +1,4 @@ - + ../include include diff --git a/reactos/hal/halx86/up/halup.xml b/reactos/hal/halx86/up/halup.xml index 6a849c6eced..03f2226827e 100644 --- a/reactos/hal/halx86/up/halup.xml +++ b/reactos/hal/halx86/up/halup.xml @@ -1,4 +1,4 @@ - + ../include diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index a2d302e534d..e6913baa22e 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -256,6 +256,8 @@ MingwBackend::ProcessModules () for ( i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; + if ( !module.enabled ) + continue; MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler ( module, this ); @@ -547,6 +549,8 @@ MingwBackend::GetBuildToolDependencies () const for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; + if ( !module.enabled ) + continue; if ( module.type == BuildTool ) { if ( dependencies.length () > 0 ) @@ -845,6 +849,8 @@ MingwBackend::GetModuleInstallTargetFiles ( for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { const Module& module = *ProjectNode.modules[i]; + if ( !module.enabled ) + continue; if ( module.installName.length () > 0 ) { string targetFilenameNoFixup; @@ -915,6 +921,8 @@ MingwBackend::OutputModuleInstallTargets () for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { const Module& module = *ProjectNode.modules[i]; + if ( !module.enabled ) + continue; if ( module.installName.length () > 0 ) { string sourceFilename = MingwModuleHandler::PassThruCacheDirectory ( @@ -1004,6 +1012,8 @@ MingwBackend::GetModuleTestTargets ( for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { const Module& module = *ProjectNode.modules[i]; + if ( !module.enabled ) + continue; if ( module.type == Test ) out.push_back ( module.name ); } diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 035f0a8c8fc..be3410c6739 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -2573,6 +2573,8 @@ MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( for ( size_t i = 0; i < module.project.modules.size (); i++ ) { const Module& m = *module.project.modules[i]; + if ( !m.enabled ) + continue; if ( m.bootstrap != NULL ) { string sourceFilename = PassThruCacheDirectory ( @@ -2619,6 +2621,8 @@ MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory for ( size_t i = 0; i < module.project.modules.size (); i++ ) { const Module& m = *module.project.modules[i]; + if ( !m.enabled ) + continue; if ( m.bootstrap != NULL ) { string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base ); @@ -2664,6 +2668,8 @@ MingwIsoModuleHandler::GetBootstrapCdFiles ( for ( size_t i = 0; i < module.project.modules.size (); i++ ) { const Module& m = *module.project.modules[i]; + if ( !m.enabled ) + continue; if ( m.bootstrap != NULL ) { string filename = PassThruCacheDirectory ( @@ -2795,6 +2801,8 @@ MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory, for ( size_t i = 0; i < module.project.modules.size (); i++ ) { const Module& m = *module.project.modules[i]; + if ( !m.enabled ) + continue; if ( m.installName.length () > 0 ) { string sourceFilename = MingwModuleHandler::PassThruCacheDirectory ( diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 41651aa7f4d..014a27077bb 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -99,6 +99,15 @@ NormalizeFilename ( const string& filename ) return FixSeparator ( relativeNormalizedPath ); } +bool +GetBooleanValue ( const string& value ) +{ + if ( value == "1" ) + return true; + else + return false; +} + IfableData::~IfableData() { size_t i; @@ -153,11 +162,21 @@ Module::Module ( const Project& project, __LINE__, "Module created with non- node" ); - xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename() ); + xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename () ); path = FixSeparator ( modulePath ); - const XMLAttribute* att = moduleNode.GetAttribute ( "name", true ); + enabled = true; + + const XMLAttribute* att = moduleNode.GetAttribute ( "if", false ); + if ( att != NULL ) + enabled = GetBooleanValue ( project.ResolveProperties ( att->value ) ); + + att = moduleNode.GetAttribute ( "ifnot", false ); + if ( att != NULL ) + enabled = !GetBooleanValue ( project.ResolveProperties ( att->value ) ); + + att = moduleNode.GetAttribute ( "name", true ); assert(att); name = att->value; diff --git a/reactos/tools/rbuild/project.cpp b/reactos/tools/rbuild/project.cpp index 3b64b41cc45..19d7ed622e6 100644 --- a/reactos/tools/rbuild/project.cpp +++ b/reactos/tools/rbuild/project.cpp @@ -85,10 +85,49 @@ Project::LookupProperty ( const string& name ) const return NULL; } +string +Project::ResolveNextProperty ( string& s ) const +{ + size_t i = s.find ( "${" ); + if ( i == string::npos ) + i = s.find ( "$(" ); + if ( i != string::npos ) + { + string endCharacter; + if ( s[i + 1] == '{' ) + endCharacter = "}"; + else + endCharacter = ")"; + size_t j = s.find ( endCharacter ); + if ( j != string::npos ) + { + int propertyNameLength = j - i - 2; + string propertyName = s.substr ( i + 2, propertyNameLength ); + const Property* property = LookupProperty ( propertyName ); + if ( property != NULL ) + return s.replace ( i, propertyNameLength + 3, property->value ); + } + } + return s; +} + +string +Project::ResolveProperties ( const string& s ) const +{ + string s2 = s; + string s3; + do + { + s3 = s2; + s2 = ResolveNextProperty ( s3 ); + } while ( s2 != s3 ); + return s2; +} + void Project::SetConfigurationOption ( char* s, - string name, - string* alternativeName ) + string name, + string* alternativeName ) { const Property* property = LookupProperty ( name ); if ( property != NULL && property->value.length () > 0 ) diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 561c3a0f04b..69ba0657910 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -134,7 +134,9 @@ public: Module* LocateModule ( const std::string& name ); const Module* LocateModule ( const std::string& name ) const; std::string GetProjectFilename () const; + std::string ResolveProperties ( const std::string& s ) const; private: + std::string ResolveNextProperty ( std::string& s ) const; const Property* LookupProperty ( const std::string& name ) const; void SetConfigurationOption ( char* s, std::string name, @@ -210,6 +212,7 @@ public: std::string installName; bool useWRC; bool enableWarnings; + bool enabled; Module ( const Project& project, const XMLElement& moduleNode, diff --git a/reactos/tools/rbuild/rbuild.txt b/reactos/tools/rbuild/rbuild.txt index 24ac49e4b29..4c9fe23b369 100644 --- a/reactos/tools/rbuild/rbuild.txt +++ b/reactos/tools/rbuild/rbuild.txt @@ -107,11 +107,13 @@ Module element There can be zero or more modules per xml build file. Syntax: - + ... Attributes: + if - If the value is 1, then the module is enabled, otherwise it is disabled. A disabled module is not processed. + ifnot - If the value is 1, then the module is disabled, otherwise it is enabled. A disabled module is not processed. name - Name of the module. Also the base name of the generated file if such file is generated for the particular module type. type - Type of module. See below for an explanation of module types. extension - Extension of the generated file if such file is generated for the particular module type.