From: Teemu Murtola Date: Fri, 5 Sep 2014 17:44:03 +0000 (+0300) Subject: Make doc-check fail the build on warnings X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?p=alexxy%2Fgromacs.git;a=commitdiff_plain;h=b7b0dd55e72ea9e54cc40e5c708524a5e92971af Make doc-check fail the build on warnings This makes it easier to run it in Jenkins, even if it makes it work inconsistently compared to the Doxygen targets. Change-Id: Ifc469fb598f1f3287bc1a5dded231b304023a810 --- diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt index 264f11446e..95c73442c4 100644 --- a/docs/doxygen/CMakeLists.txt +++ b/docs/doxygen/CMakeLists.txt @@ -128,6 +128,7 @@ if (DOXYGEN_FOUND) -S ${CMAKE_SOURCE_DIR} -B ${CMAKE_BINARY_DIR} --installed ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt -l ${CMAKE_CURRENT_BINARY_DIR}/doxygen-check.log + --exitcode --ignore ${CMAKE_CURRENT_SOURCE_DIR}/suppressions.txt --ignore-cycles ${CMAKE_CURRENT_SOURCE_DIR}/cycle-suppressions.txt) add_custom_target(doc-check COMMAND ${doc_check_command} diff --git a/docs/doxygen/doxygen-check.py b/docs/doxygen/doxygen-check.py index 50a7727d29..db560720cc 100755 --- a/docs/doxygen/doxygen-check.py +++ b/docs/doxygen/doxygen-check.py @@ -354,6 +354,8 @@ def main(): help='Issue notes for comments ignored by Doxygen') parser.add_option('-q', '--quiet', action='store_true', help='Do not write status messages') + parser.add_option('--exitcode', action='store_true', + help='Return non-zero exit code if there are warnings') options, args = parser.parse_args() installedlist = [] @@ -401,4 +403,7 @@ def main(): reporter.report_unused_filters() reporter.close_log() + if options.exitcode and reporter.had_warnings(): + sys.exit(1) + main() diff --git a/docs/doxygen/reporter.py b/docs/doxygen/reporter.py index 9be3cdae66..14e2bfbd88 100644 --- a/docs/doxygen/reporter.py +++ b/docs/doxygen/reporter.py @@ -165,6 +165,7 @@ class Reporter(object): self._messages = [] self._filters = [] self._quiet = quiet + self._had_warnings = False def _write(self, message): """Implement actual message writing.""" @@ -178,6 +179,7 @@ class Reporter(object): sys.stderr.write(wholemsg) if self._logfp: self._logfp.write(wholemsg) + self._had_warnings = True def _report(self, message): """Handle a single reporter message.""" @@ -215,6 +217,10 @@ class Reporter(object): text = 'warning: unused filter: ' + filterobj.get_text() self._write(Message(text)) + def had_warnings(self): + """Return true if any warnings have been reported.""" + return self._had_warnings + def close_log(self): """Close the log file if one exists.""" assert not self._messages