mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by giving the scripts more appropriate names. Most build scripts should use builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh. Documented in resources/build/README.md. Renames: * resources/build/builder.inc.sh to resources/build/builder-full.inc.sh * resources/build/build-utils.sh to resources/build/builder-basic.inc.sh Other changes: * Moves Android-specific functions out of builder-basic.inc.sh and into android/build.sh. * Renames functions in builder-basic.inc.sh More functions may be moved from builder-basic.inc.sh into utils.inc.sh or other scripts in the future. Fixes: #14065 Build-bot: build all Test-bot: skip
95 lines
2.3 KiB
Bash
Executable file
95 lines
2.3 KiB
Bash
Executable file
#!/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/zip.inc.sh"
|
|
|
|
targets=()
|
|
# Build list of available targets from subfolders, if none specified
|
|
for d in */; do
|
|
d="$(basename "$d")"
|
|
if [ "$d" != "invalid" ] && [ "$d" != "issue" ]; then
|
|
targets+=(":$d")
|
|
fi
|
|
done
|
|
|
|
KMC="$KEYMAN_ROOT/developer/src/kmc/build/src/kmc.js"
|
|
|
|
builder_describe "Test Keyboards" \
|
|
clean configure build \
|
|
${targets[@]} \
|
|
"--index Build index.html for artifact tests" \
|
|
"--zip-source Create zip file for source of each keyboard for artifact tests" \
|
|
"--kmc=KMC Specify path to kmc, defaults to developer/src/kmc/build/" \
|
|
"--silent,-s Suppress information messages"
|
|
|
|
builder_parse "$@"
|
|
|
|
function zipsource() {
|
|
local target="$1"
|
|
pushd "$1" > /dev/null
|
|
add_zip_files "${target}_source.zip" -x@../zip-excludes -q -r . # -q quiet, -r recursive
|
|
popd > /dev/null
|
|
}
|
|
|
|
function build_index() {
|
|
local active_targets=($*)
|
|
cat << EOF > index.html
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<title>Test Keyboards - $KEYMAN_VERSION_WITH_TAG</title>
|
|
</head>
|
|
<body>
|
|
<h1>Test Keyboards - $KEYMAN_VERSION_WITH_TAG</h1>
|
|
<ul>
|
|
EOF
|
|
|
|
for TARGET in "${active_targets[@]}"; do
|
|
if builder_has_option --zip-source; then
|
|
echo " <li><a href='$TARGET/build/$TARGET.kmp'>$TARGET.kmp</a> (<a href='$TARGET/${TARGET}_source.zip'>source</a>)</li>" >> index.html
|
|
else
|
|
echo " <li><a href='$TARGET/build/$TARGET.kmp'>$TARGET.kmp</a></li>" >> index.html
|
|
fi
|
|
done
|
|
|
|
cat << EOF >> index.html
|
|
</ul>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
}
|
|
|
|
###
|
|
|
|
function build() {
|
|
local active_targets=()
|
|
for TARGET in "${targets[@]}"; do
|
|
if builder_has_action build$TARGET; then
|
|
active_targets+=(${TARGET#:})
|
|
fi
|
|
done
|
|
|
|
local ss=
|
|
if builder_has_option --silent; then
|
|
ss="--log-level silent"
|
|
fi
|
|
|
|
node "$KMC" build $builder_debug $ss -w "${active_targets[@]}"
|
|
|
|
if builder_has_option --zip-source; then
|
|
for TARGET in "${active_targets[@]}"; do
|
|
zipsource "$TARGET"
|
|
done
|
|
fi
|
|
|
|
if builder_has_option --index; then
|
|
build_index "${active_targets[@]}"
|
|
fi
|
|
}
|
|
|
|
builder_run_action build build
|