spiegel-keyman/core/tools/api-header-extractor/build.sh
Marc Durdin 73daec43c1 chore(core): refresh documentation and add build tool
Refreshes all of the public API header documentation so we have a single
source for the documentation -- the keyman_core_api.h header. A lot of
reformatting but very little change in terms of content.

This is converted into Markdown by api-header-extractor, and the results
can be copied to help.keyman.com.

Will only do the main keyman_core_api.h for v17 release, in interests of
time. The other headers are primarily internal only and have many
deprecated functions also.

Will also leave the full automation of the documentation generation to a
future PR. The script will be there but it won't run during build for
now.
2024-03-20 12:56:08 +07:00

36 lines
1.2 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/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
CORE_ROOT="$KEYMAN_ROOT/core"
CORE_H_FILE="$CORE_ROOT/include/keyman/keyman_core_api.h"
CORE_H_DOC="index.md"
OUTPATH="$CORE_ROOT/build/doc"
################################ Main script ################################
builder_describe "Extract documentation from header files" clean configure build run
builder_parse "$@"
builder_run_action clean rm -rf "${OUTPATH}"
builder_run_action build tsc --build
if builder_start_action run; then
rm -rf "$OUTPATH"
mkdir -p "$OUTPATH"
node --enable-source-maps ./build/src/index.js "${CORE_H_FILE}" "${OUTPATH}"
echo "Wrote documentation to ${OUTPATH}/${CORE_H_DOC}"
# if [ ! -z "${HELP_KEYMAN_COM+x}" ]; then
# # TODO move this to help-keyman-com.sh
# rm -rf "${HELP_KEYMAN_COM}developer/core/desktop/17.0/c-api/"
# mkdir -p "${HELP_KEYMAN_COM}developer/core/desktop/17.0/c-api/"
# cp "${OUTPATH}/"* "${HELP_KEYMAN_COM}developer/core/desktop/17.0/c-api/"
# fi
builder_finish_action success run
fi