mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
chore(common): remove builder_init
builder_init was unnecessarily and inconsistently duplicating builder_describe and builder_parse functionality. Removing it -- all scripts should use builder_describe and builder_parse instead, which gives us more flexibility and consistency into the future.
This commit is contained in:
parent
ab54c0ecb9
commit
8fd3442fe2
4 changed files with 12 additions and 26 deletions
|
|
@ -19,7 +19,8 @@ cd "$(dirname "$THIS_SCRIPT")"
|
|||
|
||||
################################ Main script ################################
|
||||
|
||||
builder_init "configure clean build test" "$@"
|
||||
builder_describe "Build the include script for current Keyman version" configure clean build 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
|
||||
|
|
|
|||
|
|
@ -74,7 +74,11 @@ wrap-worker-code ( ) {
|
|||
|
||||
################################ Main script ################################
|
||||
|
||||
builder_init "configure clean build test" "$@"
|
||||
builder_describe \
|
||||
"Compiles the Language Modeling Layer for common use in predictive text and autocorrective applications." \
|
||||
configure clean build 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
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ _builder_get_default_description() {
|
|||
configure) description="install dependencies, e.g. npm" ;;
|
||||
build) description="build target(s)" ;;
|
||||
test) description="run automated tests" ;;
|
||||
":project") description="this project" ;;
|
||||
:project) description="this project" ;;
|
||||
:app) description="main app" ;;
|
||||
:engine) description="engine module" ;;
|
||||
:module) description="this module" ;;
|
||||
|
|
@ -443,26 +443,6 @@ _builder_get_default_description() {
|
|||
echo "$description"
|
||||
}
|
||||
|
||||
# Initializes a build.sh script, parses command line. Will abort the script if
|
||||
# invalid parameters are passed in. This is a shorthand for builder_describe
|
||||
# followed by builder_parse, useful for simple scripts which don't need
|
||||
# additional detail in parameters or multiple targets.
|
||||
#
|
||||
# Usage:
|
||||
# builder_init "action1 action2" "$@"
|
||||
# Parameters
|
||||
# 1: _builder_actions space-separated list of possible actions
|
||||
# 2: $@ command-line arguments
|
||||
builder_init() {
|
||||
_builder_actions=($1)
|
||||
_builder_targets=(:project)
|
||||
_builder_options=()
|
||||
declare -A -g _builder_params
|
||||
declare -A -g _builder_options_short
|
||||
shift
|
||||
builder_parse "$@"
|
||||
}
|
||||
|
||||
# Initializes a build.sh script, parses command line. Will abort the script if
|
||||
# invalid parameters are passed in. Use together with builder_describe which
|
||||
# sets up the possible command line parameters
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA
|
|||
|
||||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
||||
|
||||
# Shorthand builder_init
|
||||
# First up, test the simple case with a default :project target
|
||||
|
||||
builder_init "clean build" "build"
|
||||
builder_describe - clean build
|
||||
builder_parse "build"
|
||||
if [[ "${_builder_chosen_action_targets[@]}" != "build:project" ]]; then
|
||||
fail " Test: builder_init, shorthand form 'build' should give us 'build:project"
|
||||
fail " Test: builder_parse, shorthand form 'build' should give us 'build:project"
|
||||
fi
|
||||
|
||||
if builder_has_action build; then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue