mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-28 19:27:44 +00:00
85 lines
No EOL
2.3 KiB
Bash
85 lines
No EOL
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
|
|
# Compiles all build products corresponding to the specified target.
|
|
# This should be called from the working directory of a child project's
|
|
# build script.
|
|
#
|
|
# ### Parameters
|
|
#
|
|
# * 1: `product` the product's source path under src/
|
|
#
|
|
# ### Example
|
|
#
|
|
# ```bash
|
|
# compile engine/main
|
|
# ```
|
|
compile ( ) {
|
|
if [ $# -lt 1 ]; then
|
|
builder_die "Scripting error: insufficient argument count!"
|
|
fi
|
|
|
|
local COMPILE_TARGET="$1"
|
|
local BUNDLE_FLAG="${2:-}"
|
|
|
|
tsc -b "${KEYMAN_ROOT}/web/src/$COMPILE_TARGET" -v
|
|
|
|
if [ -f "./build-bundler.js" ]; then
|
|
node "./build-bundler.js" "$BUNDLE_FLAG"
|
|
|
|
# So... tsc does declaration-bundling on its own pretty well, at least for local development.
|
|
tsc --emitDeclarationOnly --outFile "${KEYMAN_ROOT}/web/build/$COMPILE_TARGET/lib/index.d.ts" -p "${KEYMAN_ROOT}/web/src/$COMPILE_TARGET"
|
|
fi
|
|
}
|
|
|
|
_copy_dir_if_exists ( ) {
|
|
local SRC=$1
|
|
local DST=$2
|
|
|
|
if [ -d "$SRC" ]; then
|
|
cp -rf "$SRC/." "$DST"
|
|
fi
|
|
}
|
|
|
|
# Copies top-level build artifacts into common 'debug' and 'release' config folders
|
|
# for use in publishing.
|
|
prepare ( ) {
|
|
local CHILD_BUILD_ROOT="$KEYMAN_ROOT/web/build/app"
|
|
local PUBLISH_BUILD_ROOT="$KEYMAN_ROOT/web/build/publish"
|
|
|
|
mkdir -p "$PUBLISH_BUILD_ROOT/debug"
|
|
mkdir -p "$PUBLISH_BUILD_ROOT/release"
|
|
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/browser/debug" "$PUBLISH_BUILD_ROOT/debug"
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/browser/release" "$PUBLISH_BUILD_ROOT/release"
|
|
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/resources" "$PUBLISH_BUILD_ROOT/debug"
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/resources" "$PUBLISH_BUILD_ROOT/release"
|
|
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/ui/debug" "$PUBLISH_BUILD_ROOT/debug"
|
|
_copy_dir_if_exists "$CHILD_BUILD_ROOT/ui/release" "$PUBLISH_BUILD_ROOT/release"
|
|
}
|
|
|
|
# Runs all headless tests corresponding to the specified target.
|
|
# This should be called from the working directory of a child project's
|
|
# build script.
|
|
#
|
|
# ### Parameters
|
|
#
|
|
# * 1: `product` the folder under src/test/auto/headless containing the
|
|
# child project's tests
|
|
#
|
|
# ### Example
|
|
#
|
|
# ```bash
|
|
# # from engine/osk
|
|
# test-headless osk
|
|
# ```
|
|
test-headless ( ) {
|
|
TEST_OPTS=
|
|
if builder_has_option --ci; then
|
|
TEST_OPTS="--reporter mocha-teamcity-reporter"
|
|
fi
|
|
|
|
mocha --recursive "${KEYMAN_ROOT}/web/src/test/auto/headless/$1" $TEST_OPTS
|
|
} |