[ros-diffs] [cfinck] 28304: Metadata enhancement for rbuild and version report by Marc Piulachs (marc DOT piulachs AT codexchange DOT net) See issue #2547 for more details.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sun Aug 12 21:17:01 CEST 2007


Author: cfinck
Date: Sun Aug 12 23:17:00 2007
New Revision: 28304

URL: http://svn.reactos.org/svn/reactos?rev=28304&view=rev
Log:
Metadata enhancement for rbuild and version report by Marc Piulachs (marc DOT piulachs AT codexchange DOT net)
See issue #2547 for more details.

Added:
    trunk/reactos/tools/rbuild/backend/versionreport/
    trunk/reactos/tools/rbuild/backend/versionreport/versionreport.cpp
    trunk/reactos/tools/rbuild/backend/versionreport/versionreport.h
    trunk/reactos/vreport.xsl
Modified:
    trunk/reactos/Makefile
    trunk/reactos/base/applications/screensavers/logon/logon.rbuild
    trunk/reactos/base/applications/screensavers/starfield/starfield.rbuild
    trunk/reactos/dll/win32/acledit/acledit.rbuild
    trunk/reactos/dll/win32/comctl32/comctl32.rbuild
    trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild
    trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild
    trunk/reactos/tools/rbuild/module.cpp
    trunk/reactos/tools/rbuild/rbuild.h
    trunk/reactos/tools/rbuild/rbuild.mak

Modified: trunk/reactos/Makefile
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/Makefile?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/Makefile (original)
+++ trunk/reactos/Makefile Sun Aug 12 23:17:00 2007
@@ -486,6 +486,11 @@
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) depmap
 
+.PHONY: vreport
+vreport:$(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) vreport
+
 .PHONY: msvc
 msvc: $(RBUILD_TARGET)
 	$(ECHO_RBUILD)

Modified: trunk/reactos/base/applications/screensavers/logon/logon.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/screensavers/logon/logon.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/base/applications/screensavers/logon/logon.rbuild (original)
+++ trunk/reactos/base/applications/screensavers/logon/logon.rbuild Sun Aug 12 23:17:00 2007
@@ -12,6 +12,8 @@
 	<library>glu32</library>
 	<library>winmm</library>
 
+	<metadata description = "Default ReactOS Logo screensaver" />
+
 	<file>logon.c</file>
 	<file>logon.rc</file>
 </module>

Modified: trunk/reactos/base/applications/screensavers/starfield/starfield.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/screensavers/starfield/starfield.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/base/applications/screensavers/starfield/starfield.rbuild (original)
+++ trunk/reactos/base/applications/screensavers/starfield/starfield.rbuild Sun Aug 12 23:17:00 2007
@@ -8,6 +8,8 @@
 	<library>user32</library>
 	<library>gdi32</library>
 
+	<metadata description = "Starfield simulation screensaver" />
+
 	<file>screensaver.c</file>
 	<file>starfield.rc</file>
 </module>

Modified: trunk/reactos/dll/win32/acledit/acledit.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/acledit/acledit.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/dll/win32/acledit/acledit.rbuild (original)
+++ trunk/reactos/dll/win32/acledit/acledit.rbuild Sun Aug 12 23:17:00 2007
@@ -5,6 +5,9 @@
 	<define name="_UNICODE" />
 	<define name="__REACTOS__" />
 	<define name="__USE_W32API" />
+
+	<metadata description = "Access Control List Editor" />
+
 	<library>ntdll</library>
 	<library>kernel32</library>
 	<library>advapi32</library>

