2 * Copyright (C) 2007 Marc Piulachs (marc.piulachs [at] codexchange [dot] net)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #pragma warning ( disable : 4786 )
30 #include "versionreport.h"
31 #include "../mingw/mingw.h"
43 static class VReportFactory
: public Backend::Factory
47 VReportFactory() : Factory("VReport", "Version Report") {}
48 Backend
*operator() (Project
&project
,
49 Configuration
& configuration
)
51 return new VReportBackend(project
, configuration
);
57 VReportBackend::VReportBackend(Project
&project
,
58 Configuration
& configuration
) : Backend(project
, configuration
)
63 void VReportBackend::Process()
65 string
filename_depmap ( "versionreport.xml" );
66 printf ( "Creating version report: %s\n", filename_depmap
.c_str() );
68 m_VReportFile
= fopen ( filename_depmap
.c_str(), "wb" );
72 printf ( "Could not create file '%s'.\n", filename_depmap
.c_str() );
76 GenerateReport ( m_VReportFile
);
78 fclose ( m_VReportFile
);
83 VReportBackend::CleanFiles ( void )
85 remove ( "versionreport.xml" );
89 VReportBackend::GenerateReport ( FILE* OUT
)
91 fprintf ( m_VReportFile
, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\r\n" );
92 fprintf ( m_VReportFile
, "<?xml-stylesheet type=\"text/xsl\" href=\"vreport.xsl\"?>\r\n" );
93 fprintf ( m_VReportFile
, "<components>\r\n" );
95 for( std::map
<std::string
, Module
*>::const_iterator p
= ProjectNode
.modules
.begin(); p
!= ProjectNode
.modules
.end(); ++ p
)
97 Module
& module
= *p
->second
;
98 if ((module
.type
!= Iso
) &&
99 (module
.type
!= LiveIso
) &&
100 (module
.type
!= IsoRegTest
) &&
101 (module
.type
!= LiveIsoRegTest
))
103 Module
& module
= *p
->second
;
107 if (module
.metadata
->version
.length() > 0)
109 fprintf ( m_VReportFile
, "\t<component>\r\n" );
110 fprintf ( m_VReportFile
, "\t\t<name>%s</name>\r\n", module
.name
.c_str () );
111 fprintf ( m_VReportFile
, "\t\t<base>%s</base>\r\n", module
.output
->relative_path
.c_str () );
112 fprintf ( m_VReportFile
, "\t\t<version>%s</version>\r\n", module
.metadata
->version
.c_str () );
113 fprintf ( m_VReportFile
, "\t\t<date>%s</date>\r\n", module
.metadata
->date
.c_str () );
114 fprintf ( m_VReportFile
, "\t\t<owner>%s</owner>\r\n", module
.metadata
->owner
.c_str () );
115 fprintf ( m_VReportFile
, "\t</component>\r\n" );
121 fprintf ( m_VReportFile
, "</components>" );
125 VReportConfiguration::VReportConfiguration ( const std::string
&name
)
127 /* nothing to do here */