Merge pull request #15256 from keymanapp/maint/core/15254-verify-changes-to-ldml-consts

maint(core): verify that keyman_core_ldml.h is in sync
This commit is contained in:
Marc Durdin 2025-12-02 05:28:13 +01:00 • committed by GitHub
commit be5715f135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 24 deletions

View file

@ -9,35 +9,44 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
## END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
CORE_LDML_H_FILE="../../include/ldml/keyman_core_ldml.h"
CORE_LDML_TS_FILE="../../include/ldml/keyman_core_ldml.ts"
################################ Main script ################################
builder_describe "Build and run the constant builder for LDML" clean build run
builder_describe "Build and run the constant builder for LDML" clean configure build run test
builder_parse "$@"
# TODO: build if out-of-date if test is specified
# TODO: configure if npm has not been run, and build is specified
builder_describe_internal_dependency \
run:project build:project \
test:project run:project
builder_describe_outputs \
configure "/node_modules" \
build "/core/include/ldml/ldml-const-builder/ldml-const-builder.js" \
run "/core/include/ldml/ldml-const-builder/run.txt"
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
function do_run() {
node --enable-source-maps ../../include/ldml/ldml-const-builder/ldml-const-builder.js > ${CORE_LDML_H_FILE}
touch ../../include/ldml/ldml-const-builder/run.txt
echo "Updated ${CORE_LDML_H_FILE}"
}
builder_finish_action success run
fi
function do_test() {
if ! git diff --exit-code "${CORE_LDML_H_FILE}"; then
builder_echo error "File ${CORE_LDML_TS_FILE} has changed, but /core/tools/ldml-const-builder has not been run."
builder_echo error "Run ${COLOR_BRIGHT_WHITE}$KEYMAN_ROOT/core/tools/ldml-const-build/build.sh run${COLOR_RESET} and commit changes"
return 1
fi
}
# clean: Not removing ${CORE_LDML_H_FILE} as it is checked in
builder_run_action clean rm -rf ../../include/ldml/build/ ../../include/ldml/ldml-const-builder/ ../../include/ldml/coverage/
builder_run_action configure node_select_version_and_npm_ci
builder_run_action build tsc -b ../../include/ldml/tsconfig.build.json
builder_run_action run do_run
builder_run_action test do_test

View file

@ -1049,13 +1049,13 @@ Do not use builder standard options such as `--deps` or `--debug`.
### Parameters
* 1: `script` path to script, relative to root of repo
* 1: `script` path to script, relative to root of repo, with leading slash
* 2+: `parameters` action(s), target(s), parameters for the child script to run
### Example
```bash
builder_launch core/build.sh configure,build:wasm --no-tests
builder_launch /core/build.sh configure,build:wasm --no-tests
```
--------------------------------------------------------------------------------

View file

@ -448,13 +448,13 @@ _builder_cleanup_deps() {
#
# ### Parameters
#
# * 1: `script` path to script, relative to root of repo
# * 1: `script` path to script, relative to root of repo, with leading slash
# * 2+: `parameters` action(s), target(s), parameters for the child script to run
#
# ### Example
#
# ```bash
# builder_launch core/build.sh configure,build:wasm --no-tests
# builder_launch /core/build.sh configure,build:wasm --no-tests
# ```
#
builder_launch() {

View file

@ -34,7 +34,8 @@ else
fi
function do_all() {
"${KEYMAN_ROOT}/core/build.sh" configure,build,test:${ARCH}
builder_launch /core/tools/ldml-const-builder/build.sh clean,configure,build,run,test
builder_launch /core/build.sh configure,build,test:${ARCH}
}
builder_run_action all do_all