#!/bin/bash set -e # Base directory for this entire project BASEDIR=$(cd $(dirname $0) && pwd) # Source directory for unbuilt code SRCDIR="$BASEDIR" # Directory containing dojo build utilities TOOLSDIR="$SRCDIR/util/buildscripts" # Destination directory for built code DISTDIR="$BASEDIR/dist" # Main application package loader configuration LOADERCONF="$SRCDIR/rft/main.js" # Main application package build configuration PROFILE="$SRCDIR/rft/rft.profile.js" # Configuration over. Main application start up! if [ ! -d "$TOOLSDIR" ]; then echo "Can't find Dojo build tools -- did you initialise submodules? (git submodule update --init --recursive)" exit 1 fi echo "Building application with $PROFILE to $DISTDIR." echo -n "Cleaning old files..." rm -rf "$DISTDIR" echo " Done" cd "$TOOLSDIR" if which node >/dev/null; then node ../../dojo/dojo.js load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" "$@" elif which java >/dev/null; then java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar:../closureCompiler/compiler.jar:../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl=../../dojo load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" "$@" else echo "Need node.js or Java to build!" exit 1 fi cd "$BASEDIR" LOADERMID=${LOADERMID//\//\\\/} # Copy & minify index.html to dist cat "$SRCDIR/index.html" | tr '\n' ' ' | \ perl -pe " s/<\!--.*?-->//g; # Strip comments s/isDebug: *1/deps:['$LOADERMID']/; # Remove isDebug, add deps s/