Author: mpiulachs Date: Wed Oct 31 18:54:27 2007 New Revision: 30017
URL: http://svn.reactos.org/svn/reactos?rev=30017&view=rev Log: - First steps to install aplication shorcuts during setup using setupapi and syssetup.inf - Autogenerate CREDITS file in intermediate folder (for now) - More work on authors/contributors - Various other fixes
PS: Add your information to contributors.rbuild , don't be shy!
Added: branches/rbuild/reactos/base/applications/notepad/setup/ branches/rbuild/reactos/base/applications/notepad/setup/notepad.inf (with props) Modified: branches/rbuild/reactos/base/applications/notepad/notepad.rbuild branches/rbuild/reactos/contributors.rbuild branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h 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/project.cpp branches/rbuild/reactos/tools/rbuild/rbuild.h branches/rbuild/reactos/tools/rbuild/syssetupgenerator.cpp
Modified: branches/rbuild/reactos/base/applications/notepad/notepad.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/notepad/notepad.rbuild (original) +++ branches/rbuild/reactos/base/applications/notepad/notepad.rbuild Wed Oct 31 18:54:27 2007 @@ -17,4 +17,5 @@ <file>settings.c</file> <file>rsrc.rc</file> <pch>notepad.h</pch> + <installcomponent>setup/notepad.inf</installcomponent> </module>
Added: branches/rbuild/reactos/base/applications/notepad/setup/notepad.inf URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/base/applications... ============================================================================== --- branches/rbuild/reactos/base/applications/notepad/setup/notepad.inf (added) +++ branches/rbuild/reactos/base/applications/notepad/setup/notepad.inf Wed Oct 31 18:54:27 2007 @@ -1,0 +1,123 @@ +;Sample INF file to create a desktop shortcut to the notepad.exe file + +[Version] +Signature = "$Windows NT$" + +[DefaultInstall] +ProfileItems = NotepadDesktopItemAdd + +[NotepadDesktopItemAdd] +Name = %NOTEPAD_NAME%, 0x0000008, 16409 +CmdLine = 24,"%SystemRoot%\system32","notepad.exe" +InfoTip = %NOTEPAD_DESC% +WorkingDir = 24,"%HOMEDRIVE%%HOMEPATH%" + +; Localizable Strings + +[Strings] +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0401] ; Arabic +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0403] ; Catalan +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Permet crear i editar documents de text simples." + +[Strings.0404] ; Chinese (Traditional) +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0804] ; Chinese (Simplified) +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0405] ; Czech +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0406] ; Danish +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0413] ; Dutch +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0409] ; English +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.040B] ; Finnish +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.040C] ; French +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0407] ; German +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0408] ; Greek +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.040D] ; Hebrew +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.040E] ; Hungerian +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0410] ; Italian +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0411] ; Japanese +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0412] ; Korean +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0814] ; Norwegian +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0415] ; Polish +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0416] ; Portugese +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.0419] ; Russian +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.041B] ; Slovak +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.040A] ; Spanish +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Crea y editar documents de texto con formateo básico." + +[Strings.041D] ; Swedish +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.041E] ; Thai +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting." + +[Strings.041F] ; Turkish (Turkce) +NOTEPAD_NAME = "Notepad" +NOTEPAD_DESC = "Creates and edits text files using basic text formatting."
Propchange: branches/rbuild/reactos/base/applications/notepad/setup/notepad.inf ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/rbuild/reactos/contributors.rbuild URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/contributors.rbui... ============================================================================== --- branches/rbuild/reactos/contributors.rbuild (original) +++ branches/rbuild/reactos/contributors.rbuild Wed Oct 31 18:54:27 2007 @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!DOCTYPE group SYSTEM "tools/rbuild/project.dtd"> <group xmlns:xi="http://www.w3.org/2001/XInclude"> + <contributor firstname="Aleksey" lastname="Bragin" alias="fireball" /> + <contributor firstname="Colin" lastname="Finck" alias="cfinck" /> + <contributor firstname="Eric" lastname="Kohl" alias="ekohl" /> <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>
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 Wed Oct 31 18:54:27 2007 @@ -346,6 +346,7 @@ GenerateModulesResources(); GenerateModulesManifests(); GenerateProxyMakefiles (); + GenerateCreditsFile(); CheckAutomaticDependencies (); CloseMakefile (); } @@ -743,6 +744,15 @@ printf ( "done\n" ); }
+void +MingwBackend::GenerateCreditsFile () +{ + printf ( "Generating credits...." ); + CreditsGenerator creditsGenerator ( ProjectNode ); + creditsGenerator.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 Wed Oct 31 18:54:27 2007 @@ -86,6 +86,7 @@ void GenerateSysSetup (); void GenerateModulesResources(); void GenerateModulesManifests(); + void GenerateCreditsFile (); std::string GetProxyMakefileTree () const; void GenerateProxyMakefiles (); void CheckAutomaticDependencies ();
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 Wed Oct 31 18:54:27 2007 @@ -59,3 +59,20 @@ AutoManifest::ProcessXML() { } + +InstallComponent::InstallComponent ( const XMLElement& node_, + const Module& module_, + const FileLocation& file_ ) + : node(node_), module(module_), file(file_) +{ +} + +void +InstallComponent::ProcessXML() +{ + const XMLAttribute* att = node.GetAttribute ( "section", false ); + if ( att != NULL ) + section = att->value; + else + section = "DefaultInstall"; +}
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 Wed Oct 31 18:54:27 2007 @@ -249,7 +249,8 @@ cplusplus (false), host (HostDefault), autoManifest (NULL), - autoResource (NULL) + autoResource (NULL), + installComponent (NULL) { if ( node.name != "module" ) throw InvalidOperationException ( __FILE__, @@ -528,6 +529,8 @@ delete linkerFlags[i]; for ( i = 0; i < stubbedComponents.size(); i++ ) delete stubbedComponents[i]; + //if ( installComponent ) + // delete installComponent; if ( linkerScript ) delete linkerScript; if ( pch ) @@ -575,6 +578,8 @@ for ( i = 0; i < stubbedComponents.size(); i++ ) stubbedComponents[i]->ProcessXML(); non_if_data.ProcessXML(); + if ( installComponent ) + installComponent->ProcessXML(); if ( linkerScript ) linkerScript->ProcessXML(); if ( pch ) @@ -898,6 +903,30 @@
localizations.push_back ( localization ); subs_invalid = true; + } + else if ( e.name == "installcomponent" ) + { + if ( parseContext.ifData ) + { + throw XMLInvalidBuildFileException ( + e.location, + "<installcomponent> is not a valid sub-element of <if>" ); + } + size_t pos = e.value.find_last_of ( "/\" ); + if ( pos == string::npos ) + { + installComponent = new InstallComponent ( + e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) ); + } + else + { + string dir = e.value.substr ( 0, pos ); + string name = e.value.substr ( pos + 1); + installComponent = new InstallComponent ( + e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) ); + } + + subs_invalid = false; } else if ( e.name == "linkerscript" ) { @@ -1671,6 +1700,50 @@ { }
+Contributor::Contributor ( const XMLElement& _node) + : node (_node) +{ + ProcessXML(); +} + +void +Contributor::ProcessXML() +{ + const XMLAttribute* att = node.GetAttribute ( "alias", true ); + assert(att); + alias = att->value; + + att = node.GetAttribute ( "firstname", true ); + if (att != NULL) + firstName = att->value; + else + firstName = ""; + + att = node.GetAttribute ( "lastname", true ); + if (att != NULL) + lastName = att->value; + else + lastName = ""; + + att = node.GetAttribute ( "mail", false ); + if (att != NULL) + mail = att->value; + else + mail = ""; + + att = node.GetAttribute ( "city", false ); + if (att != NULL) + city = att->value; + else + city = ""; + + att = node.GetAttribute ( "country", false ); + if (att != NULL) + country = att->value; + else + country = ""; +} + /* AuthorRole Author::GetAuthorRole ( const string& location, const XMLAttribute& attribute ) @@ -1695,6 +1768,7 @@ ProcessXML (); }
+/* Author::Author ( const XMLElement& _node , const Module& module_) : node (_node), module(module_) , role (Developer) { @@ -1703,7 +1777,7 @@ //role = GetAuthorRole(_node.location , *att);
ProcessXML (); -} +}*/
void Author::ProcessXML()
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 Wed Oct 31 18:54:27 2007 @@ -91,3 +91,52 @@
free ( buf ); } + + +CreditsGenerator::CreditsGenerator ( const Project& project ) + : project ( project ) +{ +} + +CreditsGenerator::~CreditsGenerator () +{ +} + +void +CreditsGenerator::Generate () +{ + char* buf; + char* s; + + buf = (char*) malloc ( 512*1024 ); + if ( buf == NULL ) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "ReactOS is available thanks to the work of:\n\n"); + + for ( size_t i = 0; i < project.contributors.size (); i++ ) + { + Contributor& contributor = *project.contributors[i]; + + s = s + sprintf ( s, "\t%s %s (%s)\n" , + contributor.firstName.c_str() , + contributor.lastName.c_str() , + contributor.alias.c_str()); + + s = s + sprintf ( s, "\t\t%s\n" , contributor.mail.c_str()); + + if (strlen(contributor.city.c_str()) > 0 && + strlen(contributor.country.c_str()) > 0) + { + s = s + sprintf ( s, "\t\t%s,%s\n\n" , + contributor.city.c_str() , + contributor.country.c_str()); + } + } + + + FileSupportCode::WriteIfChanged ( buf, NormalizeFilename ( Environment::GetIntermediatePath () + sSep + "CREDITS" ) ); + + free ( buf ); +}
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 Wed Oct 31 18:54:27 2007 @@ -489,6 +489,12 @@ languages.push_back ( language ); subs_invalid = true; } + else if ( e.name == "contributor" ) + { + Contributor* contributor = new Contributor ( e ); + contributors.push_back ( contributor ); + 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 Wed Oct 31 18:54:27 2007 @@ -107,13 +107,16 @@ class AutoRegister; class ModulesResourceGenerator; class ModulesResourceGenerator; +class CreditsGenerator; class SourceFileTest; class Metadata; class Language; +class Contributor; class Localization; class Author; class AutoManifest; class AutoResource; +class InstallComponent;
typedef std::mapstd::string,Directory* directory_map;
@@ -262,6 +265,7 @@ std::vector<InstallFile*> installfiles; std::vector<Module*> modules; std::vector<Language*> languages; + std::vector<Contributor*> contributors; IfableData non_if_data; ArchitectureType GetArchitectureType ( const std::string& location, const XMLAttribute& attribute ); @@ -394,6 +398,7 @@ FileLocation *install; AutoManifest* autoManifest; AutoResource* autoResource; + InstallComponent* installComponent;
Module ( const Project& project, const XMLElement& moduleNode, @@ -633,6 +638,22 @@ void ProcessXML (); };
+class Contributor +{ +public: + const XMLElement& node; + std::string alias; + std::string firstName; + std::string lastName; + std::string mail; + std::string city; + std::string country; + + Contributor ( const XMLElement& _node); + + void ProcessXML (); +}; + class Author { public: @@ -641,13 +662,10 @@ std::string alias; AuthorRole role;
- Author ( const XMLElement& _node, const Module& module ); + //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 @@ -737,6 +755,21 @@ const Module& module, const FileLocation& file ); ~LinkerScript (); + void ProcessXML(); +}; + +class InstallComponent +{ +public: + const XMLElement& node; + const Module& module; + FileLocation file; + std::string section; + + InstallComponent ( const XMLElement& node, + const Module& module, + const FileLocation& file ); + ~InstallComponent (); void ProcessXML(); };
@@ -1070,7 +1103,9 @@ private: std::string GetDirectoryId ( const Module& module ); std::string GetFlags ( const Module& module ); - void Generate ( HINF inf, + void GenerateAutoRegister ( HINF inf, + const Module& module ); + void GenerateInstallComponent ( HINF inf, const Module& module ); };
@@ -1094,6 +1129,16 @@ void Generate (); private: void WriteManifestFile ( Module& module ); +}; + +class CreditsGenerator +{ +public: + const Project& project; + CreditsGenerator ( const Project& project ); + ~CreditsGenerator (); + void Generate (); +private: };
extern void
Modified: branches/rbuild/reactos/tools/rbuild/syssetupgenerator.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/syss... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/syssetupgenerator.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/syssetupgenerator.cpp Wed Oct 31 18:54:27 2007 @@ -48,7 +48,14 @@ { const Module& module = *project.modules[i]; if ( module.autoRegister != NULL ) - Generate ( inf, module ); + GenerateAutoRegister ( inf, module ); + } + + for ( size_t i = 0; i < project.modules.size (); i++ ) + { + const Module& module = *project.modules[i]; + if ( module.installComponent != NULL ) + GenerateInstallComponent ( inf, module ); }
if ( 0 != InfHostWriteFile ( inf, syssetup.c_str (), "" ) ) @@ -89,7 +96,7 @@ }
void -SysSetupGenerator::Generate ( HINF inf, +SysSetupGenerator::GenerateAutoRegister ( HINF inf, const Module& module ) { PINFCONTEXT context; @@ -115,3 +122,29 @@
InfHostFreeContext ( context ); } + + +void +SysSetupGenerator::GenerateInstallComponent ( HINF inf, + const Module& module ) +{ + PINFCONTEXT context; + + if ( 0 != InfHostFindOrAddSection ( inf, "Infs.Always", &context ) ) + { + throw new Exception ( ".inf section 'Infs.Always' not found" ); + InfHostCloseFile ( inf ); + } + + if ( 0 != InfHostAddLine ( context, NULL ) || + 0 != InfHostAddField ( context, module.installComponent->file.name.c_str()) || + 0 != InfHostAddField ( context, module.installComponent->section.c_str())) + { + InfHostFreeContext ( context ); + InfHostCloseFile ( inf ); + throw InvalidOperationException ( __FILE__, + __LINE__ ); + } + + InfHostFreeContext ( context ); +}