Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / build / build.sh
1 #!/bin/sh
2
3 USAGE="Usage: ./build.sh DEPLOY_DIR [TYPE]
4
5 The type option can be one of the following:
6 sdk             - Build the whole Ext SDK
7 sass            - Build css files. Assumes compass is installed
8 bootstrap-data  - Build bootstrap data
9 tests           - Build test indexes"
10
11 CURRENT_DIR="$(dirname $0)"
12 DEPLOY_DIR="$1"
13 BUILD_OPTION="$2"
14
15 cd ${CURRENT_DIR}
16
17 JSBUILDER_PATH="../jsbuilder/JSBuilder.sh"
18 BUILD_SDK_CMD="${JSBUILDER_PATH} --projectFile sdk.jsb3 --deployDir ${DEPLOY_DIR} --verbose"
19 BUILD_SASS="compass compile ../resources/sass -f"
20 BUILD_TESTS="./build-tests.sh"
21
22 # Build Ext.Loader paths to platform for dynamic loading
23 UNAME="$(uname)"
24 ARGUMENTS=$*
25 JSBUILDER_DIRNAME="$(dirname $JSBUILDER_PATH)"
26 if [ $UNAME = "Darwin" ] ; then
27     OS="mac"
28 elif [ ${UNAME%%_*} = "CYGWIN" ] ; then
29     OS="win"
30 elif [ ${UNAME%%32*} = "MINGW" ] ; then
31     OS="win"
32 elif [ ${UNAME%%64*} = "MINGW" ] ; then
33     OS="win"
34 else
35     OS="linux"
36 fi
37 JSDB_PATH="${JSBUILDER_DIRNAME}/jsdb/${OS}"
38 BUILD_BOOTSTRAP_DATA_CMD="${JSDB_PATH}/jsdb build-bootstrap-data.js ${DEPLOY_DIR} ${OS}"
39
40 # error checking
41 if [ -z ${DEPLOY_DIR} ] ; then
42     IFS='%'
43     echo ${USAGE}
44     unset IFS
45     exit 1
46 fi
47
48 if [ -z ${BUILD_OPTION} ] ; then
49     # empty second arg, build sdk/all
50     ${BUILD_SDK_CMD}
51
52     CUSTOM_BUILD_EXAMPLES="app/simple app/feed-viewer app/nested-loading portal desktop"
53
54     for CUSTOM_BUILD_EXAMPLE in $CUSTOM_BUILD_EXAMPLES
55         do
56             echo "Processing custom build: ${CUSTOM_BUILD_EXAMPLE}..."
57             ${JSBUILDER_PATH} --projectFile ../examples/${CUSTOM_BUILD_EXAMPLE}/app.jsb3 --deployDir ${DEPLOY_DIR}/examples/${CUSTOM_BUILD_EXAMPLE} --verbose
58     done
59
60     # I know this is dirty but there's no other way to automate this
61     # JSBuilder does not support file moving
62     MVC_EXAMPLES="simple feed-viewer nested-loading"
63     for MVC_EXAMPLE_NAME in $MVC_EXAMPLES
64         do
65             echo "Processing MVC example: ${MVC_EXAMPLE_NAME}..."
66             mv -f ${DEPLOY_DIR}/examples/app/${MVC_EXAMPLE_NAME}/${MVC_EXAMPLE_NAME}-release.html ${DEPLOY_DIR}/examples/app/${MVC_EXAMPLE_NAME}/${MVC_EXAMPLE_NAME}.html
67     done
68
69     # Portal example
70     echo "Processing Portal example..."
71     mv -f ${DEPLOY_DIR}/examples/portal/portal-release.html ${DEPLOY_DIR}/examples/portal/portal.html
72
73     # Portal example
74     echo "Processing Desktop example..."
75     mv -f ${DEPLOY_DIR}/examples/desktop/desktop-release.html ${DEPLOY_DIR}/examples/desktop/desktop.html
76
77 else
78     # Check second arg is valid, build it
79     if [ ${BUILD_OPTION} = "sdk" ] ; then
80         ${BUILD_SDK_CMD}
81     elif [ ${BUILD_OPTION} = "ext-all" ] ; then
82         echo "There's no longer a separate ext-all build, simply build sdk instead"
83     elif [ ${BUILD_OPTION} = "sass" ] ; then
84         ${BUILD_SASS}
85     elif [ ${BUILD_OPTION} = "bootstrap-data" ] ; then
86                 echo "[HINT] You can simply execute `build-bootstrap.sh` instead for convenience"
87         ${BUILD_BOOTSTRAP_DATA_CMD}
88
89     elif [ ${BUILD_OPTION} = "tests" ] ; then
90                 echo "[HINT] You can simply execute build-tests.sh instead for convenience"
91         ${BUILD_TESTS}
92     else
93         IFS='%'
94         echo ${USAGE}
95         unset IFS
96         exit 1
97     fi
98 fi