Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): integrates predictive-text builds to top level script, reconnects headless tests #12866

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions web/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ builder_run_child_actions build:engine/attachment
# Uses engine/interfaces (due to resource-path config interface)
builder_run_child_actions build:engine/keyboard-storage

# Uses engine/interfaces, engine/keyboard-storage, & engine/osk
# Builds the predictive-text components
builder_run_child_actions build:engine/predictive-text

# Uses engine/interfaces, engine/keyboard-storage, engine/predictive-text, & engine/osk
builder_run_child_actions build:engine/main

# Uses all but engine/element-wrappers and engine/attachment
Expand All @@ -190,7 +193,7 @@ builder_run_child_actions build:test-pages
builder_run_action build:_all build_action

# Run tests
# builder_run_child_actions test
builder_run_child_actions test
builder_run_action test:_all test_action

function do_test_help() {
Expand Down
68 changes: 68 additions & 0 deletions web/src/engine/predictive-text/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
#
# Compile keymanweb predictive-text components.

## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../../resources/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE

. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"

# ################################ Main script ################################

builder_describe "Builds predictive-text components used within Keyman Engine for Web (KMW)." \
"clean" \
"configure" \
"build" \
"test" \
":templates Builds the model templates utlilized by compiled lexical models" \
jahorton marked this conversation as resolved.
Show resolved Hide resolved
":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)" \
"--ci+ Set to utilize CI-based test configurations & reporting."

# Possible TODO?
# "upload-symbols Uploads build product to Sentry for error report symbolification. Only defined for $DOC_BUILD_EMBED_WEB" \

builder_parse "$@"

config=release
if builder_is_debug_build; then
config=debug
fi

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"

BUNDLE_CMD="node ${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs"

#### Build action definitions ####

# We can run all clean & configure actions at once without much issue.

builder_run_child_actions clean

## Clean actions

builder_run_child_actions configure
jahorton marked this conversation as resolved.
Show resolved Hide resolved

## Build actions

builder_run_child_actions build:wordbreakers

builder_run_child_actions build:templates
builder_run_child_actions build:worker-thread
builder_run_child_actions build:worker-main

# If doing CI testing, the predictive-text child actions have their own build configuration.
# For local testing, though, we can allow them to proceed.
if ! builder_has_option --ci; then
builder_run_child_actions test
fi
11 changes: 6 additions & 5 deletions web/src/engine/predictive-text/worker-main/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ function do_build() {
function do_test() {
local TEST_OPTIONS=
if builder_has_option --ci; then
TEST_OPTIONS=--ci
# We'll test the included libraries here for now. At some point, we may wish
# to establish a ci.sh script for predictive-text to handle this instead.
./unit_tests/test.sh test:libraries test:headless test:browser --ci
else
# If we're not in --ci mode, then this doesn't need to trigger the sibling projects' tests.
./unit_tests/test.sh test:headless test:browser
fi

# We'll test the included libraries here for now. At some point, we may wish
# to establish a ci.sh script for predictive-text to handle this instead.
./unit_tests/test.sh test:libraries test:headless test:browser $TEST_OPTIONS
}

builder_run_action configure do_configure
Expand Down
Loading