mirror of
https://github.com/boostorg/boostdep.git
synced 2026-01-19 04:02:14 +00:00
Add support for --html-stylesheet, --html-prefix; rename --title to --html-title, --footer to --html-footer
This commit is contained in:
@@ -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="<div class='logo'><div class='upper'>boost</div><div class='lower'>Dependency Report</div><div class='description'>%BRANCH%-%SHREV%, %DATE% %TIME%</div></div><hr />"
|
||||
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
|
||||
|
||||
24
examples/report.css
Normal file
24
examples/report.css
Normal file
@@ -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; }
|
||||
160
src/boostdep.cpp
160
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 << "<h1>Module Levels</h1>\n";
|
||||
std::cout << "<div id='module-levels'><h1>Module Levels</h1>\n";
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
std::cout << "</div>\n";
|
||||
}
|
||||
|
||||
void level_start( int level )
|
||||
@@ -1090,29 +1102,23 @@ struct module_level_html_actions: public module_level_actions
|
||||
std::cout << level;
|
||||
}
|
||||
|
||||
std::cout << "</h2><ul>\n";
|
||||
std::cout << "</h2>\n";
|
||||
|
||||
level_ = level;
|
||||
}
|
||||
|
||||
void level_end( int /*level*/ )
|
||||
{
|
||||
std::cout << " </ul>\n";
|
||||
}
|
||||
|
||||
void module_start( std::string const & module )
|
||||
{
|
||||
std::cout << " <li><a href=\"" << module << ".html\">" << module << "</a><small>";
|
||||
|
||||
if( level_ > 0 )
|
||||
{
|
||||
std::cout << "<br />⇢";
|
||||
}
|
||||
std::cout << " <h3><a href=\"" << module << ".html\">" << module << "</a></h3><p class='primary-list'>";
|
||||
}
|
||||
|
||||
void module_end( std::string const & /*module*/ )
|
||||
{
|
||||
std::cout << "</small></li>\n";
|
||||
std::cout << "</p>\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 << "<h1>Module Overview</h1>\n";
|
||||
std::cout << "<div id='module-overview'><h1>Module Overview</h1>\n";
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
std::cout << "</div>\n";
|
||||
}
|
||||
|
||||
void module_start( std::string const & module )
|
||||
{
|
||||
std::cout << " <h2><a href=\"" << module << ".html\"><em>" << module << "</em></a></h2><p><small>";
|
||||
deps_ = false;
|
||||
std::cout << " <h2><a href=\"" << module << ".html\"><em>" << module << "</em></a></h2><p class='primary-list'>";
|
||||
}
|
||||
|
||||
void module_end( std::string const & /*module*/ )
|
||||
{
|
||||
std::cout << "</small></p>\n";
|
||||
std::cout << "</p>\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 << "<html>\n";
|
||||
std::cout << "<head>\n";
|
||||
std::cout << "<title>" << title << "</title>\n";
|
||||
|
||||
if( !stylesheet.empty() )
|
||||
{
|
||||
std::cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << stylesheet << "\" />\n";
|
||||
}
|
||||
|
||||
std::cout << "</head>\n";
|
||||
std::cout << "<body>\n";
|
||||
|
||||
if( !prefix.empty() )
|
||||
{
|
||||
std::cout << prefix << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
static void output_html_footer( std::string const & footer )
|
||||
{
|
||||
std::cout << "<hr />\n";
|
||||
std::cout << "<p><small>" << footer << "</small></p>\n";
|
||||
std::cout << "<p class=\"footer\">" << footer << "</p>\n";
|
||||
std::cout << "</body>\n";
|
||||
std::cout << "</html>\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 << "<h1>Module Weights</h1>\n";
|
||||
std::cout << "<div id='module-weights'>\n<h1>Module Weights</h1>\n";
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
std::cout << "</div>\n";
|
||||
}
|
||||
|
||||
void weight_start( int weight )
|
||||
{
|
||||
std::cout << " <h2>Weight " << weight << "</h2><ul>\n";
|
||||
std::cout << " <h2>Weight " << weight << "</h2>\n";
|
||||
weight_ = weight;
|
||||
}
|
||||
|
||||
void weight_end( int /*weight*/ )
|
||||
{
|
||||
std::cout << " </ul>\n";
|
||||
}
|
||||
|
||||
void module_start( std::string const & module )
|
||||
{
|
||||
std::cout << " <li><a href=\"" << module << ".html\">" << module << "</a><small>";
|
||||
std::cout << " <h3><a href=\"" << module << ".html\">" << module << "</a></h3>";
|
||||
}
|
||||
|
||||
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 << "<br />⇢";
|
||||
std::cout << "<p class='primary-list'>";
|
||||
}
|
||||
|
||||
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 << "</p>";
|
||||
}
|
||||
|
||||
void module_secondary_start()
|
||||
{
|
||||
std::cout << "<br /><span style=\"padding-left: 1em;\">⇢";
|
||||
std::cout << "<p class='secondary-list'>";
|
||||
}
|
||||
|
||||
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 << "</span>";
|
||||
std::cout << "</p>";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2275,7 +2311,9 @@ int main( int argc, char const* argv[] )
|
||||
" boostdep --pkgconfig <module> <version> [<var>=<value>] [<var>=<value>]...\n"
|
||||
"\n"
|
||||
" [options]: [--[no-]track-sources] [--[no-]track-tests]\n"
|
||||
" [--title <title>] [--footer <footer>] [--html]\n";
|
||||
" [--html-title <title>] [--html-footer <footer>]\n"
|
||||
" [--html-stylesheet <stylesheet>] [--html-prefix <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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user