Kokoro-Linux: fail on Doxygen warnings

Change-Id: Ib85e835ea70fd84a3cb4be03e7ff5afdd7782a82
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55641
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2021-06-25 14:00:36 +00:00 committed by Tint LUCI CQ
parent e225b556c6
commit 6241f962a1
3 changed files with 24 additions and 4 deletions

View File

@ -42,6 +42,7 @@ else()
endif() endif()
option(TINT_BUILD_DOCS "Build documentation" ${TINT_BUILD_DOCS_DEFAULT}) option(TINT_BUILD_DOCS "Build documentation" ${TINT_BUILD_DOCS_DEFAULT})
option(TINT_DOCS_WARN_AS_ERROR "When building documentation, treat warnings as errors" OFF)
option(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" ON) option(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" ON)
option(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON) option(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON)
option(TINT_BUILD_HLSL_WRITER "Build the HLSL output writer" ON) option(TINT_BUILD_HLSL_WRITER "Build the HLSL output writer" ON)
@ -62,6 +63,7 @@ option(TINT_EMIT_COVERAGE "Emit code coverage information" OFF)
option(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF) option(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF)
message(STATUS "Tint build docs: ${TINT_BUILD_DOCS}") message(STATUS "Tint build docs: ${TINT_BUILD_DOCS}")
message(STATUS "Tint build docs with warn as error: ${TINT_DOCS_WARN_AS_ERROR}")
message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}") message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}")
message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}") message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}")
message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}") message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}")
@ -143,9 +145,15 @@ endif()
if(${TINT_BUILD_DOCS}) if(${TINT_BUILD_DOCS})
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
set(DOXYGEN_WARN_AS_ERROR NO)
if(TINT_DOCS_WARN_AS_ERROR)
set(DOXYGEN_WARN_AS_ERROR YES)
endif()
add_custom_target(tint-docs ALL add_custom_target(tint-docs ALL
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-E env "DOXYGEN_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}/docs" -E env
"DOXYGEN_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}/docs"
"DOXYGEN_WARN_AS_ERROR=${DOXYGEN_WARN_AS_ERROR}"
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation" COMMENT "Generating API documentation"

View File

@ -757,7 +757,7 @@ WARN_NO_PARAMDOC = YES
# a warning is encountered. # a warning is encountered.
# The default value is: NO. # The default value is: NO.
WARN_AS_ERROR = NO WARN_AS_ERROR = $(DOXYGEN_WARN_AS_ERROR)
# The WARN_FORMAT tag determines the format of the warning messages that doxygen # The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which # can produce. The string should contain the $file, $line, and $text tags, which

View File

@ -86,6 +86,7 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
COMMON_CMAKE_FLAGS="" COMMON_CMAKE_FLAGS=""
COMMON_CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" COMMON_CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
COMMON_CMAKE_FLAGS+=" -DTINT_DOCS_WARN_AS_ERROR=ON"
if [ "$BUILD_TOOLCHAIN" == "clang" ]; then if [ "$BUILD_TOOLCHAIN" == "clang" ]; then
using clang-10.0.0 using clang-10.0.0
@ -103,10 +104,21 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
cd ${BUILD_DIR} cd ${BUILD_DIR}
status "Running Doxygen"
echo "NOTE: This will fail on first warning. Run with -DTINT_DOCS_WARN_AS_ERROR=OFF to see all warnings".
echo ""
show_cmds
# NOTE: If we upgrade Doxygen to a more recent version, we can set DOXYGEN_WARN_AS_ERROR to
# "FAIL_ON_WARNINGS" instead of "YES" in our CMakeLists.txt so see all warnings, and then
# fail. See https://www.doxygen.nl/manual/config.html#cfg_warn_as_error
cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS}
cmake --build . --target tint-docs
hide_cmds
status "Building tint" status "Building tint"
show_cmds show_cmds
cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS} cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS}
make --jobs=$(nproc) cmake --build . -- --jobs=$(nproc)
hide_cmds hide_cmds
status "Running tint_unittests" status "Running tint_unittests"
@ -122,7 +134,7 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
status "Checking _other.cc files also build" status "Checking _other.cc files also build"
show_cmds show_cmds
cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS} -DTINT_BUILD_AS_OTHER_OS=1 cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS} -DTINT_BUILD_AS_OTHER_OS=1
make --jobs=$(nproc) cmake --build . -- --jobs=$(nproc)
hide_cmds hide_cmds
else else
status "Unsupported build system: $BUILD_SYSTEM" status "Unsupported build system: $BUILD_SYSTEM"