Author: mpiulachs Date: Mon Oct 22 22:28:26 2007 New Revision: 29785
URL: http://svn.reactos.org/svn/reactos?rev=29785&view=rev Log: Initial commit :D
Auto generate part of the module's most common resources , currently things like manifest.xml , defines like REACTOS_VERSION_DLL and specially localizations are created and synchronized by hand.
Now module localizations are created in a declarative way which makes trivial tasks like listing non existent or outdated language localizations in real time for example : http://www.codexchange.net/rosdoc/localizations.htm .No more rsrc.rc required as it is now auto generated on the intermediate folder.
Still work in progress so would like to hear your ideas or comments , specially those from translators.
Added: branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp (with props) branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp (with props) Removed: branches/rbuild/reactos/base/applications/mscutils/eventvwr/manifest.xml branches/rbuild/reactos/base/applications/mscutils/eventvwr/rsrc.rc branches/rbuild/reactos/dll/cpl/desk/manifest.xml branches/rbuild/reactos/dll/cpl/desk/rsrc.rc Modified: branches/rbuild/reactos/ReactOS-generic.rbuild branches/rbuild/reactos/ReactOS-i386.rbuild branches/rbuild/reactos/ReactOS-ppc.rbuild branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rbuild branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rc branches/rbuild/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc branches/rbuild/reactos/dll/cpl/desk/desk.rbuild branches/rbuild/reactos/dll/cpl/desk/desk.rc branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h branches/rbuild/reactos/tools/rbuild/configuration.cpp branches/rbuild/reactos/tools/rbuild/define.cpp branches/rbuild/reactos/tools/rbuild/module.cpp branches/rbuild/reactos/tools/rbuild/project.cpp branches/rbuild/reactos/tools/rbuild/rbuild.h branches/rbuild/reactos/tools/rbuild/rbuild.mak branches/rbuild/reactos/tools/rbuild/rbuild.vcproj
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 Mon Oct 22 22:28:26 2007 @@ -31,6 +31,37 @@ <include>include/reactos</include> <include root="intermediate">include/reactos</include> <include>include/reactos/libs</include> + + <language isoname="ca-ES" /> + <language isoname="bg-BG" /> + <language isoname="cs-CZ" /> + <language isoname="de-DE" /> + <language isoname="el-GR" /> + <language isoname="en-US" /> + <language isoname="es-ES" /> + <language isoname="fr-FR" /> + <language isoname="hu-HU" /> + <language isoname="id-ID" /> + <language isoname="it-IT" /> + <language isoname="ja-JP" /> + <language isoname="nl-NL" /> + <language isoname="pl-PL" /> + <language isoname="ru-RU" /> + <language isoname="sk-SK" /> + <language isoname="sv-SE" /> + <language isoname="uk-UA" /> + <language isoname="zh-TW" /> + <language isoname="zh-CN" /> + <language isoname="tr-TR" /> + <language isoname="sv-SE" /> + <language isoname="sl-SI" /> + <language isoname="pt-PT" /> + <language isoname="nb-NO" /> + <language isoname="fi-FI" /> + <language isoname="hu-HU" /> + <language isoname="fi-FI" /> + <language isoname="cs-CZ" /> + <language isoname="ko-KR" />
<directory name="base"> <xi:include href="base/base.rbuild" />
Modified: branches/rbuild/reactos/ReactOS-i386.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/ReactOS-i386.rbui... ============================================================================== --- branches/rbuild/reactos/ReactOS-i386.rbuild (original) +++ branches/rbuild/reactos/ReactOS-i386.rbuild Mon Oct 22 22:28:26 2007 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE project SYSTEM "tools/rbuild/project.dtd"> -<project name="ReactOS" makefile="makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude"> +<project name="ReactOS" makefile="makefile.auto" architecture="i386" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="config.rbuild"> xi:fallback <xi:include href="config.template.rbuild" /> @@ -8,10 +8,6 @@ </xi:include>
<xi:include href="ReactOS-generic.rbuild" /> - - <define name="_M_IX86" /> - <define name="_X86_" /> - <define name="__i386__" />
<property name="NTOSKRNL_SHARED" value="-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared"/>
Modified: branches/rbuild/reactos/ReactOS-ppc.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/ReactOS-ppc.rbuil... ============================================================================== --- branches/rbuild/reactos/ReactOS-ppc.rbuild (original) +++ branches/rbuild/reactos/ReactOS-ppc.rbuild Mon Oct 22 22:28:26 2007 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE project SYSTEM "tools/rbuild/project.dtd"> -<project name="ReactOS" makefile="makefile.ppc" xmlns:xi="http://www.w3.org/2001/XInclude"> +<project name="ReactOS" makefile="makefile.ppc" architecture="powerpc" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="config-ppc.rbuild"> xi:fallback <xi:include href="config-ppc.template.rbuild" /> @@ -13,9 +13,6 @@ <property name="OFWLDR_LINKFORMAT" value="-L$(INTERMEDIATE)/lib/ppcmmu -lppcmmu_code -nostdlib -nostartfiles -lgcc -Wl,-e,__start -Wl,-Ttext,0xe00000 -N"/> <property name="NTOSKRNL_SHARED" value="-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles"/>
- <define name="_M_PPC" /> - <define name="_PPC_" /> - <define name="__PowerPC__" /> <define name="stdcall"/> <define name="__stdcall__"/> <define name="fastcall"/>
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 Mon Oct 22 22:28:26 2007 @@ -1,16 +1,24 @@ <?xml version="1.0"?> -<rbuild xmlns:xi="http://www.w3.org/2001/XInclude"> - <module name="eventvwr" type="win32gui" installbase="system32" installname="eventvwr.exe" allowwarnings="true"> - <include base="eventvwr">.</include> - <define name="__REACTOS__" /> - <define name="__USE_W32API" /> - <define name="_WIN32_IE">0x600</define> - <define name="_WIN32_WINNT">0x501</define> - <library>kernel32</library> - <library>user32</library> - <library>comctl32</library> - <library>advapi32</library> - <file>eventvwr.c</file> - <file>eventvwr.rc</file> - </module> -</rbuild> +<module name="eventvwr" type="win32gui" installbase="system32" installname="eventvwr.exe" generatemanifest="true" generateresource="true"> + <include base="eventvwr">.</include> + <include base="eventvwr" root="intermediate">.</include> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <library>kernel32</library> + <library>user32</library> + <library>comctl32</library> + <library>advapi32</library> + <file>eventvwr.c</file> + <file>eventvwr.rc</file> + + <metadata description="ReactOS Event Log Viewer" /> + + <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> +
Modified: branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rc URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rc (original) +++ branches/rbuild/reactos/base/applications/mscutils/eventvwr/eventvwr.rc Mon Oct 22 22:28:26 2007 @@ -2,12 +2,12 @@ #include <commctrl.h> #include "resource.h"
+// Shared icons +IDI_EVENTVWR ICON "res/eventvwr.ico" +IDI_WARNINGICON ICON "res/warning.ico" +IDI_INFORMATIONICON ICON "res/info.ico" +IDI_ERRORICON ICON "res/error.ico"
-#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Event Log Viewer\0" -#define REACTOS_STR_INTERNAL_NAME "eventvwr\0" -#define REACTOS_STR_ORIGINAL_FILENAME "eventvwr.exe\0" -#include <reactos/version.rc> - -#include "rsrc.rc" +#include "auto.rc"
Modified: branches/rbuild/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc (original) +++ branches/rbuild/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc Mon Oct 22 22:28:26 2007 @@ -89,7 +89,7 @@ IDC_EVENTLOG_ERROR_TYPE "Error" IDC_EVENTLOG_WARNING_TYPE "Advertencia" IDC_EVENTLOG_INFORMATION_TYPE "Información" - IDC_EVENTLOG_AUDIT_SUCCES "Audit Success" + IDC_EVENTLOG_AUDIT_SUCCESS "Audit Success" IDC_EVENTLOG_AUDIT_FAILURE "Audit Failure" IDC_EVENTLOG_SUCCESS "Acierto" IDC_EVENTLOG_UNKNOWN_TYPE "Evento Desconocido"
Removed: branches/rbuild/reactos/base/applications/mscutils/eventvwr/manifest.xml URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/mscutils/eventvwr/manifest.xml (original) +++ branches/rbuild/reactos/base/applications/mscutils/eventvwr/manifest.xml (removed) @@ -1,23 +1,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly - xmlns="urn:schemas-microsoft-com:asm.v1" - manifestVersion="1.0"> -<assemblyIdentity - name="Win32 Application.default.App" - processorArchitecture="x86" - version="1.0.0.0" - type="win32"/> -<description>ReactOS EventLog Viewer</description> -<dependency> - <dependentAssembly> - <assemblyIdentity - type="win32" - name="Microsoft.Windows.Common-Controls" - version="6.0.0.0" - processorArchitecture="x86" - publicKeyToken="6595b64144ccf1df" - language="*" - /> - </dependentAssembly> -</dependency> -</assembly>
Removed: branches/rbuild/reactos/base/applications/mscutils/eventvwr/rsrc.rc URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/mscutils/eventvwr/rsrc.rc (original) +++ branches/rbuild/reactos/base/applications/mscutils/eventvwr/rsrc.rc (removed) @@ -1,17 +1,0 @@ -#include <windows.h> -#include "resource.h" - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL - -1 24 DISCARDABLE "manifest.xml" - -// Shared icons -IDI_EVENTVWR ICON "res/eventvwr.ico" -IDI_WARNINGICON ICON "res/warning.ico" -IDI_INFORMATIONICON ICON "res/info.ico" -IDI_ERRORICON ICON "res/error.ico" - -#include "lang/de-DE.rc" -#include "lang/en-US.rc" -#include "lang/fr-FR.rc" -#include "lang/ru-RU.rc"
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 Mon Oct 22 22:28:26 2007 @@ -1,8 +1,9 @@ <?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="yes"> +<module name="desk" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_DESK}" installbase="system32" installname="desk.cpl" unicode="true" generatemanifest="true" generateresource="true"> <importlibrary definition="desk.def" /> <include base="desk">.</include> + <include base="desk" root="intermediate">.</include> <define name="__USE_W32API" /> <define name="_WIN32_IE">0x600</define> <define name="_WIN32_WINNT">0x501</define> @@ -35,4 +36,24 @@ <file>settings.c</file> <file>monslctl.c</file> <file>desk.rc</file> + + <metadata description="ReactOS Display ControlPanel Applet" /> + + <localization isoname="bg-BG">lang/bg-BG.rc</localization> + <localization isoname="cs-CZ">lang/cs-CZ.rc</localization> + <localization isoname="de-DE">lang/de-DE.rc</localization> + <localization isoname="el-GR" dirty="true">lang/el-GR.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="hu-HU">lang/hu-HU.rc</localization> + <localization isoname="id-ID">lang/id-ID.rc</localization> + <localization isoname="it-IT">lang/it-IT.rc</localization> + <localization isoname="ja-JP">lang/ja-JP.rc</localization> + <localization isoname="nl-NL">lang/nl-NL.rc</localization> + <localization isoname="pl-PL" dirty="true">lang/pl-PL.rc</localization> + <localization isoname="ru-RU">lang/ru-RU.rc</localization> + <localization isoname="sk-SK">lang/sk-SK.rc</localization> + <localization isoname="sv-SE">lang/sv-SE.rc</localization> + <localization isoname="uk-UA">lang/uk-UA.rc</localization> </module>
Modified: branches/rbuild/reactos/dll/cpl/desk/desk.rc URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/dll/cpl/desk/desk... ============================================================================== --- branches/rbuild/reactos/dll/cpl/desk/desk.rc (original) +++ branches/rbuild/reactos/dll/cpl/desk/desk.rc Mon Oct 22 22:28:26 2007 @@ -2,18 +2,8 @@ #include <commctrl.h> #include "resource.h"
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDC_DESK_ICON ICON "resources/applet.ico" +IDC_DESK_ICON2 ICON "resources/applet.ico" +IDC_MONITOR BITMAP "resources/monitor.bmp"
-#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Display Panel\0" -#define REACTOS_STR_INTERNAL_NAME "desk\0" -#define REACTOS_STR_ORIGINAL_FILENAME "desk.cpl\0" -#include <reactos/version.rc> - -123 24 DISCARDABLE "manifest.xml" - -IDC_DESK_ICON ICON "resources/applet.ico" -IDC_DESK_ICON2 ICON "resources/applet.ico" -IDC_MONITOR BITMAP "resources/monitor.bmp" - -#include "rsrc.rc" +#include "auto.rc"
Removed: branches/rbuild/reactos/dll/cpl/desk/manifest.xml URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/dll/cpl/desk/mani... ============================================================================== --- branches/rbuild/reactos/dll/cpl/desk/manifest.xml (original) +++ branches/rbuild/reactos/dll/cpl/desk/manifest.xml (removed) @@ -1,24 +1,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <assemblyIdentity - version="1.0.0.0" - processorArchitecture="X86" - name="ReactOS.System.ControlPanel.System" - type="win32" - /> - <description>ReactOS System Control Panel</description> - <dependency> - <dependentAssembly> - <assemblyIdentity - type="win32" - name="Microsoft.Windows.Common-Controls" - version="6.0.0.0" - processorArchitecture="X86" - publicKeyToken="6595b64144ccf1df" - language="*" - /> - </dependentAssembly> - </dependency> -</assembly> - -<!-- EOF -->
Removed: branches/rbuild/reactos/dll/cpl/desk/rsrc.rc URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/dll/cpl/desk/rsrc... ============================================================================== --- branches/rbuild/reactos/dll/cpl/desk/rsrc.rc (original) +++ branches/rbuild/reactos/dll/cpl/desk/rsrc.rc (removed) @@ -1,20 +1,0 @@ -#include <windows.h> -#include "resource.h" - -#include "lang/bg-BG.rc" -#include "lang/cs-CZ.rc" -#include "lang/de-DE.rc" -#include "lang/el-GR.rc" -#include "lang/en-US.rc" -#include "lang/es-ES.rc" -#include "lang/fr-FR.rc" -#include "lang/hu-HU.rc" -#include "lang/id-ID.rc" -#include "lang/it-IT.rc" -#include "lang/ja-JP.rc" -#include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" -#include "lang/uk-UA.rc"
Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/back... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp Mon Oct 22 22:28:26 2007 @@ -343,6 +343,8 @@ GenerateTestSupportCode (); GenerateCompilationUnitSupportCode (); GenerateSysSetup (); + GenerateModulesResources(); + GenerateModulesManifests(); GenerateProxyMakefiles (); CheckAutomaticDependencies (); CloseMakefile (); @@ -723,6 +725,24 @@ printf ( "done\n" ); }
+void +MingwBackend::GenerateModulesResources () +{ + printf ( "Generating modules resources..." ); + ModulesResourceGenerator moduleResourceGenerator ( ProjectNode ); + moduleResourceGenerator.Generate (); + printf ( "done\n" ); +} + +void +MingwBackend::GenerateModulesManifests () +{ + printf ( "Generating modules manifests...." ); + ModulesManifestGenerator moduleManifestGenerator ( ProjectNode ); + moduleManifestGenerator.Generate (); + printf ( "done\n" ); +} + string MingwBackend::GetProxyMakefileTree () const {
Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/back... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h Mon Oct 22 22:28:26 2007 @@ -84,6 +84,8 @@ void GenerateTestSupportCode (); void GenerateCompilationUnitSupportCode (); void GenerateSysSetup (); + void GenerateModulesResources(); + void GenerateModulesManifests(); std::string GetProxyMakefileTree () const; void GenerateProxyMakefiles (); void CheckAutomaticDependencies ();
Modified: branches/rbuild/reactos/tools/rbuild/configuration.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/conf... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/configuration.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/configuration.cpp Mon Oct 22 22:28:26 2007 @@ -24,7 +24,7 @@ { Verbose = false; CleanAsYouGo = false; - AutomaticDependencies = true; + AutomaticDependencies = false; CheckDependenciesForModuleOnly = false; CompilationUnitsEnabled = true; MakeHandlesInstallDirectories = false;
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 Mon Oct 22 22:28:26 2007 @@ -55,6 +55,18 @@ backend = backend_; }
+Define::Define ( const Project& project, + const std::string name_, + const std::string backend_) + : project(project), + module(NULL), + node(NULL) +{ + name = name_; + value = ""; + backend = backend_; +} + Define::~Define () { } @@ -84,3 +96,4 @@ Define::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 Mon Oct 22 22:28:26 2007 @@ -307,6 +307,56 @@ 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" ) ) + generateManifestFile = true; + else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + generateManifestFile = false; + else + { + throw InvalidAttributeValueException ( + moduleNode.location, + "generatemanifest", + att->value ); + } + } + else + generateManifestFile = false; + + att = moduleNode.GetAttribute ( "generateresource", false ); + if ( att != NULL ) + { + const char* p = att->value.c_str(); + if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + { + generateResourceFile = true; +/* + File* resFile = new File ( IntermediateDirectory, + output->relative_path, + "auto.rc", + false, + "", + false ); + + non_if_data.files.push_back ( resFile ); +*/ + } + else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + generateResourceFile = false; + else + { + throw InvalidAttributeValueException ( + moduleNode.location, + "generateResourceFile", + att->value ); + } + } + else + generateResourceFile = false; + if (isUnicode) { // Always define UNICODE and _UNICODE @@ -557,6 +607,23 @@ "attribute 'first' of <file> element can only be 'true' or 'false'" ); } } +#if 0 /* Should we allow module root files to be on intermediate? */ + att = e.GetAttribute ( "root", false ); + if ( att != NULL ) + { + if ( att->value == "intermediate" ) + directory = IntermediateDirectory; + else if ( att->value == "output" ) + directory = OutputDirectory; + else + { + throw InvalidAttributeValueException ( + e.location, + "root", + att->value ); + } + } +#endif string switches = ""; att = e.GetAttribute ( "switches", false ); if ( att != NULL ) @@ -744,6 +811,32 @@ else if ( e.name == "linkerflag" ) { linkerFlags.push_back ( new LinkerFlag ( project, this, e ) ); + subs_invalid = true; + } + else if ( e.name == "localization" ) + { + if ( parseContext.ifData ) + { + throw XMLInvalidBuildFileException ( + e.location, + "<localization> is not a valid sub-element of <if>" ); + } + Localization* localization; + size_t pos = e.value.find_last_of ( "/\" ); + if ( pos == string::npos ) + { + localization = new Localization ( + e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) ); + } + else + { + string dir = e.value.substr ( 0, pos ); + string name = e.value.substr ( pos + 1); + localization = new Localization ( + e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) ); + } + + localizations.push_back ( localization ); subs_invalid = true; } else if ( e.name == "linkerscript" ) @@ -1485,6 +1578,53 @@ { }
+Language::Language ( const XMLElement& _node) + : node (_node) +{ + const XMLAttribute* att = _node.GetAttribute ( "isoname", true ); + assert(att); + isoname = att->value; +} + +void +Language::ProcessXML() +{ +} + +Localization::Localization ( const XMLElement& node_, + const Module& module_, + const FileLocation& file_) + : node(node_), module(module_), file(file_) , isoname("") +{ + const XMLAttribute* att = node.GetAttribute ( "isoname", true ); + assert(att); + isoname = att->value; + + att = node.GetAttribute ( "dirty", false ); + if ( att != NULL ) + { + const char* p = att->value.c_str(); + if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + dirty = true; + else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + dirty = false; + else + { + throw InvalidAttributeValueException ( + node.location, + "dirty", + att->value ); + } + } + else + dirty = false; +} + +void +Localization::ProcessXML() +{ +} +
Dependency::Dependency ( const XMLElement& _node, const Module& _module )
Added: 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 (added) +++ branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp Mon Oct 22 22:28:26 2007 @@ -1,0 +1,93 @@ +/* + * Copyright (C) 2007 Marc Piulachs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <assert.h> +#include "rbuild.h" + +using std::string; +using std::vector; + +ModulesManifestGenerator::ModulesManifestGenerator ( const Project& project ) + : project ( project ) +{ +} + +ModulesManifestGenerator::~ModulesManifestGenerator () +{ +} + +void +ModulesManifestGenerator::Generate () +{ + for ( size_t i = 0; i < project.modules.size (); i++ ) + { + Module& module = *project.modules[i]; + + if (module.generateManifestFile) + { + WriteManifestFile (module); + } + } +} + +void +ModulesManifestGenerator::WriteManifestFile ( Module& module ) +{ + char* buf; + char* s; + + buf = (char*) malloc ( 512*1024 ); + if ( buf == NULL ) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"); + s = s + sprintf ( s, "<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">"); + s = s + sprintf ( s, " <assemblyIdentity"); + s = s + sprintf ( s, " version="1.0.0.0""); + s = s + sprintf ( s, " processorArchitecture="x86""); + s = s + sprintf ( s, " name="ReactOS.System.ControlPanel.System""); + s = s + sprintf ( s, " type="win32""); + s = s + sprintf ( s, " />"); + + if (module.metadata != NULL) + { + s = s + sprintf ( s, " <description>%s</description>" , module.metadata->description.c_str()); + } + else + { + s = s + sprintf ( s, " <description>%s<description>" , module.name.c_str()); + } + + s = s + sprintf ( s, " <dependency>"); + s = s + sprintf ( s, " <dependentAssembly>"); + s = s + sprintf ( s, " <assemblyIdentity"); + s = s + sprintf ( s, " type="win32""); + s = s + sprintf ( s, " name="Microsoft.Windows.Common-Controls""); + s = s + sprintf ( s, " version="6.0.0.0""); + s = s + sprintf ( s, " processorArchitecture="x86""); + s = s + sprintf ( s, " publicKeyToken="6595b64144ccf1df""); + s = s + sprintf ( s, " language="*""); + s = s + sprintf ( s, " />"); + s = s + sprintf ( s, " </dependentAssembly>"); + s = s + sprintf ( s, " </dependency>"); + s = s + sprintf ( s, "</assembly>"); + + FileSupportCode::WriteIfChanged ( buf, NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.output->relative_path + sSep + "manifest.xml" ) ); + + free ( buf ); +}
Propchange: branches/rbuild/reactos/tools/rbuild/modulesmanifestgenerator.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Added: 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 (added) +++ branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp Mon Oct 22 22:28:26 2007 @@ -1,0 +1,100 @@ +/* + * Copyright (C) 2007 Marc Piulachs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <assert.h> +#include "rbuild.h" + +using std::string; +using std::vector; + +ModulesResourceGenerator::ModulesResourceGenerator ( const Project& project ) + : project ( project ) +{ +} + +ModulesResourceGenerator::~ModulesResourceGenerator () +{ +} + +void +ModulesResourceGenerator::Generate () +{ + for ( size_t i = 0; i < project.modules.size (); i++ ) + { + Module& module = *project.modules[i]; + + if (module.generateResourceFile) + { + WriteResourceFile (module); + } + } +} + +void +ModulesResourceGenerator::WriteResourceFile ( Module& module ) +{ + char* buf; + char* s; + + buf = (char*) malloc ( 512*1024 ); + if ( buf == NULL ) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "/* Auto generated */\n"); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "#include <windows.h>\n"); + s = s + sprintf ( s, "#include <commctrl.h>\n"); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n"); + s = s + sprintf ( s, "\n" ); + + if (module.metadata) + { + s = s + sprintf ( s, "#define REACTOS_STR_FILE_DESCRIPTION "%s\0"\n" , module.metadata->description.c_str()); + } + else + { + s = s + sprintf ( s, "#define REACTOS_STR_FILE_DESCRIPTION "%s\0"\n" ,module.name.c_str()); + } + + s = s + sprintf ( s, "#define REACTOS_STR_INTERNAL_NAME "%s\0"\n" , module.name.c_str()); + s = s + sprintf ( s, "#define REACTOS_STR_ORIGINAL_FILENAME "%s\0"\n" , module.output->name.c_str()); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "#include <reactos/version.rc>\n"); + s = s + sprintf ( s, "\n" ); + + if (module.generateManifestFile) + { + s = s + sprintf ( s, "1 24 DISCARDABLE "manifest.xml"\n"); + s = s + sprintf ( s, "\n" ); + } + + for ( size_t i = 0; i < module.localizations.size (); i++ ) + { + Localization& localization = *module.localizations[i]; + + std::string langFile = NormalizeFilename(localization.file.relative_path + sSep + localization.file.name); + + s = s + sprintf ( s, "#include "%s"" , langFile.c_str() ); + s = s + sprintf ( s, "\n" ); + } + + FileSupportCode::WriteIfChanged ( buf, NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.output->relative_path + sSep + "auto.rc" ) ); + + free ( buf ); +}
Propchange: branches/rbuild/reactos/tools/rbuild/modulesresourcegenerator.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/rbuild/reactos/tools/rbuild/project.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/proj... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/project.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/project.cpp Mon Oct 22 22:28:26 2007 @@ -357,6 +357,10 @@ else name = att->value;
+ att = node->GetAttribute ( "architecture", true ); + assert(att); + architectureType = GetArchitectureType ( node->location, *att ); + att = node->GetAttribute ( "makefile", true ); assert(att); makefile = Environment::GetAutomakeFile ( att->value ); @@ -401,6 +405,46 @@ cdfiles[i]->ProcessXML (); for ( i = 0; i < installfiles.size (); i++ ) installfiles[i]->ProcessXML (); + + switch (architectureType) + { + case I386: + { + Define* pDefine = new Define (*this, "_M_IX86" ); + non_if_data.defines.push_back ( pDefine ); + + pDefine = new Define (*this, "_X86_" ); + non_if_data.defines.push_back ( pDefine ); + + pDefine = new Define (*this, "__i386__" ); + non_if_data.defines.push_back ( pDefine ); + } + break; + case PowerPC: + { + Define* pDefine = new Define (*this, "_M_PPC" ); + non_if_data.defines.push_back ( pDefine ); + + pDefine = new Define (*this, "_PPC_" ); + non_if_data.defines.push_back ( pDefine ); + + pDefine = new Define (*this, "__PowerPC__" ); + non_if_data.defines.push_back ( pDefine ); + } + break; + } +} + +ArchitectureType +Project::GetArchitectureType ( const string& location, const XMLAttribute& attribute ) +{ + if ( attribute.value == "i386" ) + return I386; + if ( attribute.value == "powerpc" ) + return PowerPC; + throw InvalidAttributeValueException ( location, + attribute.name, + attribute.value ); }
void @@ -439,6 +483,12 @@ installfiles.push_back ( installfile ); subs_invalid = true; } + else if ( e.name == "language" ) + { + Language* language = new Language ( e ); + languages.push_back ( language ); + subs_invalid = true; + } else if ( e.name == "directory" ) { const XMLAttribute* att = e.GetAttribute ( "name", true );
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 Mon Oct 22 22:28:26 2007 @@ -100,9 +100,12 @@ class CompilationUnit; class FileLocation; class AutoRegister; - +class ModulesResourceGenerator; +class ModulesResourceGenerator; class SourceFileTest; class Metadata; +class Language; +class Localization;
typedef std::mapstd::string,Directory* directory_map;
@@ -222,6 +225,12 @@ void ExtractModules( std::vector<Module*> &modules ); };
+enum ArchitectureType +{ + I386, + PowerPC +}; + class Project { std::string xmlfile; @@ -236,8 +245,10 @@ std::vector<CDFile*> cdfiles; std::vector<InstallFile*> installfiles; std::vector<Module*> modules; + std::vector<Language*> languages; IfableData non_if_data; - + ArchitectureType GetArchitectureType ( const std::string& location, + const XMLAttribute& attribute ); Project ( const Configuration& configuration, const std::string& filename, const std::map<std::string, std::string>* properties = NULL ); @@ -246,7 +257,7 @@ Backend& GetBackend() { return *_backend; } void WriteConfigurationFile (); void ExecuteInvocations (); - + ArchitectureType architectureType; void ProcessXML ( const std::string& path ); Module* LocateModule ( const std::string& name ); const Module* LocateModule ( const std::string& name ) const; @@ -343,10 +354,13 @@ bool underscoreSymbols; bool isUnicode; bool isDefaultEntryPoint; + bool generateManifestFile; + bool generateResourceFile; Bootstrap* bootstrap; AutoRegister* autoRegister; // <autoregister> node IfableData non_if_data; std::vector<Invoke*> invocations; + std::vector<Localization*> localizations; std::vector<Dependency*> dependencies; std::vector<CompilerFlag*> compilerFlags; std::vector<LinkerFlag*> linkerFlags; @@ -429,6 +443,9 @@ bool overridable;
Define ( const Project& project, + const std::string name_, + const std::string backend_ = "" ); + Define ( const Project& project, const XMLElement& defineNode ); Define ( const Project& project, const Module* module, @@ -517,7 +534,6 @@ void ProcessXML (); };
- class Dependency { public: @@ -562,6 +578,32 @@ const Module& module ); };
+class Language +{ +public: + const XMLElement& node; + std::string isoname; + + Language ( const XMLElement& _node ); + + void ProcessXML (); +}; + +class Localization +{ +public: + const XMLElement& node; + const Module& module; + FileLocation file; + std::string isoname; + bool dirty; + + Localization ( const XMLElement& node, + const Module& module, + const FileLocation& file); + + void ProcessXML (); +};
class If { @@ -957,7 +999,6 @@ void Initialize (); };
- class SysSetupGenerator { public: @@ -972,6 +1013,27 @@ const Module& module ); };
+class ModulesResourceGenerator +{ +public: + const Project& project; + ModulesResourceGenerator ( const Project& project ); + ~ModulesResourceGenerator (); + void Generate (); +private: + void WriteResourceFile ( Module& module ); +}; + +class ModulesManifestGenerator +{ +public: + const Project& project; + ModulesManifestGenerator ( const Project& project ); + ~ModulesManifestGenerator (); + void Generate (); +private: + void WriteManifestFile ( Module& module ); +};
extern void InitializeEnvironment ();
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.mak URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.mak (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.mak Mon Oct 22 22:28:26 2007 @@ -264,6 +264,8 @@ stubbedcomponent.cpp \ syssetupgenerator.cpp \ testsupportcode.cpp \ + modulesmanifestgenerator.cpp \ + modulesresourcegenerator.cpp \ wineresource.cpp \ xmlnode.cpp \ ) @@ -456,6 +458,14 @@ $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+$(RBUILD_INT_)modulesmanifestgenerator.o: $(RBUILD_BASE_)modulesmanifestgenerator.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + +$(RBUILD_INT_)modulesresourcegenerator.o: $(RBUILD_BASE_)modulesresourcegenerator.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)wineresource.o: $(RBUILD_BASE_)wineresource.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.vcproj URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.vcproj (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.vcproj Mon Oct 22 22:28:26 2007 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="8,00" + Version="8.00" Name="rbuild" ProjectGUID="{D9305AFB-499E-49F1-A865-99DD7E19E762}" RootNamespace="rbuild" @@ -924,6 +924,14 @@ </FileConfiguration> </File> <File + RelativePath=".\modulesmanifestgenerator.cpp" + > + </File> + <File + RelativePath=".\modulesresourcegenerator.cpp" + > + </File> + <File RelativePath="project.cpp" > <FileConfiguration