Adds a -no-minify CL argument to KMW's build.sh.

This commit is contained in:
Joshua A. Horton 2018-01-25 09:10:15 +07:00
parent 0c40349312
commit 7aa7398a91

View file

@ -12,13 +12,14 @@ display_usage ( ) {
echo " -embed to compile only the KMEA/KMEI embedded engine."
echo " -web to compile only the KeymanWeb engine."
echo " -debug_embedded to compile a readable version of the embedded KMEA/KMEI code"
echo " -no_minify to disable the minification '/release/' build sections"
exit 1
}
# Fails the build if a specified file does not exist.
assert ( ) {
if ! [ -f $1 ]; then
echo "Build failed."
fail "Build failed."
exit 1
fi
}
@ -148,6 +149,7 @@ BUILD_EMBED=true
BUILD_FULLWEB=true
BUILD_DEBUG_EMBED=false
BUILD_COREWEB=true
DO_MINIFY=true
if [[ $# = 0 ]]; then
FULL_BUILD=true
@ -156,7 +158,7 @@ else
fi
# Parse args
if [[ $# -gt 0 ]] ; then
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-ui)
@ -188,15 +190,19 @@ if [[ $# -gt 0 ]] ; then
-h|-?)
display_usage
;;
-no_minify)
DO_MINIFY=false
;;
esac
shift # past argument
fi
done
readonly BUILD_UI
readonly BUILD_EMBED
readonly BUILD_FULLWEB
readonly BUILD_DEBUG_EMBED
readonly BUILD_COREWEB
readonly DO_MINIFY
if [ $FULL_BUILD = true ]; then
echo Compiling build $BUILD
@ -218,12 +224,13 @@ if [ $BUILD_EMBED = true ]; then
fail "Typescript compilation failed."
fi
assert $INTERMEDIATE/keyman.js
echo Embedded TypeScript compiled.
echo Embedded TypeScript compiled as $INTERMEDIATE/keyman.js
minify keyman.js $EMBED_OUTPUT SIMPLE_OPTIMIZATIONS "keyman.__BUILD__=$BUILD"
assert $EMBED_OUTPUT/keyman.js
echo Compiled embedded application saved as $EMBED_OUTPUT/keyman.js
if [ $DO_MINIFY = true ]; then
minify keyman.js $EMBED_OUTPUT SIMPLE_OPTIMIZATIONS "keyman.__BUILD__=$BUILD"
assert $EMBED_OUTPUT/keyman.js
echo Compiled embedded application saved as $EMBED_OUTPUT/keyman.js
fi
# Update any changed resources
@ -246,16 +253,18 @@ if [ $BUILD_COREWEB = true ]; then
fail "Typescript compilation failed."
fi
assert $INTERMEDIATE/keymanweb.js
echo Native TypeScript compiled.
echo Native TypeScript compiled as $INTERMEDIATE/keymanweb.js
copy_resources "$INTERMEDIATE"
if [ $DO_MINIFY = true ]; then
echo Minifying KeymanWeb...
minify keymanweb.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "keyman.__BUILD__=$BUILD"
assert $WEB_OUTPUT/keymanweb.js
minify keymanweb.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "keyman.__BUILD__=$BUILD"
assert $WEB_OUTPUT/keymanweb.js
echo Compiled KeymanWeb application saved as $WEB_OUTPUT/keymanweb.js
echo Compiled KeymanWeb application saved as $WEB_OUTPUT/keymanweb.js
fi
fi
if [ $BUILD_FULLWEB = true ]; then
@ -274,27 +283,31 @@ if [ $BUILD_UI = true ]; then
assert $INTERMEDIATE/kmwuifloat.js
assert $INTERMEDIATE/kmwuibutton.js
echo Minify ToolBar UI
del $WEB_OUTPUT/kmuitoolbar.js 2>/dev/null
minify kmwuitoolbar.js $WEB_OUTPUT ADVANCED_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuitoolbar.js
echo \'Native\' UI TypeScript has been compiled into the $INTERMEDIATE/ folder
echo Minify Toggle UI
del $WEB_OUTPUT/kmuitoggle.js 2>/dev/null
minify kmwuitoggle.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuitoggle.js
if [ $DO_MINIFY = true ]; then
echo Minify ToolBar UI
del $WEB_OUTPUT/kmuitoolbar.js 2>/dev/null
minify kmwuitoolbar.js $WEB_OUTPUT ADVANCED_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuitoolbar.js
echo Minify Float UI
del $WEB_OUTPUT/kmuifloat.js 2>/dev/null
minify kmwuifloat.js $WEB_OUTPUT ADVANCED_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuifloat.js
echo Minify Toggle UI
del $WEB_OUTPUT/kmuitoggle.js 2>/dev/null
minify kmwuitoggle.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuitoggle.js
echo Minify Button UI
del $WEB_OUTPUT/kmuibutton.js 2>/dev/null
minify kmwuibutton.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuibutton.js
echo Minify Float UI
del $WEB_OUTPUT/kmuifloat.js 2>/dev/null
minify kmwuifloat.js $WEB_OUTPUT ADVANCED_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuifloat.js
echo User interface modules compiled and saved under $WEB_OUTPUT
echo Minify Button UI
del $WEB_OUTPUT/kmuibutton.js 2>/dev/null
minify kmwuibutton.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "" "(function() {%output%}());"
assert $WEB_OUTPUT/kmwuibutton.js
echo User interface modules compiled and saved under $WEB_OUTPUT
fi
fi
if [ $BUILD_DEBUG_EMBED = true ]; then