pytorch/docs/cpp/source/check-doxygen.sh
mikey dagitses 60729d02f1 remove unused nn_path from generate_code (#74563)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74563

This is used inconsistently in all the generate_code program
invocations. Nevertheless, nothing consumes this flag, so we can
safely remove it.

This was removed in #25353.
ghstack-source-id: 152249818

Test Plan: Should be a no-op, rely on CI.

Reviewed By: malfet

Differential Revision: D35053096

fbshipit-source-id: 3ad19e83ca14649b514dc163c3caff6cbd118e14
(cherry picked from commit a43f05bb43553249caac3c3479986cbc45d286ae)
2022-03-31 18:35:30 +00:00

54 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -ex
ignore_warning() {
# Invert match to filter out $1.
set +e
grep -v "$1" doxygen-log.txt > temp.txt
set -e
mv temp.txt doxygen-log.txt
}
command -v doxygen >/dev/null 2>&1 || { echo >&2 "doxygen is not supported. Aborting."; exit 1; }
pushd "$(dirname "$0")/../../.."
cp torch/_utils_internal.py tools/shared
python -m tools.codegen.gen
python tools/setup_helpers/generate_code.py \
--native-functions-path aten/src/ATen/native/native_functions.yaml
popd
# Run doxygen and log all output.
doxygen "$(dirname $0)" 2> original-doxygen-log.txt
cp original-doxygen-log.txt doxygen-log.txt
# Uncomment this if you need it for debugging; we're not printing this
# by default because it is confusing.
# echo "Original output"
# cat original-doxygen-log.txt
# Filter out some warnings.
ignore_warning "warning: no uniquely matching class member found for"
ignore_warning "warning: explicit link request to 'Item' could not be resolved"
ignore_warning "warning: Included by graph for 'types.h' not generated, too many nodes"
# Count the number of remaining warnings.
warnings="$(grep 'warning:' doxygen-log.txt | wc -l)"
echo "Treating all remaining warnings as errors"
if [[ "$warnings" -ne "0" ]]; then
echo "Failing Doxygen test because the following warnings were treated fatally:"
cat doxygen-log.txt
echo "Please fix these warnings. To run this test locally, use docs/cpp/source/check-doxygen.sh"
rm -f doxygen-log.txt original-doxygen-log.txt
exit 1
fi
rm -f doxygen-log.txt original-doxygen-log.txt