Repository navigation
Expand file tree
/
Copy pathgenerate_docs.sh
More file actions
102 lines (90 loc) · 2.85 KB
/
Copy pathgenerate_docs.sh
File metadata and controls
102 lines (90 loc) · 2.85 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# Shell script to generate API documentation using Doxygen
# Control Algorithms Library
echo "=================================="
echo "Control Algorithms Library"
echo "API Documentation Generator"
echo "=================================="
echo ""
# Check if Doxygen is installed
echo "Checking for Doxygen..."
if ! command -v doxygen &> /dev/null; then
echo "ERROR: Doxygen is not installed or not in PATH"
echo ""
echo "Please install Doxygen using one of these methods:"
echo " Ubuntu/Debian: sudo apt-get install doxygen"
echo " Fedora/RHEL: sudo dnf install doxygen"
echo " macOS: brew install doxygen"
echo ""
exit 1
fi
DOXYGEN_VERSION=$(doxygen --version)
echo "Found Doxygen version: $DOXYGEN_VERSION"
echo ""
# Check if Doxyfile exists
if [ ! -f "Doxyfile" ]; then
echo "ERROR: Doxyfile not found in current directory"
echo "Please run this script from the project root directory"
exit 1
fi
# Clean previous documentation
if [ -d "docs/html" ]; then
echo "Cleaning previous documentation..."
rm -rf docs/html
fi
# Generate documentation
echo "Generating API documentation..."
echo ""
START_TIME=$(date +%s)
doxygen Doxyfile
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
echo ""
echo "=================================="
echo "Documentation generated successfully!"
echo "=================================="
echo ""
echo "Time taken: $DURATION seconds"
echo "Output directory: docs/html/"
echo ""
# Check for warnings
if [ -f "doxygen_warnings.log" ]; then
WARNING_COUNT=$(wc -l < doxygen_warnings.log)
if [ $WARNING_COUNT -gt 0 ]; then
echo "WARNING: $WARNING_COUNT warning(s) found"
echo "Check doxygen_warnings.log for details"
echo ""
else
echo "No warnings found!"
echo ""
fi
fi
# Offer to open documentation
echo "Would you like to open the documentation in your browser? (y/n)"
read -r response
if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
INDEX_PATH="docs/html/index.html"
if [ -f "$INDEX_PATH" ]; then
if command -v xdg-open &> /dev/null; then
xdg-open "$INDEX_PATH"
elif command -v open &> /dev/null; then
open "$INDEX_PATH"
else
echo "Please open $INDEX_PATH in your browser"
fi
echo "Opening documentation..."
else
echo "ERROR: index.html not found at $INDEX_PATH"
fi
fi
else
echo ""
echo "=================================="
echo "ERROR: Documentation generation failed!"
echo "=================================="
echo ""
echo "Check doxygen_warnings.log for error details"
exit 1
fi