| 1 | #!/bin/bash |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | # You may not use this file except in compliance with the License. |
| 6 | # A copy of the License is located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0 |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed |
| 11 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | # express or implied. See the License for the specific language governing |
| 13 | # permissions and limitations under the License. |
| 14 | # |
| 15 | set -eu |
| 16 | |
| 17 | export DOXYGEN_VERSION="doxygen-1.17.0" |
| 18 | curl -L "https://www.doxygen.nl/files/$DOXYGEN_VERSION.linux.bin.tar.gz" -o "$DOXYGEN_VERSION.tar.gz" |
| 19 | tar -xvf "$DOXYGEN_VERSION.tar.gz" |
| 20 | |
| 21 | # Pull in git tags |
| 22 | git fetch origin --tags |
| 23 | |
| 24 | # Add a version to the Doxygen documentation |
| 25 | # For example: v1.3.13-3b413f18 |
| 26 | DOC_VERSION="$(git tag --sort v:refname | tail -n 1)-$(git rev-parse --short=8 HEAD)" |
| 27 | |
| 28 | sed -i "s/PROJECT_NUMBER_PLACEHOLDER/$DOC_VERSION/" docs/doxygen/Doxyfile |
| 29 | |
| 30 | # We want to examine stderr for warnings |
| 31 | # Ignore doxygen warnings from using the README.md as the mainpage |
| 32 | # || true is necessary, because if there are no remaining warnings, grep -vi would |
| 33 | # otherwise return 1/failure |
| 34 | WARNING=$($DOXYGEN_VERSION/bin/doxygen docs/doxygen/Doxyfile 2>&1 | grep -i "warning" | grep -vi "readme" || true) |
| 35 | |
| 36 | if [ -n "$WARNING" ]; then |
| 37 | echo "$WARNING" |
| 38 | exit 1 |
| 39 | else |
| 40 | exit 0 |
| 41 | fi |