Author: mpiulachs Date: Sat Oct 27 23:40:38 2007 New Revision: 29920
URL: http://svn.reactos.org/svn/reactos?rev=29920&view=rev Log: - Constify true/false yes/no attribute checking - Experimental support to autogenerate rsrc.rc equivalent and platform dependent manifest.xml to intermediate folder - Add preliminary support to track authors/contributors/developers/translators for each module. It can be useful to autogenerate uptodate \CREDITS file , module/authors reports (see for example: http://www.codexchange.net/rosdoc/authors.htm or http://www.codexchange.net/rosdoc/eventvwr.htm) or even source code for modules like notevil
note: I added some developers as sample , feel free to add your information to contributors.rbuild using current information as template
Added: branches/rbuild/reactos/contributors.rbuild (with props) Modified: branches/rbuild/reactos/ReactOS-generic.rbuild branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rbuild branches/rbuild/reactos/dll/cpl/desk/desk.rbuild branches/rbuild/reactos/tools/rbuild/define.cpp branches/rbuild/reactos/tools/rbuild/linkerscript.cpp branches/rbuild/reactos/tools/rbuild/module.cpp branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp branches/rbuild/reactos/tools/rbuild/rbuild.h
Modified: branches/rbuild/reactos/ReactOS-generic.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/ReactOS-generic.r... ============================================================================== --- branches/rbuild/reactos/ReactOS-generic.rbuild (original) +++ branches/rbuild/reactos/ReactOS-generic.rbuild Sat Oct 27 23:40:38 2007 @@ -2,6 +2,7 @@ <!DOCTYPE group SYSTEM "tools/rbuild/project.dtd"> <group xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="baseaddress.rbuild" /> + <xi:include href="contributors.rbuild" />
<define name="__REACTOS__" overridable="true" /> <if property="MP" value="1">
Modified: branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rbuild (original) +++ branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rbuild Sat Oct 27 23:40:38 2007 @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<module name="eventvwr" type="win32gui" installbase="system32" installname="eventvwr.exe" generatemanifest="true" generateresource="true"> +<module name="eventvwr" type="win32gui" installbase="system32" installname="eventvwr.exe"> <include base="eventvwr">.</include> <include base="eventvwr" root="intermediate">.</include> <define name="__REACTOS__" /> @@ -13,12 +13,22 @@ <file>eventvwr.c</file> <file>eventvwr.rc</file>
+ <!-- Auto generated stuff --> + <automanifest>manifest.xml</automanifest> + <autoresource>auto.rc</autoresource> + + <!-- Authors --> + <developer>mpiulachs</developer> + <translator>cfinck</translator> + <translator>fireball</translator> + <translator>mpiulachs</translator> + <metadata description="ReactOS Event Log Viewer" />
+ <!-- Avialable localizations for this module --> <localization isoname="de-DE">lang/de-DE.rc</localization> <localization isoname="en-US">lang/en-US.rc</localization> <localization isoname="es-ES">lang/es-ES.rc</localization> <localization isoname="fr-FR">lang/fr-FR.rc</localization> <localization isoname="ru-RU">lang/ru-RU.rc</localization> -</module> - +</module>
Added: branches/rbuild/reactos/contributors.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/contributors.rbui... ============================================================================== --- branches/rbuild/reactos/contributors.rbuild (added) +++ branches/rbuild/reactos/contributors.rbuild Sat Oct 27 23:40:38 2007 @@ -1,0 +1,8 @@ +<?xml version="1.0"?> +<!DOCTYPE group SYSTEM "tools/rbuild/project.dtd"> +<group xmlns:xi="http://www.w3.org/2001/XInclude"> + <contributor firstname="Marc" lastname="Piulachs" mail="marc.piulachs@codexchange.net" alias="mpiulachs" country="Spain" city="Barcelona" /> + <contributor firstname="Colin" lastname="Finck" alias="cfinck" /> + <contributor firstname="Aleksey" lastname="Bragin" alias="fireball" /> + <contributor firstname="Eric" lastname="Kohl" alias="ekohl" /> +</group>
Propchange: branches/rbuild/reactos/contributors.rbuild ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/rbuild/reactos/dll/cpl/desk/desk.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/dll/cpl/desk/desk... ============================================================================== --- branches/rbuild/reactos/dll/cpl/desk/desk.rbuild (original) +++ branches/rbuild/reactos/dll/cpl/desk/desk.rbuild Sat Oct 27 23:40:38 2007 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> -<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="true" generatemanifest="true" generateresource="true"> +<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="true"> <importlibrary definition="desk.def" /> <include base="desk">.</include> <include base="desk" root="intermediate">.</include> @@ -37,6 +37,13 @@ <file>monslctl.c</file> <file>desk.rc</file>
+ <!-- Auto generated stuff --> + <automanifest>manifest.xml</automanifest> + <autoresource>auto.rc</autoresource> + + <!-- Authors --> + <developer>ekohl</developer> + <metadata description="ReactOS Display ControlPanel Applet" />
<localization isoname="bg-BG">lang/bg-BG.rc</localization>
Modified: branches/rbuild/reactos/tools/rbuild/define.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/defi... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/define.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/define.cpp Sat Oct 27 23:40:38 2007 @@ -87,7 +87,7 @@
att = node->GetAttribute ( "overridable", false ); if ( att ) - overridable = ( att->value == "true" || att->value == "yes" ); + overridable = ( att->value == TRUE_STRING || att->value == YES_STRING ); else overridable = false; }
Modified: branches/rbuild/reactos/tools/rbuild/linkerscript.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/link... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/linkerscript.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/linkerscript.cpp Sat Oct 27 23:40:38 2007 @@ -35,3 +35,27 @@ LinkerScript::ProcessXML() { } + +AutoResource::AutoResource ( const XMLElement& node_, + const Module& module_, + const FileLocation& file_ ) + : node(node_), module(module_), file(file_) +{ +} + +void +AutoResource::ProcessXML() +{ +} + +AutoManifest::AutoManifest ( const XMLElement& node_, + const Module& module_, + const FileLocation& file_ ) + : node(node_), module(module_), file(file_) +{ +} + +void +AutoManifest::ProcessXML() +{ +}
Modified: branches/rbuild/reactos/tools/rbuild/module.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/modu... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/module.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/module.cpp Sat Oct 27 23:40:38 2007 @@ -247,7 +247,9 @@ linkerScript (NULL), pch (NULL), cplusplus (false), - host (HostDefault) + host (HostDefault), + autoManifest (NULL), + autoResource (NULL) { if ( node.name != "module" ) throw InvalidOperationException ( __FILE__, @@ -292,9 +294,9 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) isUnicode = true; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) isUnicode = false; else { @@ -306,14 +308,14 @@ } else isUnicode = false; - +/* att = moduleNode.GetAttribute ( "generatemanifest", false ); if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) generateManifestFile = true; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) generateManifestFile = false; else { @@ -330,10 +332,10 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) { generateResourceFile = true; -/* + File* resFile = new File ( IntermediateDirectory, output->relative_path, "auto.rc", @@ -342,9 +344,9 @@ false );
non_if_data.files.push_back ( resFile ); -*/ - } - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + + } + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) generateResourceFile = false; else { @@ -356,7 +358,7 @@ } else generateResourceFile = false; - +*/ if (isUnicode) { // Always define UNICODE and _UNICODE @@ -397,9 +399,9 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) mangledSymbols = true; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) mangledSymbols = false; else { @@ -414,7 +416,7 @@
att = moduleNode.GetAttribute ( "underscoresymbols", false ); if ( att != NULL ) - underscoreSymbols = att->value == "true"; + underscoreSymbols = att->value == TRUE_STRING; else underscoreSymbols = false;
@@ -422,9 +424,9 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) host = HostTrue; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) host = HostFalse; else { @@ -439,9 +441,9 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) isStartupLib = true; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) ) isStartupLib = false; else { @@ -481,7 +483,7 @@ } } if ( att != NULL ) - allowWarnings = att->value == "true"; + allowWarnings = att->value == TRUE_STRING; else allowWarnings = false;
@@ -598,9 +600,9 @@ const XMLAttribute* att = e.GetAttribute ( "first", false ); if ( att != NULL ) { - if ( !stricmp ( att->value.c_str(), "true" ) ) + if ( !stricmp ( att->value.c_str(), TRUE_STRING ) ) first = true; - else if ( stricmp ( att->value.c_str(), "false" ) ) + else if ( stricmp ( att->value.c_str(), FALSE_STRING ) ) { throw XMLInvalidBuildFileException ( e.location, @@ -764,6 +766,64 @@ dependencies.push_back ( new Dependency ( e, *this ) ); subs_invalid = true; } + else if ( e.name == "autoresource" ) + { + if ( parseContext.ifData ) + { + throw XMLInvalidBuildFileException ( + e.location, + "<autoresource> is not a valid sub-element of <if>" ); + } + if ( autoResource ) + { + throw XMLInvalidBuildFileException ( + e.location, + "Only one <autoresource> is valid per module" ); + } + size_t pos = e.value.find_last_of ( "/\" ); + if ( pos == string::npos ) + { + autoResource = new AutoResource ( + e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) ); + } + else + { + string dir = e.value.substr ( 0, pos ); + string name = e.value.substr ( pos + 1); + autoResource = new AutoResource ( + e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) ); + } + subs_invalid = true; + } + else if ( e.name == "automanifest" ) + { + if ( parseContext.ifData ) + { + throw XMLInvalidBuildFileException ( + e.location, + "<automanifest> is not a valid sub-element of <if>" ); + } + if ( autoManifest ) + { + throw XMLInvalidBuildFileException ( + e.location, + "Only one <automanifest> is valid per module" ); + } + size_t pos = e.value.find_last_of ( "/\" ); + if ( pos == string::npos ) + { + autoManifest = new AutoManifest ( + e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) ); + } + else + { + string dir = e.value.substr ( 0, pos ); + string name = e.value.substr ( pos + 1); + autoManifest = new AutoManifest ( + e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) ); + } + subs_invalid = true; + } else if ( e.name == "importlibrary" ) { if ( parseContext.ifData ) @@ -866,6 +926,26 @@ linkerScript = new LinkerScript ( e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) ); } + subs_invalid = true; + } + else if ( e.name == "developer" ) + { + authors.push_back ( new Author ( e, *this , Developer) ); + subs_invalid = true; + } + else if ( e.name == "mantainer" ) + { + authors.push_back ( new Author ( e, *this , Mantainer ) ); + subs_invalid = true; + } + //else if ( e.name == "contributor" ) + //{ + // authors.push_back ( new Author ( e, *this , Contributor ) ); + // subs_invalid = false; + //} + else if ( e.name == "translator" ) + { + authors.push_back ( new Author ( e, *this , Translator ) ); subs_invalid = true; } else if ( e.name == "component" ) @@ -1591,6 +1671,46 @@ { }
+/* +AuthorRole +Author::GetAuthorRole ( const string& location, const XMLAttribute& attribute ) +{ + if ( attribute.value == "developer" ) + return Developer; + if ( attribute.value == "mantainer" ) + return Mantainer; + if ( attribute.value == "contributor" ) + return Contributor; + if ( attribute.value == "translator" ) + return Translator; + throw InvalidAttributeValueException ( location, + attribute.name, + attribute.value ); +} +*/ + +Author::Author ( const XMLElement& _node , const Module& module_ , AuthorRole role_) + : node (_node), module(module_) , role(role_) +{ + ProcessXML (); +} + +Author::Author ( const XMLElement& _node , const Module& module_) + : node (_node), module(module_) , role (Developer) +{ + //const XMLAttribute* att = _node.GetAttribute ( "role", true ); + //assert(att); + //role = GetAuthorRole(_node.location , *att); + + ProcessXML (); +} + +void +Author::ProcessXML() +{ + alias = node.value; +} + Localization::Localization ( const XMLElement& node_, const Module& module_, const FileLocation& file_) @@ -1604,9 +1724,9 @@ if ( att != NULL ) { const char* p = att->value.c_str(); - if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) ) dirty = true; - else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + else if ( !stricmp ( p, FALSE_STRING) || !stricmp ( p, NO_STRING ) ) dirty = false; else {
Modified: branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/modu... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp Sat Oct 27 23:40:38 2007 @@ -37,7 +37,7 @@ { Module& module = *project.modules[i];
- if (module.generateManifestFile) + if (module.autoManifest != NULL) { WriteManifestFile (module); }
Modified: branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/modu... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp Sat Oct 27 23:40:38 2007 @@ -37,7 +37,7 @@ { Module& module = *project.modules[i];
- if (module.generateResourceFile) + if (module.autoResource != NULL) { WriteResourceFile (module); } @@ -78,7 +78,7 @@ s = s + sprintf ( s, "#include <reactos/version.rc>\n"); s = s + sprintf ( s, "\n" );
- if (module.generateManifestFile) + if (module.autoManifest != NULL) { s = s + sprintf ( s, "1 24 DISCARDABLE "manifest.xml"\n"); s = s + sprintf ( s, "\n" );
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.h (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.h Sat Oct 27 23:40:38 2007 @@ -51,6 +51,11 @@ extern std::string sBadSep; extern char cSep; extern char cBadSep; + +#define TRUE_STRING "true" +#define FALSE_STRING "false" +#define YES_STRING "yes" +#define NO_STRING "no"
#ifdef WIN32 #define DEF_EXEPREFIX "" @@ -106,6 +111,9 @@ class Metadata; class Language; class Localization; +class Author; +class AutoManifest; +class AutoResource;
typedef std::mapstd::string,Directory* directory_map;
@@ -130,6 +138,14 @@ OutputDirectory, InstallDirectory, TemporaryDirectory, +}; + +enum AuthorRole +{ + Developer, + Mantainer, +// Contributor, + Translator };
class Directory @@ -349,16 +365,15 @@ std::string buildtype; ModuleType type; ImportLibrary* importLibrary; - Metadata* metadata; + Metadata* metadata; bool mangledSymbols; bool underscoreSymbols; bool isUnicode; bool isDefaultEntryPoint; - bool generateManifestFile; - bool generateResourceFile; Bootstrap* bootstrap; AutoRegister* autoRegister; // <autoregister> node IfableData non_if_data; + std::vector<Author*> authors; std::vector<Invoke*> invocations; std::vector<Localization*> localizations; std::vector<Dependency*> dependencies; @@ -377,6 +392,8 @@ FileLocation *output; // "path/foo.exe" FileLocation *dependency; // "path/foo.exe" or "path/libfoo.a" FileLocation *install; + AutoManifest* autoManifest; + AutoResource* autoResource;
Module ( const Project& project, const XMLElement& moduleNode, @@ -566,6 +583,34 @@ void ProcessXML(); };
+class AutoManifest +{ + const XMLElement& node; +public: + const Module& module; + FileLocation file; + + AutoManifest ( const XMLElement& node, + const Module& module, + const FileLocation& file ); + + void ProcessXML(); +}; + +class AutoResource +{ + const XMLElement& node; +public: + const Module& module; + FileLocation file; + + AutoResource ( const XMLElement& node, + const Module& module, + const FileLocation& file ); + + void ProcessXML(); +}; + class ImportLibrary : public XmlNode { public: @@ -587,6 +632,23 @@ Language ( const XMLElement& _node );
void ProcessXML (); +}; + +class Author +{ +public: + const XMLElement& node; + const Module& module; + std::string alias; + AuthorRole role; + + Author ( const XMLElement& _node, const Module& module ); + Author ( const XMLElement& _node, const Module& module, AuthorRole role ); + + void ProcessXML (); +//private: +// AuthorRole GetAuthorRole ( const std::string& location, +// const XMLAttribute& attribute ); };
class Localization