From f67ddc7c0d8127c72970b19fabf566c4638f813c Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 2 Nov 2016 12:16:57 +0100
Subject: [PATCH] [CMake] Added option DOCS_GENERATE_LOGFILE to redirect
 Doxygen output.

This should fix crashes on Jenkins caused by long console log and
Doxygen warnings parser. See
https://issues.jenkins-ci.org/browse/JENKINS-7178
---
 Documentation/Doxyfile.in              |  2 +-
 scripts/cmake/DocumentationSetup.cmake |  5 +++++
 scripts/jenkins/docs.groovy            | 16 +++++++++-------
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
index edb501954b1..296f1dae723 100644
--- a/Documentation/Doxyfile.in
+++ b/Documentation/Doxyfile.in
@@ -769,7 +769,7 @@ WARN_FORMAT            = "$file:$line: $text"
 # messages should be written. If left blank the output is written to standard
 # error (stderr).
 
-WARN_LOGFILE           =
+WARN_LOGFILE           = ${OGS_DOXYGEN_LOGFILE}
 
 #---------------------------------------------------------------------------
 # Configuration options related to the input files
diff --git a/scripts/cmake/DocumentationSetup.cmake b/scripts/cmake/DocumentationSetup.cmake
index 884b77ab726..e7bea8c760f 100644
--- a/scripts/cmake/DocumentationSetup.cmake
+++ b/scripts/cmake/DocumentationSetup.cmake
@@ -1,6 +1,7 @@
 if(DOXYGEN_FOUND)
 
     option(DOCS_GENERATE_DOCSET "Generate Dash Docsets." OFF)
+    option(DOCS_GENERATE_LOGFILE "Outputs Doxygen warnings to a file in the build directory." OFF)
 
     set(DOT_FOUND "NO")
     if(DOXYGEN_DOT_FOUND)
@@ -36,6 +37,10 @@ if(DOXYGEN_FOUND)
         configure_file(Documentation/DocsetFeed.xml.in ${PROJECT_BINARY_DIR}/docs/ogs6.xml)
     endif()
 
+    if(DOCS_GENERATE_LOGFILE)
+        set(OGS_DOXYGEN_LOGFILE "${PROJECT_BINARY_DIR}/DoxygenWarnings.log" CACHE INTERNAL "")
+    endif()
+
     configure_file(Documentation/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)
 
     if (BASH_TOOL_PATH AND PYTHON_EXECUTABLE)
diff --git a/scripts/jenkins/docs.groovy b/scripts/jenkins/docs.groovy
index 21da21820dd..6ccfbec35b2 100644
--- a/scripts/jenkins/docs.groovy
+++ b/scripts/jenkins/docs.groovy
@@ -1,13 +1,14 @@
 def defaultCMakeOptions =
     '-DOGS_LIB_BOOST=System ' +
-    '-DOGS_LIB_VTK=System'
+    '-DOGS_LIB_VTK=System ' +
+    '-DDOCS_GENERATE_LOGFILE=ON'
 
 def configure = new ogs.configure()
 def build = new ogs.build()
 def post = new ogs.post()
 def helper = new ogs.helper()
 
-docker.image('ogs6/gcc-base:16.04').inside() {
+docker.image('ogs6/gcc-base:latest').inside() {
     stage('Configure (Docs)') {
         configure.linux 'build', "${defaultCMakeOptions}"
     }
@@ -20,11 +21,12 @@ docker.image('ogs6/gcc-base:16.04').inside() {
 stage('Reports (Docs)') {
     publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false,
         reportDir: 'build/docs', reportFiles: 'index.html', reportName: 'Doxygen'])
-    step([$class: 'WarningsPublisher', canResolveRelativePaths: false,
-        canRunOnFailed: true, consoleParsers: [[parserName: 'Doxygen']],
-        defaultEncoding: '', excludePattern: '', healthy: '',
-        includePattern: '', messagesPattern: '', unHealthy: '',
-        unstableNewAll: '0', useStableBuildAsReference: true])
+    step([$class: 'WarningsPublisher', canComputeNew: false,
+        canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '',
+        healthy: '', includePattern: '', messagesPattern: '',
+        parserConfigurations: [[parserName: 'Doxygen', pattern:
+            'build/DoxygenWarnings.log']],
+        unHealthy: ''])
 }
 
 if (helper.isOriginMaster(this)) {
-- 
GitLab