Modified: trunk/reactos/dll/win32/comctl32/comctl32.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl32.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32.rbuild (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32.rbuild Sun Aug 12 23:17:00 2007
@@ -9,6 +9,12 @@
 	<define name="_WIN32_IE">0x600</define>
 	<define name="_WIN32_WINNT">0x501</define>
 	<define name="WINVER">0x501</define>
+
+	<metadata
+		description = "Common controls used by ReactOS"
+		version = "Autosync"
+		owner = "Wine" />
+
 	<library>wine</library>
 	<library>user32</library>
 	<library>gdi32</library>

Modified: trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild (original)
+++ trunk/reactos/dll/win32/comdlg32/comdlg32.rbuild Sun Aug 12 23:17:00 2007
@@ -8,6 +8,12 @@
 	<define name="_WIN32_IE">0x600</define>
 	<define name="_WIN32_WINNT">0x501</define>
 	<define name="WINVER">0x501</define>
+
+	<metadata
+		description = "Common dialog boxes used by ReactOS"
+		version = "Autosync"
+		owner = "Wine" />
+
 	<library>wine</library>
 	<library>shell32</library>
 	<library>shlwapi</library>

Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild (original)
+++ trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild Sun Aug 12 23:17:00 2007
@@ -19,6 +19,12 @@
 	<library>advapi32</library>
 	<library>iphlpapi</library>
 	<library>pseh</library>
+
+	<metadata
+		description = "Support for the RPC layer of RPC over HTTP"
+		version = "Wine-0_9_10"
+		owner = "Wine" />
+
 	<file>cproxy.c</file>
 	<file>cpsf.c</file>
 	<file>cstub.c</file>

Added: trunk/reactos/tools/rbuild/backend/versionreport/versionreport.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/versionreport/versionreport.cpp?rev=28304&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/versionreport/versionreport.cpp (added)
+++ trunk/reactos/tools/rbuild/backend/versionreport/versionreport.cpp Sun Aug 12 23:17:00 2007
@@ -1,0 +1,128 @@
+/*
+ * Copyright (C) 2007 Marc Piulachs (marc.piulachs [at] codexchange [dot] net)
+ *
+ * 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.
+ */
+#ifdef _MSC_VER
+#pragma warning ( disable : 4786 )
+#endif//_MSC_VER
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <map>
+
+#include <stdio.h>
+
+#include "versionreport.h"
+#include "../mingw/mingw.h"
+
+using std::string;
+using std::vector;
+using std::map;
+using std::ifstream;
+
+#ifdef OUT
+#undef OUT
+#endif//OUT
+
+
+static class VReportFactory : public Backend::Factory
+{
+	public:
+
+		VReportFactory() : Factory("VReport", "Version Report") {}
+		Backend *operator() (Project &project,
+		                     Configuration& configuration)
+		{
+			return new VReportBackend(project, configuration);
+		}
+		
+} factory;
+
+
+VReportBackend::VReportBackend(Project &project,
+	Configuration& configuration) : Backend(project, configuration)
+{
+
+}
+
+void VReportBackend::Process()
+{
+	string filename_depmap ( "versionreport.xml" );
+	printf ( "Creating version report: %s\n", filename_depmap.c_str() );
+
+	m_VReportFile = fopen ( filename_depmap.c_str(), "wb" );
+
+	if ( !m_VReportFile )
+	{
+		printf ( "Could not create file '%s'.\n", filename_depmap.c_str() );
+		return;
+	}
+
+	GenerateReport ( m_VReportFile );
+
+	fclose ( m_VReportFile );
+	printf ( "Done.\n" );
+}
+
+void
+VReportBackend::CleanFiles ( void )
+{
+	remove ( "versionreport.xml" );
+}
+
+void
+VReportBackend::GenerateReport ( FILE* OUT )
+{
+	fprintf ( m_VReportFile, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\r\n" );
+	fprintf ( m_VReportFile, "<?xml-stylesheet type=\"text/xsl\" href=\"vreport.xsl\"?>\r\n" );
+	fprintf ( m_VReportFile, "<components>\r\n" );
+
+	for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )
+	{
+		Module& module = *ProjectNode.modules[i];
+		if ((module.type != Iso) && 
+			(module.type != LiveIso) &&
+			(module.type != IsoRegTest) &&
+			(module.type != LiveIsoRegTest))
+		{
+			Module& module = *ProjectNode.modules[i];
+				
+			if (module.metadata)
+			{
+				if (module.metadata->version.length() > 0)
+				{
+					fprintf ( m_VReportFile, "\t<component>\r\n" );
+					fprintf ( m_VReportFile, "\t\t<name>%s</name>\r\n", module.name.c_str () );
+					fprintf ( m_VReportFile, "\t\t<base>%s</base>\r\n", module.GetBasePath().c_str () );
+					fprintf ( m_VReportFile, "\t\t<version>%s</version>\r\n", module.metadata->version.c_str () );
+					fprintf ( m_VReportFile, "\t\t<date>%s</date>\r\n", module.metadata->date.c_str () );
+					fprintf ( m_VReportFile, "\t\t<owner>%s</owner>\r\n", module.metadata->owner.c_str () );
+					fprintf ( m_VReportFile, "\t</component>\r\n" );
+				}
+			}
+		}
+	}
+
+	fprintf ( m_VReportFile, "</components>" );
+}
+
+
+VReportConfiguration::VReportConfiguration ( const std::string &name )
+{
+	/* nothing to do here */
+}

Added: trunk/reactos/tools/rbuild/backend/versionreport/versionreport.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/versionreport/versionreport.h?rev=28304&view=auto
==============================================================================
--- trunk/reactos/tools/rbuild/backend/versionreport/versionreport.h (added)
+++ trunk/reactos/tools/rbuild/backend/versionreport/versionreport.h Sun Aug 12 23:17:00 2007
@@ -1,0 +1,68 @@
+/*
+ * Copyright (C) 2007 Marc Piulachs (marc.piulachs [at] codexchange [dot] net)
+ *
+ * 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.
+ */
+#ifndef __VREPORT_H__
+#define __VREPORT_H__
+
+#include <fstream>
+#include <vector>
+#include <string>
+
+#include "../backend.h"
+
+class VReportConfiguration
+{
+	public:
+		VReportConfiguration(const std::string &name = "");
+		virtual ~VReportConfiguration() {}
+		std::string name;
+};
+
+class VReportBackend : public Backend
+{
+	public:
+
+		VReportBackend(Project &project,
+		              Configuration& configuration);
+		virtual ~VReportBackend() {}
+
+		virtual void Process();
+
+	private:
+
+		FILE* m_VReportFile;
+
+		std::vector<VReportConfiguration*> m_configurations;
+		
+		void GenerateReport ( FILE* OUT );
+		void CleanFiles ( void );
+
+		struct module_data
+		{
+			std::vector <std::string> libraries;
+			std::vector <std::string> references;
+		
+			module_data()
+			{}
+			~module_data()
+			{}
+		};
+
+};
+
+
+#endif // __VREPORT_H__

Modified: trunk/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Sun Aug 12 23:17:00 2007
@@ -250,6 +250,7 @@
 	: project (project),
 	  node (moduleNode),
 	  importLibrary (NULL),
+	  metadata (NULL),
 	  bootstrap (NULL),
 	  autoRegister(NULL),
 	  linkerScript (NULL),
@@ -657,6 +658,17 @@
 		else
 			non_if_data.defines.push_back ( pDefine );
 		subs_invalid = true;
+	}
+	else if ( e.name == "metadata" )
+	{
+		if ( parseContext.ifData )
+		{
+			throw XMLInvalidBuildFileException (
+				e.location,
+				"<metadata> is not a valid sub-element of <if>" );
+		}
+		metadata = new Metadata ( e, *this );
+		subs_invalid = false;
 	}
 	else if ( e.name == "invoke" )
 	{
@@ -1469,6 +1481,61 @@
 }
 
 
