spiegel-keyman/core/tools/ldml-const-builder/build.sh
Marc Durdin f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00

43 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Builds /core/include/ldml/keyman_core_ldml.h from /core/include/ldml/keyman_core_ldml.ts
#
## 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
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
CORE_LDML_H_FILE="../../include/ldml/keyman_core_ldml.h"
################################ Main script ################################
builder_describe "Build and run the constant builder for LDML" clean build run
builder_parse "$@"
# TODO: build if out-of-date if test is specified
# TODO: configure if npm has not been run, and build is specified
if builder_start_action clean; then
rm -rf ../../include/ldml/build/
# Not removing ${CORE_LDML_H_FILE} as it is checked in
builder_finish_action success clean
fi
if builder_start_action build; then
# Generate index.ts
npx tsc -b ../../include/ldml/tsconfig.build.json
builder_finish_action success build
fi
if builder_start_action run; then
node --enable-source-maps ../../include/ldml/ldml-const-builder/ldml-const-builder.js > ${CORE_LDML_H_FILE}
echo "Updated ${CORE_LDML_H_FILE}"
builder_finish_action success run
fi