source: Dev/branches/rest-dojo-ui/client/build.sh @ 374

Last change on this file since 374 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/bash
2
3set -e
4
5# Base directory for this entire project
6BASEDIR=$(cd $(dirname $0) && pwd)
7
8# Source directory for unbuilt code
9SRCDIR="$BASEDIR"
10
11# Directory containing dojo build utilities
12TOOLSDIR="$SRCDIR/util/buildscripts"
13
14# Destination directory for built code
15DISTDIR="$BASEDIR/dist"
16
17# Main application package loader configuration
18LOADERCONF="$SRCDIR/rft/main.js"
19
20# Main application package build configuration
21PROFILE="$SRCDIR/rft/rft.profile.js"
22
23# Configuration over. Main application start up!
24
25if [ ! -d "$TOOLSDIR" ]; then
26    echo "Can't find Dojo build tools -- did you initialise submodules? (git submodule update --init --recursive)"
27    exit 1
28fi
29
30echo "Building application with $PROFILE to $DISTDIR."
31
32echo -n "Cleaning old files..."
33rm -rf "$DISTDIR"
34echo " Done"
35
36cd "$TOOLSDIR"
37
38if which node >/dev/null; then
39    node ../../dojo/dojo.js load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" "$@"
40elif which java >/dev/null; then
41    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" "$@"
42else
43    echo "Need node.js or Java to build!"
44    exit 1
45fi
46
47cd "$BASEDIR"
48
49LOADERMID=${LOADERMID//\//\\\/}
50
51# Copy & minify index.html to dist
52cat "$SRCDIR/index.html" | tr '\n' ' ' | \
53perl -pe "
54  s/<\!--.*?-->//g;                          # Strip comments
55  s/isDebug: *1/deps:['$LOADERMID']/;        # Remove isDebug, add deps
56  s/<script src=\"$LOADERMID.*?\/script>//;  # Remove script app/run
57  s/\s+/ /g;                                 # Collapse white-space" > "$DISTDIR/index.html"
58
59echo "Build complete"
Note: See TracBrowser for help on using the repository browser.