forked from mavlink/MAVSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_docs.sh
executable file
·51 lines (41 loc) · 1.52 KB
/
generate_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Run with argument `--skip-checks` to skip checks for clean build and removing install dir.
# exit on any error
set -e
# This script will
# 1. build and install the source,
# 2. run doxygen and create html and xml docs,
# 3. run script to generate markdown from xml
# Get current directory of script.
source_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
skip_checks=false
if [ "$#" -eq 1 -a "$1" == "--skip-checks" ]; then
skip_checks=true
fi
# We use a local install folder so we don't need sudo.
install_prefix="$source_dir/install"
if [ "$skip_checks" = false ]; then
# Clean-up build & install directory
if [ -d $source_dir/build ] || [ -d $install_prefix ] ; then
printf "Clean-up your build & install directory using below command.\nmake distclean && rm -rf $install_prefix\n"
exit 1
fi
fi
# Build and install locally.
make INSTALL_PREFIX=$install_prefix default install
return_result=0
# Doxygen likes to run where the source is (because INPUT in .doxygen is empty),
# so we cd there.
pushd $install_prefix/include/dronecode_sdk
# If any warnings are thrown, we should not flag this as a success.
doxygen_output_file=".doxygen_output.tmp"
doxygen $source_dir/.doxygen &> $doxygen_output_file
cat $doxygen_output_file
if cat $doxygen_output_file | grep "warning" | grep -v "ignoring unsupported tag"
then
return_result=1
echo "Please check doxygen warnings."
fi
$source_dir/generate_markdown_from_doxygen_xml.py $install_prefix/docs $install_prefix/docs
popd
exit $return_result