spiegel-keyman/core/tools/api-header-extractor/build.sh
Marc Durdin 0f2f3c1009 refactor(core): clean up API documentation
Move all Keyman Core header API documentation to javadoc-style so that
we can get inline documentation and simplify the readability of the
header files.

Update api-header-extractor to support minimal javadoc formatting of the
comments.

Test-bot: skip
2026-05-05 16:29:53 +02:00

46 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../resources/build/builder-full.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
################################ Main script ################################
builder_describe "Extract documentation from header files" clean configure build
builder_parse "$@"
if [[ -v KEYMAN_PKG_BUILD ]]; then
# KEYMAN_PKG_BUILD is defined in linux/debian/rules when running
# a packaging build
echo "Disabled for Ubuntu packaging as node environment is not available"
exit 0
fi
#----------------------------------------------------------------------------
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
. "$KEYMAN_ROOT/resources/build/typescript.inc.sh"
CORE_ROOT="$KEYMAN_ROOT/core"
CORE_H_FILES=(\
"$CORE_ROOT/include/keyman/keyman_core_api.h" \
"$CORE_ROOT/include/keyman/keyman_core_api_actions.h" \
"$CORE_ROOT/include/keyman/keyman_core_api_context.h" \
"$CORE_ROOT/include/keyman/keyman_core_api_debug.h" \
"$CORE_ROOT/include/keyman/keyman_core_api_vkeys.h" \
)
CORE_H_DOC="index.md"
OUTPATH="$CORE_ROOT/docs/api"
do_build_and_run() {
tsc --build
rm -rf "$OUTPATH"
mkdir -p "$OUTPATH"
node --enable-source-maps ./build/src/index.js "${OUTPATH}" "${CORE_H_FILES[@]}"
echo "Wrote documentation to ${OUTPATH}/${CORE_H_DOC}"
}
builder_run_action clean rm -rf "${OUTPATH}"
builder_run_action configure node_select_version_and_npm_ci
builder_run_action build do_build_and_run