1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
mariadb/include/mysql/generate_plugin_api_docs.sh
Georgi Kodinov 3e3f56d99e MDEV-39806: Add a per-push/per-pull-request checker for Markdown API docs
Create a GitHub action into the MariaDB server tree to build the Markdown
documentation using the cmake target provided by MDEV-39718.

This workflow generates API documentation for the plugin using a
Docker container packed with all the extra doxygen/moxygen tools.
Fixed some more doxygen problems.
Moved the repo to ghcr.io/mariadb/mariadb-doc-gen:latest.
2026-09-01 15:38:43 +03:00

44 lines
1.5 KiB
Bash

#!/bin/bash
# This script generates the plugin API documentation in markdown format.
# Usage: generate_plugin_api_docs.sh [target_dir]
# Creates the following directories in the target_dir:
# md/ - The markdown files generated by moxygen
# xml/ - The XML generated by doxygen
# Creates the following files in the target_dir:
# md/api.md - the main plugin API documentation file
# md/<group>.md - documentation for group <group>
# md/<page>.md - documentation for each <page>
# Note: target_dir is created if not present.
# Note: requires at least moxygen 2.1.11
set -euo pipefail
# If no target_dir is specified, the current directory is used.
if [ -n "$1" ]; then
TARGET_DIR="$1"
else
TARGET_DIR="."
fi
# Exit on error, undefined variable, or pipe failure
set -euo pipefail
# Clean up the output directory, if it exists
rm -rf "$TARGET_DIR/md"
rm -rf "$TARGET_DIR/xml"
# Create the markdown output directory
mkdir -p "$TARGET_DIR/md"
echo "Doxygen version"
doxygen --version
echo "Moxygen version"
moxygen --version
# run doxygen to generate the plugin API documentation XML
# Need to pass output directory so that XML docs get generated in it.
# Need to EXCLUDE the output directory so that doxygen does not try to parse the generated XML and markdown files
(cat Doxyfile.generated_docs_plugin_api ; echo "OUTPUT_DIRECTORY=$TARGET_DIR"; echo "EXCLUDE=$TARGET_DIR/xml $TARGET_DIR/md" ) | doxygen -
# run moxygen to generate the plugin API general doc api.md
moxygen --quiet --anchors --pages --groups --output "$TARGET_DIR/md/%s.md" "$TARGET_DIR/xml"