From 8eb7e6b0d4c003fd445875f2cf9dfb59e13077b5 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Fri, 7 Nov 2025 09:36:19 +0100 Subject: [PATCH] maint(web): cleanup web/**/build.sh for consistency and build performance * Simplify the build dependency / child tree * Split building and testing tooling so we don't rebuild components * Fixup expected outputs to avoid repeated builds of components * Remove unused dependency references * Move test.sh targets into build.sh, so that testing doesn't lose dependency tracking and cause unnecessary rebuilds. (Note that I have not yet deleted test.sh.) * Make predictive-text a direct child of engine, so that we don't build it twice (or even more times) Test-bot: skip --- resources/tools/check-markdown/build.sh | 2 +- web/build.sh | 69 +++++++++++++------ web/src/app/browser/build.sh | 6 +- web/src/app/ui/build.sh | 4 +- web/src/app/webview/build.sh | 6 +- web/src/common/web-utils/build.sh | 6 +- web/src/engine/build.sh | 16 +++-- web/src/engine/predictive-text/build.sh | 11 ++- .../engine/predictive-text/templates/build.sh | 6 +- .../predictive-text/wordbreakers/build.sh | 4 +- .../tools/data-compiler/tsconfig.json | 3 - .../predictive-text/worker-main/build.sh | 10 +-- .../predictive-text/worker-thread/build.sh | 10 +-- web/src/test/manual/build.sh | 28 ++------ web/src/tools/build.sh | 20 ++---- web/src/tools/building/build.sh | 20 ++++++ .../tools/building/sourcemap-root/build.sh | 2 +- web/src/tools/testing/build.sh | 28 ++++++++ web/src/tools/testing/bulk_rendering/build.sh | 5 +- .../testing/bulk_rendering/tsconfig.json | 1 + .../tools/testing/gesture-processor/build.sh | 6 +- web/src/tools/testing/recorder-core/build.sh | 2 +- .../tools/testing/recorder-core/package.json | 4 -- .../tools/testing/recorder-core/tsconfig.json | 2 - web/src/tools/testing/recorder/build.sh | 8 +-- web/src/tools/testing/recorder/tsconfig.json | 2 - 26 files changed, 159 insertions(+), 122 deletions(-) create mode 100755 web/src/tools/building/build.sh create mode 100755 web/src/tools/testing/build.sh diff --git a/resources/tools/check-markdown/build.sh b/resources/tools/check-markdown/build.sh index 01dd9d81c9..c6fb2bd35c 100755 --- a/resources/tools/check-markdown/build.sh +++ b/resources/tools/check-markdown/build.sh @@ -16,7 +16,7 @@ builder_describe "Check markdown internal links" \ "build" builder_describe_outputs \ - configure "${THIS_SCRIPT_PATH}/node_modules" \ + configure /node_modules \ build build/index.js builder_parse "$@" diff --git a/web/build.sh b/web/build.sh index 022e2c2781..ed61f87537 100755 --- a/web/build.sh +++ b/web/build.sh @@ -16,7 +16,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" builder_set_child_base src builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \ \ - "@/common/tools/es-bundling" \ + "@/common/tools/es-bundling build" \ "@/resources/tools/check-markdown test:help" \ \ "clean" \ @@ -24,21 +24,23 @@ builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \ "build" \ "start Starts the test server" \ "test" \ - "coverage Create an HTML page with code coverage" \ - ":app/browser The form of Keyman Engine for Web for use on websites" \ - ":app/webview A puppetable version of KMW designed for use in a host app's WebView" \ - ":app/ui Builds KMW's desktop form-factor keyboard-selection UI modules" \ + "coverage Create an HTML page with code coverage report" \ + \ + ":app/browser KeymanWeb build for use on websites" \ + ":app/webview KeymanWeb build for embedding in Keyman for Android and Keyman for iOS" \ + ":app/ui KeymanWeb desktop form-factor keyboard-selection UI modules" \ ":common/web-utils Shared utils" \ ":engine Keyman Engine for Web" \ - ":engine/predictive-text Builds KMW's predictive text module" \ ":help Online documentation" \ - ":samples Builds all needed resources for the KMW sample-page set" \ - ":tools Builds engine-related development resources" \ + ":samples Resources for the KMW sample-page set" \ + ":tools/building Build tools" \ + ":tools/testing Test tools" \ ":test-pages=src/test/manual Builds resources needed for the KMW manual testing pages" \ - ":_all (Meta build target used when targets are not specified)" - -# Possible TODO? -# "upload-symbols Uploads build product to Sentry for error report symbolification. Only defined for $DOC_BUILD_EMBED_WEB" \ + ":_all (Meta build target used when targets are not specified)" \ + \ + "--test-dom-only For test, run only DOM-oriented unit tests (reduced footprint, nothing browser-specific)" \ + "--test-integrated-only For test, run only KMW's integration test suite" \ + "--test-inspect For test, run browser-based unit tests in an inspectable mode" builder_parse "$@" @@ -49,15 +51,15 @@ fi builder_describe_outputs \ configure "/node_modules" \ - build "/web/build/test/dom/cases/attachment/outputTargetForElement.tests.html" \ + build "/web/build/test/dom/cases/attachment/textStoreForElement.tests.html" \ build:app/browser "/web/build/app/browser/lib/index.mjs" \ build:app/webview "/web/build/app/webview/${config}/keymanweb-webview.js" \ build:app/ui "/web/build/app/ui/${config}/kmwuitoggle.js" \ build:common/web-utils "/web/build/common/web-utils/lib/index.mjs" \ build:engine "/web/build/engine/lib/index.mjs" \ - build:engine/predictive-text "/web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs" \ build:samples "/web/src/samples/simplest/keymanweb.js" \ - build:tools "/web/build/tools/building/sourcemap-root/index.js" \ + build:tools/building "/web/build/tools/building/sourcemap-root/index.js" \ + build:tools/testing "/web/build/tools/testing/test-utils/lib/index.d.ts" \ build:test-pages "/web/build/test-resources/sentry-manager.js" #### Build action definitions #### @@ -90,7 +92,7 @@ precompile() { done } -build_action() { +build_tests_action() { builder_echo "Building auto tests..." # The currently-bundled declaration file for gesture-processor generates @@ -140,12 +142,12 @@ coverage_action() { rm -rf build/coverage/tmp } -builder_run_child_actions build:tools +builder_run_child_actions build:tools/building builder_run_child_actions build:common/web-utils builder_run_child_actions build:engine -builder_run_child_actions build:engine/predictive-text +# builder_run_child_actions build:engine/predictive-text # Uses all but engine/element-wrappers and engine/attachment builder_run_child_actions build:app/webview @@ -163,11 +165,38 @@ builder_run_child_actions build:samples builder_run_child_actions build:test-pages # Build tests -builder_run_action build:_all build_action +builder_run_child_actions build:tools/testing +builder_run_action build:_all build_tests_action # Run tests builder_run_child_actions test -builder_run_action test:_all ./test.sh + +function do_browser_tests() { + # Browser-based tests: common configs & kill-switches + + # Select the right CONFIG file. + local WTR_CONFIG= + if builder_is_ci_build; then + WTR_CONFIG=.CI + fi + + # Prepare the flags for the karma command. + local WTR_INSPECT= + if builder_has_option --test-inspect; then + WTR_INSPECT="--manual" + fi + + pushd "${KEYMAN_ROOT}" + if builder_has_option --test-dom-only || ! builder_has_option --test-integrated-only; then + web-test-runner --config "web/src/test/auto/dom/web-test-runner${WTR_CONFIG}.config.mjs" ${WTR_INSPECT} + fi + if builder_has_option --test-integrated-only || ! builder_has_option --test-dom-only; then + web-test-runner --config "web/src/test/auto/integrated/web-test-runner${WTR_CONFIG}.config.mjs" ${WTR_INSPECT} + fi + popd +} + +builder_run_action test:_all do_browser_tests function do_test_help() { check-markdown "$KEYMAN_ROOT/web/docs/engine" diff --git a/web/src/app/browser/build.sh b/web/src/app/browser/build.sh index 13d0f954e4..e9b702ebe8 100755 --- a/web/src/app/browser/build.sh +++ b/web/src/app/browser/build.sh @@ -14,9 +14,9 @@ SUBPROJECT_NAME=app/browser # ################################ Main script ################################ builder_describe "Builds the Keyman Engine for Web's website-integrating version for use in non-puppeted browsers." \ - "@/common/tools/es-bundling" \ - "@/web/src/engine build" \ - "@/web/src/tools/building/sourcemap-root" \ + "@/common/tools/es-bundling build" \ + "@/web/src/engine build" \ + "@/web/src/tools/building/sourcemap-root build" \ "clean" \ "configure" \ "build" \ diff --git a/web/src/app/ui/build.sh b/web/src/app/ui/build.sh index 72c6377c09..298f571479 100755 --- a/web/src/app/ui/build.sh +++ b/web/src/app/ui/build.sh @@ -14,8 +14,8 @@ SUBPROJECT_NAME=app/ui # ################################ Main script ################################ builder_describe "Builds the Keyman Engine for Web's desktop form-factor keyboard selection modules." \ - "@/web/src/app/browser build" \ - "@/web/src/tools/building/sourcemap-root" \ + "@/web/src/app/browser build" \ + "@/web/src/tools/building/sourcemap-root build" \ "clean" \ "configure" \ "build" \ diff --git a/web/src/app/webview/build.sh b/web/src/app/webview/build.sh index 790e8d2aef..08d1fe47db 100755 --- a/web/src/app/webview/build.sh +++ b/web/src/app/webview/build.sh @@ -14,9 +14,9 @@ SUBPROJECT_NAME=app/webview # ################################ Main script ################################ builder_describe "Builds the Keyman Engine for Web's puppetable version designed for use within WebViews." \ - "@/common/tools/es-bundling" \ - "@/web/src/engine build" \ - "@/web/src/tools/building/sourcemap-root" \ + "@/common/tools/es-bundling build" \ + "@/web/src/engine build" \ + "@/web/src/tools/building/sourcemap-root build" \ "clean" \ "configure" \ "build" \ diff --git a/web/src/common/web-utils/build.sh b/web/src/common/web-utils/build.sh index f569e379b7..95cc361b92 100755 --- a/web/src/common/web-utils/build.sh +++ b/web/src/common/web-utils/build.sh @@ -19,9 +19,9 @@ BUILD_DIR="/web/build/common/web-utils" builder_describe \ "Compiles the web-oriented utility function module." \ - "@/common/tools/es-bundling" \ - "@/common/web/keyman-version" \ - "@/common/web/types" \ + "@/common/tools/es-bundling build" \ + "@/common/web/keyman-version build" \ + "@/common/web/types build" \ clean configure build test builder_describe_outputs \ diff --git a/web/src/engine/build.sh b/web/src/engine/build.sh index fb71c30853..996734e8ce 100755 --- a/web/src/engine/build.sh +++ b/web/src/engine/build.sh @@ -15,14 +15,14 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" # ################################ Main script ################################ builder_describe "Builds Keyman Engine for Web (KMW)" \ - "@/core:wasm" \ - "@/common/tools/es-bundling" \ - "@/web/src/engine/predictive-text" \ - "@/web/src/common/web-utils" \ + "@/core:wasm build" \ + "@/common/tools/es-bundling build" \ + "@/web/src/common/web-utils build" \ "clean" \ "configure" \ "build" \ - "test" + "test" \ + ":predictive-text" # Possible TODO? # "upload-symbols Uploads build product to Sentry for error report symbolification. Only defined for $DOC_BUILD_EMBED_WEB" \ @@ -67,7 +67,11 @@ do_build () { node src/osk/validate-gesture-specs.js } -builder_run_action configure node_select_version_and_npm_ci builder_run_action clean rm -rf "$KEYMAN_ROOT/web/build/engine" +builder_run_child_actions clean +builder_run_action configure node_select_version_and_npm_ci +builder_run_child_actions configure +builder_run_child_actions build builder_run_action build do_build builder_run_action test test-headless-typescript engine +builder_run_child_actions test \ No newline at end of file diff --git a/web/src/engine/predictive-text/build.sh b/web/src/engine/predictive-text/build.sh index 1d48d302cc..ac6d2a670b 100755 --- a/web/src/engine/predictive-text/build.sh +++ b/web/src/engine/predictive-text/build.sh @@ -20,8 +20,7 @@ builder_describe "Builds predictive-text components used within Keyman Engine fo ":templates Builds the model templates utilized by compiled lexical models" \ ":wordbreakers Builds the wordbreakers provided for lexical model use" \ ":worker-main Builds the predictive-text worker interface module" \ - ":worker-thread Builds the predictive-text worker" \ - ":_all (Meta build target used when targets are not specified)" + ":worker-thread Builds the predictive-text worker" # Possible TODO? # "upload-symbols Uploads build product to Sentry for error report symbolification. Only defined for $DOC_BUILD_EMBED_WEB" \ @@ -30,10 +29,10 @@ builder_parse "$@" builder_describe_outputs \ configure "/node_modules" \ - build:templates "/web/src/engine/predictive-text/build/obj/index.js" \ - build:wordbreakers "/web/src/engine/wordbreakers/build/main/obj/index.js" \ - build:worker-main "/web/src/engine/worker-main/build/obj/lmlayer.js" \ - build:worker-thread "/web/src/engine/worker-thread/build/obj/worker-main.wrapped.js" + build:templates "/web/src/engine/predictive-text/templates/build/obj/index.js" \ + build:wordbreakers "/web/src/engine/predictive-text/wordbreakers/build/main/obj/index.js" \ + build:worker-main "/web/src/engine/predictive-text/worker-main/build/lib/index.mjs" \ + build:worker-thread "/web/src/engine/predictive-text/worker-thread/build/lib/worker-main.wrapped.js" #### Build action definitions #### diff --git a/web/src/engine/predictive-text/templates/build.sh b/web/src/engine/predictive-text/templates/build.sh index 3fa4b75a29..ee969e606e 100755 --- a/web/src/engine/predictive-text/templates/build.sh +++ b/web/src/engine/predictive-text/templates/build.sh @@ -17,8 +17,8 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" SUBPROJECT_NAME=engine/predictive-text/templates builder_describe "Builds the predictive-text model template implementation module" \ - "@/web/src/common/web-utils" \ - "@../wordbreakers" \ + "@/web/src/common/web-utils build" \ + "@../wordbreakers build" \ "clean" \ "configure" \ "build" \ @@ -38,7 +38,7 @@ function do_build() { tsc --emitDeclarationOnly --outFile ./build/lib/index.d.ts } -builder_run_action configure node_select_version_and_npm_ci builder_run_action clean rm -rf build/ +builder_run_action configure node_select_version_and_npm_ci builder_run_action build do_build builder_run_action test test-headless-typescript $SUBPROJECT_NAME \ No newline at end of file diff --git a/web/src/engine/predictive-text/wordbreakers/build.sh b/web/src/engine/predictive-text/wordbreakers/build.sh index a9f4c429c9..267dffb66b 100755 --- a/web/src/engine/predictive-text/wordbreakers/build.sh +++ b/web/src/engine/predictive-text/wordbreakers/build.sh @@ -19,7 +19,7 @@ SUBPROJECT_NAME=engine/predictive-text/wordbreakers # Note: the raw text files used for data.inc.ts are found within # /resources/standards-data/unicode-character-database. builder_describe "Builds the predictive-text wordbreaker implementation module" \ - "@/common/web/types" \ + "@/common/web/types build" \ "clean" \ "configure" \ "build" \ @@ -64,7 +64,7 @@ function do_test() { fi } -builder_run_action configure do_configure builder_run_action clean rm -rf build/ +builder_run_action configure do_configure builder_run_action build do_build builder_run_action test test-headless-typescript $SUBPROJECT_NAME \ No newline at end of file diff --git a/web/src/engine/predictive-text/wordbreakers/tools/data-compiler/tsconfig.json b/web/src/engine/predictive-text/wordbreakers/tools/data-compiler/tsconfig.json index dedc939534..bd7096c88c 100644 --- a/web/src/engine/predictive-text/wordbreakers/tools/data-compiler/tsconfig.json +++ b/web/src/engine/predictive-text/wordbreakers/tools/data-compiler/tsconfig.json @@ -7,9 +7,6 @@ "module": "node16", "moduleResolution": "node16" }, - "references": [ - { "path": "../../../../../../../common/web/types" } - ], "include": [ "./**/*" ], diff --git a/web/src/engine/predictive-text/worker-main/build.sh b/web/src/engine/predictive-text/worker-main/build.sh index 0abb4db7ee..c69aa16894 100755 --- a/web/src/engine/predictive-text/worker-main/build.sh +++ b/web/src/engine/predictive-text/worker-main/build.sh @@ -17,10 +17,10 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" ################################ Main script ################################ builder_describe "Builds the lm-layer module" \ - "@/common/tools/es-bundling" \ - "@/common/web/keyman-version" \ - "@/common/web/types" \ - "@/web/src/engine/predictive-text/worker-thread" \ + "@/common/tools/es-bundling build" \ + "@/common/web/keyman-version build" \ + "@/common/web/types build" \ + "@/web/src/engine/predictive-text/worker-thread build" \ "clean" \ "configure" \ "build" \ @@ -56,7 +56,7 @@ function do_test() { ./unit_tests/test.sh test:headless test:browser } -builder_run_action configure do_configure builder_run_action clean rm -rf build/ +builder_run_action configure do_configure builder_run_action build do_build builder_run_action test do_test \ No newline at end of file diff --git a/web/src/engine/predictive-text/worker-thread/build.sh b/web/src/engine/predictive-text/worker-thread/build.sh index 663088c298..1d7d7062df 100755 --- a/web/src/engine/predictive-text/worker-thread/build.sh +++ b/web/src/engine/predictive-text/worker-thread/build.sh @@ -24,11 +24,11 @@ SUBPROJECT_NAME=engine/predictive-text/worker-thread builder_describe \ "Compiles the Language Modeling Layer for common use in predictive text and autocorrective applications." \ - "@/common/tools/es-bundling" \ - "@/common/web/keyman-version" \ - "@/web/src/tools/building/sourcemap-root" \ - "@../wordbreakers" \ - "@../templates" \ + "@/common/tools/es-bundling build" \ + "@/common/web/keyman-version build" \ + "@/web/src/tools/building/sourcemap-root build" \ + "@../wordbreakers build" \ + "@../templates build" \ configure clean build test \ "--inspect Runs browser-based tests in a locally-inspectable mode" diff --git a/web/src/test/manual/build.sh b/web/src/test/manual/build.sh index a468f5de5f..1d12fb56e4 100755 --- a/web/src/test/manual/build.sh +++ b/web/src/test/manual/build.sh @@ -1,28 +1,19 @@ #!/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 -. "$KEYMAN_ROOT/resources/build/utils.inc.sh" - # ################################ Main script ################################ builder_describe "Builds the Keyman Engine for Web's sample page setups." \ "@/common/web/sentry-manager build" \ - "@/web/src/app/browser build" \ - "@/web/src/app/ui build" \ - "@/web/src/tools build" \ "configure Does nothing for this project" \ "clean" \ "build" \ "test Does nothing for this project" -# Possible TODO?s -# "upload-symbols Uploads build product to Sentry for error report symbolification. Only defined for $DOC_BUILD_EMBED_WEB" \ - builder_parse "$@" DEST="web/build/test-resources" @@ -30,26 +21,15 @@ DEST="web/build/test-resources" builder_describe_outputs \ build "/$DEST/sentry-manager.js" -#### Resource paths #### - -SENTRY_MANAGER_SRC="$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js" -SENTRY_MANAGER_MAP="$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js.map" - #### Build action definitions #### -# GESTURE_PROCESSOR_BUILD="$KEYMAN_ROOT/web/src/engine/osk/gesture-processor/build/lib/." -# GESTURE_PROCESSOR_TARGET="$KEYMAN_ROOT/web/build/engine/gesture-processor/lib/" - function do_copy() { mkdir -p "$KEYMAN_ROOT/$DEST" # The next two lines are needed for the sentry-integration manual test page. - cp "$SENTRY_MANAGER_SRC" "$KEYMAN_ROOT/$DEST/sentry-manager.js" - cp "$SENTRY_MANAGER_MAP" "$KEYMAN_ROOT/$DEST/sentry-manager.js.map" - - # mkdir -p "$GESTURE_PROCESSOR_TARGET" - # cp -a "$GESTURE_PROCESSOR_BUILD" "$GESTURE_PROCESSOR_TARGET" + cp "$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js" "$KEYMAN_ROOT/$DEST/sentry-manager.js" + cp "$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js.map" "$KEYMAN_ROOT/$DEST/sentry-manager.js.map" } -builder_run_action clean rm -rf "$KEYMAN_ROOT/$DEST" -builder_run_action build do_copy +builder_run_action clean rm -rf "$KEYMAN_ROOT/$DEST" +builder_run_action build do_copy diff --git a/web/src/tools/build.sh b/web/src/tools/build.sh index c057a75093..5a0837de7f 100755 --- a/web/src/tools/build.sh +++ b/web/src/tools/build.sh @@ -12,27 +12,15 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" ################################ Main script ################################ -builder_describe "Builds the Keyman Engine for Web's development & unit-testing tools" \ - "@/common/web/keyman-version" \ - "@/web/src/engine" \ +builder_describe "KeymanWeb development & unit-testing tools" \ "configure" \ "clean" \ "build" \ - "test" \ - ":bulk_rendering=testing/bulk_rendering Builds the bulk-rendering tool used to validate changes to OSK display code" \ - ":recorder=testing/recorder Builds the KMW recorder tool used for development of unit-test resources" \ - ":sourcemap-root=building/sourcemap-root Builds the sourcemap-cleaning tool used during minification of app/ builds" \ - ":test-utils=testing/test-utils Builds the test-utils module" \ - ":gesture-processor=testing/gesture-processor Gesture processor test utilities" + ":building" \ + ":testing" builder_parse "$@" builder_run_child_actions clean - -# Some of the web/src/test section uses this script as a dependency. We can skip -# the configure sections in such a case. -if ! builder_is_dep_build && ! builder_is_child_build; then - builder_run_child_actions configure -fi - +builder_run_child_actions configure builder_run_child_actions build \ No newline at end of file diff --git a/web/src/tools/building/build.sh b/web/src/tools/building/build.sh new file mode 100755 index 0000000000..13dc411e8d --- /dev/null +++ b/web/src/tools/building/build.sh @@ -0,0 +1,20 @@ +#!/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 "Keyman Engine for Web development tools" \ + "configure" \ + "clean" \ + "build" \ + ":sourcemap-root Sourcemap-cleaning tool used during minification of app/ builds" + +builder_parse "$@" + +builder_run_child_actions clean +builder_run_child_actions configure +builder_run_child_actions build \ No newline at end of file diff --git a/web/src/tools/building/sourcemap-root/build.sh b/web/src/tools/building/sourcemap-root/build.sh index 8e5db5e73f..c8932f6669 100755 --- a/web/src/tools/building/sourcemap-root/build.sh +++ b/web/src/tools/building/sourcemap-root/build.sh @@ -14,7 +14,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" ################################ Main script ################################ builder_describe "Builds the sourcemap-sanitizing script used for Keyman Engine for Web builds" \ - "@/common/tools/sourcemap-path-remapper" \ + "@/common/tools/sourcemap-path-remapper build" \ "clean" \ "configure" \ "build" \ diff --git a/web/src/tools/testing/build.sh b/web/src/tools/testing/build.sh new file mode 100755 index 0000000000..9709177d91 --- /dev/null +++ b/web/src/tools/testing/build.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# Compile KeymanWeb's dev & test tool modules +# +## 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" + +################################ Main script ################################ + +builder_describe "Keyman Engine for Web unit-testing and manual test tools" \ + "configure" \ + "clean" \ + "build" \ + ":bulk_rendering Bulk-rendering tool used to validate changes to OSK display code" \ + ":recorder KMW recorder tool used for development of unit-test resources" \ + ":test-utils Builds the test-utils module" \ + ":gesture-processor Gesture processor test utilities" + +builder_parse "$@" + +builder_run_child_actions clean +builder_run_child_actions configure +builder_run_child_actions build diff --git a/web/src/tools/testing/bulk_rendering/build.sh b/web/src/tools/testing/bulk_rendering/build.sh index c2e42dd96f..bb6a217202 100755 --- a/web/src/tools/testing/bulk_rendering/build.sh +++ b/web/src/tools/testing/bulk_rendering/build.sh @@ -16,10 +16,9 @@ SUBPROJECT_NAME=tools/testing/bulk_rendering ################################ Main script ################################ builder_describe "Builds a 'bulk renderer' that loads all the cloud keyboards from api.keyman.com and renders each of them to a document." \ - "@/common/tools/es-bundling" \ + "@/common/tools/es-bundling build" \ "@/web/src/common/web-utils build" \ - "@/web/src/app/browser build" \ - "@/web/src/app/ui build" \ + "@/web/src/app/browser build" \ "clean" \ "configure runs 'npm ci' on root folder" \ "build (default) builds bulk_renderer to web/build/$SUBPROJECT_NAME/" diff --git a/web/src/tools/testing/bulk_rendering/tsconfig.json b/web/src/tools/testing/bulk_rendering/tsconfig.json index 65b54a0a64..dc736a02b8 100644 --- a/web/src/tools/testing/bulk_rendering/tsconfig.json +++ b/web/src/tools/testing/bulk_rendering/tsconfig.json @@ -12,6 +12,7 @@ ], "references": [ + { "path": "../../../common/web-utils" }, { "path": "../../../app/browser" }, { "path": "../../../engine" } ] diff --git a/web/src/tools/testing/gesture-processor/build.sh b/web/src/tools/testing/gesture-processor/build.sh index a557245674..b596089914 100755 --- a/web/src/tools/testing/gesture-processor/build.sh +++ b/web/src/tools/testing/gesture-processor/build.sh @@ -16,7 +16,7 @@ BUILD_DIR=/web/build/tools/testing/gesture-processor ################################ Main script ################################ builder_describe "Testing-oriented tools for the Gesture Processor module of web-based Keyman OSKs" \ - "@/common/tools/es-bundling" \ + "@/common/tools/es-bundling build" \ "clean" \ "build" \ ":fixture The HTML-element fixture and CSS fixture used for both user-testing and unit-testing" \ @@ -27,8 +27,8 @@ builder_parse "$@" builder_describe_outputs \ configure /node_modules \ - build:fixture "${BUILD_DIR}/host-fixture.html" \ - build:recorder "${BUILD_DIR}/recorder/build/recorder.mjs" \ + build:fixture "${BUILD_DIR}/unit-test-resources/host-fixture.html" \ + build:recorder "/web/tools/testing/gesture-processor/recorder/build/recorder.mjs" \ build:test-module "${BUILD_DIR}/unit-test-resources/lib/index.mjs" # TODO: build if out-of-date if test is specified diff --git a/web/src/tools/testing/recorder-core/build.sh b/web/src/tools/testing/recorder-core/build.sh index 4bd56ee2b8..4075ce26f7 100755 --- a/web/src/tools/testing/recorder-core/build.sh +++ b/web/src/tools/testing/recorder-core/build.sh @@ -18,7 +18,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" builder_describe \ "Compiles the web-oriented utility function module." \ - "@/common/web/keyman-version" \ + "@/common/web/keyman-version build" \ configure \ clean \ build diff --git a/web/src/tools/testing/recorder-core/package.json b/web/src/tools/testing/recorder-core/package.json index ad059271e4..5bbe584e7e 100644 --- a/web/src/tools/testing/recorder-core/package.json +++ b/web/src/tools/testing/recorder-core/package.json @@ -18,10 +18,6 @@ "url": "https://github.com/keymanapp/keyman/issues" }, "homepage": "https://github.com/keymanapp/keyman#readme", - "dependencies": { - "@keymanapp/common-types": "*", - "@keymanapp/keyman-version": "*" - }, "devDependencies": { "typescript": "^5.4.5" } diff --git a/web/src/tools/testing/recorder-core/tsconfig.json b/web/src/tools/testing/recorder-core/tsconfig.json index e5b2d6ca5d..9bed116df2 100644 --- a/web/src/tools/testing/recorder-core/tsconfig.json +++ b/web/src/tools/testing/recorder-core/tsconfig.json @@ -13,9 +13,7 @@ ], "references": [ - { "path": "../../../../../common/web/keyman-version" }, { "path": "../../../common/web-utils/" }, - { "path": "../../../engine/predictive-text/types" }, { "path": "../../../engine" }, ], } diff --git a/web/src/tools/testing/recorder/build.sh b/web/src/tools/testing/recorder/build.sh index 92db811915..edada7aeee 100755 --- a/web/src/tools/testing/recorder/build.sh +++ b/web/src/tools/testing/recorder/build.sh @@ -16,10 +16,10 @@ SUBPROJECT_NAME=tools/testing/recorder ################################ Main script ################################ builder_describe "Builds the Keyman Engine for Web's test-sequence recording tool" \ - "@/common/tools/es-bundling" \ - "@/common/web/keyman-version" \ - "@/web/src/engine" \ - "@../recorder-core" \ + "@/common/tools/es-bundling build" \ + "@/common/web/keyman-version build" \ + "@/web/src/engine build" \ + "@../recorder-core build" \ "clean" \ "configure" \ "build" diff --git a/web/src/tools/testing/recorder/tsconfig.json b/web/src/tools/testing/recorder/tsconfig.json index d6e23c6a9a..0d3d3e5bc6 100644 --- a/web/src/tools/testing/recorder/tsconfig.json +++ b/web/src/tools/testing/recorder/tsconfig.json @@ -9,9 +9,7 @@ "include": [ "*.ts" ], "references": [ - { "path": "../../../../../common/web/keyman-version" }, { "path": "../../../common/web-utils" }, - { "path": "../../../engine/predictive-text/types" }, { "path": "../../../app/browser" }, { "path": "../recorder-core" }, { "path": "../../../engine" },