diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa076e6be..13ca70440 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -69,6 +69,13 @@ repos: # of dependencies, so we'll have to update this manually. additional_dependencies: - cmakelang==0.6.13 + - id: doxygen-check + name: doxygen-check + entry: ./scripts/doxygen.sh + types_or: [file] + language: system + pass_filenames: false + verbose: true - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.0.278 hooks: diff --git a/dependencies.yaml b/dependencies.yaml index e16d7a292..f0541ce20 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -111,6 +111,7 @@ dependencies: # pre-commit requires identify minimum version 1.0, but clang-format requires textproto support and that was # added in 2.5.20, so we need to call out the minimum version needed for our plugins - identify>=2.5.20 + - &doxygen doxygen=1.8.20 cudatoolkit: specific: - output_types: conda @@ -153,7 +154,7 @@ dependencies: common: - output_types: [conda] packages: - - doxygen=1.8.20 + - *doxygen - graphviz - ipython - make diff --git a/scripts/doxygen.sh b/scripts/doxygen.sh new file mode 100755 index 000000000..5c001fc72 --- /dev/null +++ b/scripts/doxygen.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright (c) 2023, NVIDIA CORPORATION. +############################## +# RMM doxygen warnings check # +############################## + +# skip if doxygen is not installed +if ! [ -x "$(command -v doxygen)" ]; then + echo -e "warning: doxygen is not installed" + exit 0 +fi + +# Utility to return version as number for comparison +function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + +# doxygen supported version 1.8.20 to 1.9.1 +DOXYGEN_VERSION=`doxygen --version` +if [ $(version "$DOXYGEN_VERSION") -lt $(version "1.8.20") ] || [ $(version $DOXYGEN_VERSION) -gt $(version "1.9.1") ]; then + echo -e "warning: Unsupported doxygen version $DOXYGEN_VERSION" + echo -e "Expecting doxygen version from 1.8.20 to 1.9.1" + exit 0 +fi + +# Run doxygen, ignore missing tag files error +TAG_ERROR1="error: Tag file '.*.tag' does not exist or is not a file. Skipping it..." +TAG_ERROR2="error: cannot open tag file .*.tag for writing" +DOXYGEN_STDERR=`cd doxygen && { cat Doxyfile ; echo QUIET = YES; echo GENERATE_HTML = NO; } | doxygen - 2>&1 | sed "/\($TAG_ERROR1\|$TAG_ERROR2\)/d"` +RETVAL=$? + +if [ "$RETVAL" != "0" ] || [ ! -z "$DOXYGEN_STDERR" ]; then + echo -e "$DOXYGEN_STDERR" + RETVAL=1 #because return value is not generated by doxygen 1.8.20 +fi + +exit $RETVAL