VEGO-Engine / Engine

2 stars 0 forks source link

Add git hook to build doxygen documentation #44

Closed Nanogamer7 closed 1 month ago

Nanogamer7 commented 2 months ago

Currently users need doxygen plus extra tools installed to be able to build the documentation client side, this process could be made easier by providing a git hook to build the documentation via docker post-commit and post-receive. Optionally it should be possible to generate external and internal documentation without changing the config file.

Nanogamer7 commented 2 months ago

shell script to generate doxygen web-page:

#!/bin/sh

inputfile="./Doxyfile"
outputfile="./Doxygen"
tempfile=$(mktemp)  # Create a temporary file

# Use sed to find and replace the line with "OUTPUT_DIRECTORY"
sed -e 's/^[[:space:]]*OUTPUT_DIRECTORY[[:space:]]*=.*$/OUTPUT_DIRECTORY  = \/output/' \
    -e 's/^[[:space:]]*INPUT[[:space:]]*=.*$/INPUT                        = \/source\/src \/source\/include/' \
    -e 's@docs/@/source/docs/@g' \
    "$inputfile" > "$tempfile" && mv "$tempfile" "$outputfile"

docker run --rm -v .:/source -v ./docs:/output -v ./Doxygen:/Doxygen ghcr.io/kingpin/doxygen-docker:latest

rm Doxygen

requires docker and sed, and Doxyfile as of 5a21f9125bc1435f26d3073345c357e96724a51c recommended as post-applypatch, post-merge, and post-checkout

Nanogamer7 commented 2 months ago

On second thought, git hooks might not be the best solution, as documentation does not need to be viewed after every change. An alternative approach would be VS-code tasks, which only work with VS-code however, but since they do not hinder other users I've added them in commit 52daf5c5b68e5e3feca94850b7ebce22052d0593 (merging with #43)