+Metadata::Metadata ( const XMLElement& _node,
+                     const Module& _module )
+	: node (_node),
+	  module (_module)
+{
+	/* The module name */
+	const XMLAttribute* att = _node.GetAttribute ( "name", false );
+	if (att != NULL)
+		name = att->value;
+	else
+		name = module.name;
+
+	/* The module description */
+	att = _node.GetAttribute ( "description", false );
+	if (att != NULL)
+		description = att->value;
+	else
+		description = "";
+
+	/* The module version */
+	att = _node.GetAttribute ( "version", false );
+	if (att != NULL)
+		version = att->value;
+	else
+		version = "";
+
+	/* The module copyright */
+	att = _node.GetAttribute ( "copyright", false );
+	if (att != NULL)
+		copyright = att->value;
+	else
+		copyright = "";
+
+	att = _node.GetAttribute ( "url", false );
+	if (att != NULL)
+		url = att->value;
+	else
+		url = "";
+
+	/* When was this module updated */
+	att = _node.GetAttribute ( "date", false );
+	if (att != NULL)
+		date = att->value;
+	else
+		date = "?";
+
+	/* When was this module updated */
+	att = _node.GetAttribute ( "owner", false );
+	if (att != NULL)
+		owner = att->value;
+	else
+		owner = "ReactOS";
+}
+
+
 ImportLibrary::ImportLibrary ( const XMLElement& _node,
                                const Module& _module )
 	: node (_node),

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Sun Aug 12 23:17:00 2007
@@ -101,7 +101,7 @@
 class AutoRegister;
 
 class SourceFileTest;
-
+class Metadata;
 
 typedef std::map<std::string,Directory*> directory_map;
 
@@ -298,6 +298,7 @@
 	std::string path;
 	ModuleType type;
 	ImportLibrary* importLibrary;
+	Metadata* metadata;
 	bool mangledSymbols;
 	bool underscoreSymbols;
 	bool isUnicode;
@@ -502,6 +503,24 @@
 	void ProcessXML();
 };
 
