diff --git a/examples/report.bat b/examples/report.bat
index ad805d4..c244177 100644
--- a/examples/report.bat
+++ b/examples/report.bat
@@ -4,7 +4,7 @@
@REM
@REM It needs to be run from the Boost root.
@REM
-@REM Copyright 2014, 2015 Peter Dimov
+@REM Copyright 2014, 2015, 2017 Peter Dimov
@REM
@REM Distributed under the Boost Software License, Version 1.0.
@REM See accompanying file LICENSE_1_0.txt or copy at
@@ -18,16 +18,22 @@ FOR /f %%i IN ('git rev-parse --short HEAD') DO @SET SHREV=%%i
FOR /f %%i IN ('git rev-parse --abbrev-ref HEAD') DO @SET BRANCH=%%i
-SET FOOTER=Generated on %DATE% %TIME% from revision %REV% on branch '%BRANCH%'
+REM SET FOOTER="Generated on %DATE% %TIME% from revision %BRANCH%-%SHREV%"
+SET PREFIX="
boost
Dependency Report
%BRANCH%-%SHREV%, %DATE% %TIME%
"
+SET STYLESHEET=report.css
+
+SET OPTIONS=--html-stylesheet %STYLESHEET% --html-prefix %PREFIX%
SET OUTDIR=..\report-%BRANCH%-%SHREV%
mkdir %OUTDIR%
+COPY tools\boostdep\examples\%STYLESHEET% %OUTDIR%
+
%BOOSTDEP% --list-modules > %OUTDIR%\list-modules.txt
-%BOOSTDEP% --footer "%FOOTER%" --html --module-overview > %OUTDIR%\module-overview.html
-%BOOSTDEP% --footer "%FOOTER%" --html --module-levels > %OUTDIR%\module-levels.html
-%BOOSTDEP% --footer "%FOOTER%" --html --module-weights > %OUTDIR%\module-weights.html
+%BOOSTDEP% %OPTIONS% --html-title "Boost Module Overview" --html --module-overview > %OUTDIR%\module-overview.html
+%BOOSTDEP% %OPTIONS% --html-title "Boost Module Levels" --html --module-levels > %OUTDIR%\module-levels.html
+%BOOSTDEP% %OPTIONS% --html-title "Boost Module Weights" --html --module-weights > %OUTDIR%\module-weights.html
-FOR /f %%i IN (%OUTDIR%\list-modules.txt) DO %BOOSTDEP% --title "Dependency Report for %%i" --footer "%FOOTER%" --html --primary %%i --secondary %%i --reverse %%i > %OUTDIR%\%%i.html
+FOR /f %%i IN (%OUTDIR%\list-modules.txt) DO %BOOSTDEP% --html-title "Boost Dependency Report for %%i" %OPTIONS% --html --primary %%i --secondary %%i --reverse %%i > %OUTDIR%\%%i.html
diff --git a/examples/report.css b/examples/report.css
new file mode 100644
index 0000000..b4066b5
--- /dev/null
+++ b/examples/report.css
@@ -0,0 +1,24 @@
+/* Copyright 2017 Peter Dimov
+ Distributed under the Boost Software License, Version 1.0. */
+
+A { color: #06C; text-decoration: none; }
+A:hover { text-decoration: underline; }
+
+body { max-width: 60em; margin-left: auto; margin-right: auto; color: #4A6484; font-family: sans-serif; }
+
+.logo { font-family: sans-serif; font-style: italic; }
+.logo .upper { font-size: 48pt; font-weight: 800; }
+.logo .lower { font-size: 17pt; }
+.logo .description { font-size: small; margin-top: 2em; }
+
+.primary-list { font-size: small; }
+.secondary-list { font-size: small; }
+
+#module-overview .primary-list { margin-left: 1em; }
+
+#module-levels h3 { margin-left: 1em; }
+#module-levels .primary-list { margin-left: 2em; }
+
+#module-weights h3 { margin-left: 1em; }
+#module-weights .primary-list { margin-left: 2em; }
+#module-weights .secondary-list { margin-left: 2em; padding-left: 1em; border-left: 1px dotted; }
diff --git a/src/boostdep.cpp b/src/boostdep.cpp
index 0aa36e7..230b1ce 100644
--- a/src/boostdep.cpp
+++ b/src/boostdep.cpp
@@ -809,7 +809,8 @@ int const unknown_level = INT_MAX / 2;
struct module_level_actions
{
- virtual void heading() = 0;
+ virtual void begin() = 0;
+ virtual void end() = 0;
virtual void level_start( int level ) = 0;
virtual void level_end( int level ) = 0;
@@ -972,7 +973,7 @@ static void output_module_level_report( module_level_actions & actions )
// output report
- actions.heading();
+ actions.begin();
for( std::map< int, std::set< std::string > >::iterator i = reverse_level_map.begin(); i != reverse_level_map.end(); ++i )
{
@@ -1006,17 +1007,23 @@ static void output_module_level_report( module_level_actions & actions )
actions.level_end( i->first );
}
+
+ actions.end();
}
struct module_level_txt_actions: public module_level_actions
{
int level_;
- void heading()
+ void begin()
{
std::cout << "Module Levels:\n\n";
}
+ void end()
+ {
+ }
+
void level_start( int level )
{
if( level >= unknown_level )
@@ -1072,9 +1079,14 @@ struct module_level_html_actions: public module_level_actions
{
int level_;
- void heading()
+ void begin()
{
- std::cout << "Module Levels \n";
+ std::cout << "
Module Levels \n";
+ }
+
+ void end()
+ {
+ std::cout << "\n";
}
void level_start( int level )
@@ -1090,29 +1102,23 @@ struct module_level_html_actions: public module_level_actions
std::cout << level;
}
- std::cout << "\n";
+ std::cout << "\n";
level_ = level;
}
void level_end( int /*level*/ )
{
- std::cout << " \n";
}
void module_start( std::string const & module )
{
- std::cout << " " << module << " ";
-
- if( level_ > 0 )
- {
- std::cout << " ⇢";
- }
+ std::cout << " ";
}
void module_end( std::string const & /*module*/ )
{
- std::cout << "
\n";
+ std::cout << "\n";
}
void module2( std::string const & module, int level )
@@ -1158,7 +1164,8 @@ static void output_module_level_report( bool html )
struct module_overview_actions
{
- virtual void heading() = 0;
+ virtual void begin() = 0;
+ virtual void end() = 0;
virtual void module_start( std::string const & module ) = 0;
virtual void module_end( std::string const & module ) = 0;
@@ -1168,7 +1175,7 @@ struct module_overview_actions
static void output_module_overview_report( module_overview_actions & actions )
{
- actions.heading();
+ actions.begin();
for( std::set< std::string >::iterator i = s_modules.begin(); i != s_modules.end(); ++i )
{
@@ -1183,17 +1190,23 @@ static void output_module_overview_report( module_overview_actions & actions )
actions.module_end( *i );
}
+
+ actions.end();
}
struct module_overview_txt_actions: public module_overview_actions
{
bool deps_;
- void heading()
+ void begin()
{
std::cout << "Module Overview:\n\n";
}
+ void end()
+ {
+ }
+
void module_start( std::string const & module )
{
std::cout << module;
@@ -1219,32 +1232,28 @@ struct module_overview_txt_actions: public module_overview_actions
struct module_overview_html_actions: public module_overview_actions
{
- bool deps_;
-
- void heading()
+ void begin()
{
- std::cout << "Module Overview \n";
+ std::cout << "
Module Overview \n";
+ }
+
+ void end()
+ {
+ std::cout << "\n";
}
void module_start( std::string const & module )
{
- std::cout << " ";
- deps_ = false;
+ std::cout << "
";
}
void module_end( std::string const & /*module*/ )
{
- std::cout << "
\n";
+ std::cout << "\n";
}
void module2( std::string const & module )
{
- if( !deps_ )
- {
- std::cout << "⇢";
- deps_ = true;
- }
-
std::cout << " " << module;
}
};
@@ -1267,7 +1276,11 @@ static void output_module_overview_report( bool html )
struct list_dependencies_actions: public module_overview_actions
{
- void heading()
+ void begin()
+ {
+ }
+
+ void end()
{
}
@@ -1298,19 +1311,30 @@ static void list_dependencies()
//
-static void output_html_header( std::string const & title )
+static void output_html_header( std::string const & title, std::string const & stylesheet, std::string const & prefix )
{
std::cout << "\n";
std::cout << "\n";
std::cout << "" << title << " \n";
+
+ if( !stylesheet.empty() )
+ {
+ std::cout << " \n";
+ }
+
std::cout << "\n";
std::cout << "\n";
+
+ if( !prefix.empty() )
+ {
+ std::cout << prefix << std::endl;
+ }
}
static void output_html_footer( std::string const & footer )
{
std::cout << " \n";
- std::cout << "" << footer << "
\n";
+ std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
@@ -1355,7 +1379,8 @@ static void list_buildable()
struct module_weight_actions
{
- virtual void heading() = 0;
+ virtual void begin() = 0;
+ virtual void end() = 0;
virtual void weight_start( int weight ) = 0;
virtual void weight_end( int weight ) = 0;
@@ -1426,7 +1451,7 @@ static void output_module_weight_report( module_weight_actions & actions )
// output report
- actions.heading();
+ actions.begin();
for( std::map< int, std::set< std::string > >::const_iterator i = modules_by_weight.begin(); i != modules_by_weight.end(); ++i )
{
@@ -1467,15 +1492,21 @@ static void output_module_weight_report( module_weight_actions & actions )
actions.weight_end( i->first );
}
+
+ actions.end();
}
struct module_weight_txt_actions: public module_weight_actions
{
- void heading()
+ void begin()
{
std::cout << "Module Weights:\n\n";
}
+ void end()
+ {
+ }
+
void weight_start( int weight )
{
std::cout << "Weight " << weight << ":\n";
@@ -1529,25 +1560,29 @@ struct module_weight_html_actions: public module_weight_actions
{
int weight_;
- void heading()
+ void begin()
{
- std::cout << "Module Weights \n";
+ std::cout << "\n
Module Weights \n";
+ }
+
+ void end()
+ {
+ std::cout << "\n";
}
void weight_start( int weight )
{
- std::cout << " Weight " << weight << " \n";
+ std::cout << " Weight " << weight << " \n";
weight_ = weight;
}
void weight_end( int /*weight*/ )
{
- std::cout << " \n";
}
void module_start( std::string const & module )
{
- std::cout << " " << module << " ";
+ std::cout << " ";
}
void module_end( std::string const & /*module*/ )
@@ -1557,7 +1592,7 @@ struct module_weight_html_actions: public module_weight_actions
void module_primary_start()
{
- std::cout << " ⇢";
+ std::cout << " ";
}
void module_primary( std::string const & module, int weight )
@@ -1581,11 +1616,12 @@ struct module_weight_html_actions: public module_weight_actions
void module_primary_end()
{
+ std::cout << "
";
}
void module_secondary_start()
{
- std::cout << "⇢";
+ std::cout << "";
}
void module_secondary( std::string const & module, int /*weight*/ )
@@ -1595,7 +1631,7 @@ struct module_weight_html_actions: public module_weight_actions
void module_secondary_end()
{
- std::cout << "
";
+ std::cout << "";
}
};
@@ -2275,7 +2311,9 @@ int main( int argc, char const* argv[] )
" boostdep --pkgconfig [=] [=]...\n"
"\n"
" [options]: [--[no-]track-sources] [--[no-]track-tests]\n"
- " [--title ] [--footer ] [--html]\n";
+ " [--html-title ] [--html-footer ]\n"
+ " [--html-stylesheet ] [--html-prefix ]\n"
+ " [--html]\n";
return -1;
}
@@ -2300,8 +2338,10 @@ int main( int argc, char const* argv[] )
bool track_sources = false;
bool track_tests = false;
- std::string title = "Boost Dependency Report";
- std::string footer;
+ std::string html_title = "Boost Dependency Report";
+ std::string html_footer;
+ std::string html_stylesheet;
+ std::string html_prefix;
for( int i = 1; i < argc; ++i )
{
@@ -2315,18 +2355,32 @@ int main( int argc, char const* argv[] )
{
list_buildable();
}
- else if( option == "--title" )
+ else if( option == "--title" || option == "--html-title" )
{
if( i + 1 < argc )
{
- title = argv[ ++i ];
+ html_title = argv[ ++i ];
}
}
- else if( option == "--footer" )
+ else if( option == "--footer" || option == "--html-footer" )
{
if( i + 1 < argc )
{
- footer = argv[ ++i ];
+ html_footer = argv[ ++i ];
+ }
+ }
+ else if( option == "--html-stylesheet" )
+ {
+ if( i + 1 < argc )
+ {
+ html_stylesheet = argv[ ++i ];
+ }
+ }
+ else if( option == "--html-prefix" )
+ {
+ if( i + 1 < argc )
+ {
+ html_prefix = argv[ ++i ];
}
}
else if( option == "--html" )
@@ -2334,7 +2388,7 @@ int main( int argc, char const* argv[] )
if( !html )
{
html = true;
- output_html_header( title );
+ output_html_header( html_title, html_stylesheet, html_prefix );
}
}
else if( option == "--track-sources" )
@@ -2469,6 +2523,6 @@ int main( int argc, char const* argv[] )
if( html )
{
- output_html_footer( footer );
+ output_html_footer( html_footer );
}
}