mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-15 13:08:24 +08:00

The current test environment is mainly based on Ubuntu 22.04 LTS and doxygen version is 1.9.1. But when we switch to Ubuntu 24.04, the default Doxygen version on Ubuntu 24.04 is 1.9.8. The supported configuration and layout file formats differ from those in 1.9.1 (Ubuntu 22.04). In particular, the layout XML file format of 1.9.8 is incompatible with the older format(1.9.1). Therefore, to support Doxygen on Ubuntu 24.04, we need to load different configuration and layout files. (The layout file is specified using the LAYOUT_FILE parameter in the configuration file.) Solution: Provide corresponding configuration and layout files for different Doxygen versions, distinguished by the Doxygen version number. Currently, only Doxygen versions 1.9.1 and above are supported. If the doxygen version is >= 1.9.1 but < 1.9.8, the 1.9.1 configuration and layout are used by default. If the doxygen version is >= 1.9.8, the 1.9.8 configuration and layout are used. Only 1.9.1 and 1.9.8 have been tested, as these are the default doxygen versions on Ubuntu 22.04 LTS and Ubuntu 24.04. Other versions have not been tested yet. If necessary, we will change the configuration based on the same approach in the future. Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
87 lines
2.5 KiB
Bash
Executable File
87 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Convert version number to comparable numeric value
|
|
version_to_number() {
|
|
local version="$1"
|
|
local IFS='.'
|
|
local parts=($version)
|
|
|
|
# Ensure we have 3 parts
|
|
while [ ${#parts[@]} -lt 3 ]; do
|
|
parts+=(0)
|
|
done
|
|
|
|
# Extract X,Y,Z
|
|
local X=${parts[0]}
|
|
local Y=${parts[1]}
|
|
local Z=${parts[2]}
|
|
|
|
# Validate each part is a 1-2 digit number
|
|
if ! [[ "$X" =~ ^[0-9]{1,2}$ ]] || ! [[ "$Y" =~ ^[0-9]{1,2}$ ]] || ! [[ "$Z" =~ ^[0-9]{1,2}$ ]]; then
|
|
echo "Error: Invalid version format. Expected X.Y.Z where X/Y/Z are 1-2 digit numbers" >&2
|
|
return 1
|
|
fi
|
|
|
|
# Format each part as 2-digit numbers and concatenate
|
|
local number=$(printf "%02d%02d%02d" "$X" "$Y" "$Z")
|
|
|
|
# Remove leading zeros to avoid octal interpretation and return the value
|
|
echo $((10#$number))
|
|
return 0
|
|
}
|
|
|
|
RTT_PATH=$(realpath $(dirname $0)/..)
|
|
RTT_DOC_PATH=$RTT_PATH/documentation
|
|
|
|
rm -rf $RTT_DOC_PATH/html
|
|
|
|
cd $RTT_DOC_PATH
|
|
|
|
doxygen_version=$(doxygen --version 2>/dev/null)
|
|
if [ -z "$doxygen_version" ]; then
|
|
echo "Error: doxygen command not found. Please ensure doxygen is installed." >&2
|
|
exit 1
|
|
fi
|
|
|
|
doxygen_version_number=$(version_to_number "$doxygen_version")
|
|
if [ $? -ne 0 ]; then
|
|
echo "Error: Failed to convert version to number!" >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [ $doxygen_version_number -lt 10901 ]; then
|
|
echo "Error: Doxygen version must be at least 1.9.1. Current version is $doxygen_version." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ $doxygen_version_number -eq 10901 ]; then
|
|
echo "Info: Doxygen version is 1.9.1" >&2
|
|
config_file="Doxyfile.1.9.1"
|
|
elif [ $doxygen_version_number -gt 10901 ] && [ $doxygen_version_number -lt 10908 ]; then
|
|
echo "Info: Doxygen version is greater than 1.9.1 but less than 1.9.8, Using configuration for 1.9.1." >&2
|
|
config_file="Doxyfile.1.9.1"
|
|
elif [ $doxygen_version_number -eq 10908 ]; then
|
|
echo "Info: Doxygen version is 1.9.8" >&2
|
|
config_file="Doxyfile.1.9.8"
|
|
elif [ $doxygen_version_number -gt 10908 ]; then
|
|
echo "Warning: Doxygen version is greater than 1.9.8. Using configuration for 1.9.8." >&2
|
|
config_file="Doxyfile.1.9.8"
|
|
fi
|
|
|
|
if [ ! -f "$config_file" ]; then
|
|
echo "Error: Configuration file $config_file does not exist." >&2
|
|
exit 3
|
|
fi
|
|
|
|
echo "Running doxygen $doxygen_version with $config_file..."
|
|
doxygen "$config_file"
|
|
if [ $? -ne 0 ]; then
|
|
echo ""
|
|
echo "OOPS: Something error/warning occurred during Doxygen building, please check it out!"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
pushd $RTT_DOC_PATH/html
|
|
python3 -m http.server
|