+class Metadata
+{
+public:
+	const XMLElement& node;
+	const Module& module;
+	std::string name;
+	std::string description;
+	std::string version;
+	std::string copyright;
+	std::string url;
+	std::string date;
+	std::string owner;
+
+	Metadata ( const XMLElement& _node,
+	          const Module& _module );
+
+	void ProcessXML();
+};
 
 class ImportLibrary
 {

Modified: trunk/reactos/tools/rbuild/rbuild.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.mak?rev=28304&r1=28303&r2=28304&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.mak (original)
+++ trunk/reactos/tools/rbuild/rbuild.mak Sun Aug 12 23:17:00 2007
@@ -154,6 +154,23 @@
 	${mkdir} $@
 endif
 
+RBUILD_VREPORT_BASE = $(RBUILD_BACKEND_BASE_)versionreport
+RBUILD_VREPORT_BASE_ = $(RBUILD_VREPORT_BASE)$(SEP)
+RBUILD_VREPORT_INT = $(INTERMEDIATE_)$(RBUILD_VREPORT_BASE)
+RBUILD_VREPORT_INT_ = $(RBUILD_VREPORT_INT)$(SEP)
+RBUILD_VREPORT_OUT = $(OUTPUT_)$(RBUILD_VREPORT_BASE)
+RBUILD_VREPORT_OUT_ = $(RBUILD_VREPORT_OUT)$(SEP)
+
+$(RBUILD_VREPORT_INT): | $(RBUILD_BACKEND_INT)
+	$(ECHO_MKDIR)
+	${mkdir} $@
+
+ifneq ($(INTERMEDIATE),$(OUTPUT))
+$(RBUILD_VREPORT_OUT): | $(RBUILD_BACKEND_OUT)
+	$(ECHO_MKDIR)
+	${mkdir} $@
+endif
+
 
 RBUILD_MSVC_BASE = $(RBUILD_BACKEND_BASE_)msvc
 RBUILD_MSVC_BASE_ = $(RBUILD_MSVC_BASE)$(SEP)
@@ -197,6 +214,10 @@
 	dependencymap.cpp \
 	)
 
+RBUILD_BACKEND_VREPORT_BASE_SOURCES = $(addprefix $(RBUILD_VREPORT_BASE_), \
+	versionreport.cpp \
+	)
+
 RBUILD_BACKEND_MSBUILD_BASE_SOURCES = $(addprefix $(RBUILD_MSBUILD_BASE_), \
 	msbuild.cpp \
 	)
@@ -214,6 +235,7 @@
 	$(RBUILD_BACKEND_MSVC_BASE_SOURCES) \
 	$(RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES) \
 	$(RBUILD_BACKEND_DEPMAP_BASE_SOURCES) \
+	$(RBUILD_BACKEND_VREPORT_BASE_SOURCES) \
 	$(RBUILD_BACKEND_MSBUILD_BASE_SOURCES) \
 	$(RBUILD_BACKEND_BASE_)backend.cpp
 
@@ -273,6 +295,9 @@
 RBUILD_BACKEND_DEPMAP_HEADERS = \
 	dependencymap.h
 
+RBUILD_BACKEND_VREPORT_HEADERS = \
+	versionreport.h
+
 RBUILD_BACKEND_MSBUILD_HEADERS = \
 	msbuild.h
 
@@ -287,6 +312,7 @@
 	$(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS)) \
 	$(addprefix codeblocks$(SEP), $(RBUILD_BACKEND_CODEBLOCKS_HEADERS)) \
 	$(addprefix msbuild$(SEP), $(RBUILD_BACKEND_MSBUILD_HEADERS)) \
+	$(addprefix versionreport$(SEP), $(RBUILD_BACKEND_VREPORT_HEADERS)) \
 	$(addprefix dependencymap$(SEP), $(RBUILD_BACKEND_DEPMAP_HEADERS))
 
 RBUILD_HEADERS = \
@@ -460,6 +486,10 @@
 	$(ECHO_CC)
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 
+$(RBUILD_VREPORT_INT_)versionreport.o: $(RBUILD_VREPORT_BASE_)versionreport.cpp $(RBUILD_HEADERS) | $(RBUILD_VREPORT_INT)
+	$(ECHO_CC)
+	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+
 $(RBUILD_MSBUILD_INT_)msbuild.o: $(RBUILD_MSBUILD_BASE_)msbuild.cpp $(RBUILD_HEADERS) | $(RBUILD_MSBUILD_INT)
 	$(ECHO_CC)
 	${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@

Added: trunk/reactos/vreport.xsl
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/vreport.xsl?rev=28304&view=auto
==============================================================================
--- trunk/reactos/vreport.xsl (added)
+++ trunk/reactos/vreport.xsl Sun Aug 12 23:17:00 2007
@@ -1,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/">
+<html>
+<head>
+<title>ReactOS Component Version Report</title>
+</head>
+<body>
+<h1>ReactOS Component Version Report</h1>
+<table border="1">
+  <tr bgcolor="#9acd32">
+    <th align="left">Module Name</th>
+    <th align="left">Module Location</th>
+    <th align="left">Version</th>
+    <th align="left">Date</th>
+    <th align="left">Owner</th>
+  </tr>
+  <xsl:for-each select="components/component">
+    <tr>
+      <td><xsl:value-of select="name"/></td>
+      <td><xsl:value-of select="base"/></td>
+      <td><xsl:value-of select="version"/></td>
+      <td><xsl:value-of select="date"/></td>
+      <td><xsl:value-of select="owner"/></td>
+    </tr>
+    </xsl:for-each>
+    </table>
+  </body>
+  </html>
+</xsl:template>
+
+</xsl:stylesheet>




More information about the Ros-diffs mailing list