HEADcourier-fixdev-browser-capabilitiespdorelease-0.7release-0.8
|
Last change
on this file since 54f1af8 was
54f1af8,
checked in by thomascube <thomas@…>, 21 months ago
|
|
Download closure compiler to /tmp instead of current dir
|
-
Property mode set to
100755
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #!/bin/sh |
|---|
| 2 | JS_DIR=`dirname "$0"`/../program/js |
|---|
| 3 | JAR_DIR='/tmp' |
|---|
| 4 | CLOSURE_COMPILER_URL='http://closure-compiler.googlecode.com/files/compiler-latest.zip' |
|---|
| 5 | |
|---|
| 6 | do_shrink() { |
|---|
| 7 | rm -f "$2" |
|---|
| 8 | java -jar $JAR_DIR/compiler.jar --compilation_level=SIMPLE_OPTIMIZATIONS --js="$1" --js_output_file="$2" |
|---|
| 9 | } |
|---|
| 10 | |
|---|
| 11 | if [ ! -d "$JS_DIR" ]; then |
|---|
| 12 | echo "Directory $JS_DIR not found." |
|---|
| 13 | exit 1 |
|---|
| 14 | fi |
|---|
| 15 | |
|---|
| 16 | if [ ! -w "$JAR_DIR" ]; then |
|---|
| 17 | JAR_DIR=`dirname "$0"` |
|---|
| 18 | fi |
|---|
| 19 | |
|---|
| 20 | if java -version >/dev/null 2>&1; then |
|---|
| 21 | : |
|---|
| 22 | else |
|---|
| 23 | echo "Java not found. Please ensure that the 'java' program is in your PATH." |
|---|
| 24 | exit 1 |
|---|
| 25 | fi |
|---|
| 26 | |
|---|
| 27 | if [ ! -r "$JAR_DIR/compiler.jar" ]; then |
|---|
| 28 | if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then |
|---|
| 29 | wget "$CLOSURE_COMPILER_URL" -O "/tmp/$$.zip" |
|---|
| 30 | elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then |
|---|
| 31 | curl "$CLOSURE_COMPILER_URL" -o "/tmp/$$.zip" |
|---|
| 32 | else |
|---|
| 33 | echo "Please download $CLOSURE_COMPILER_URL and extract compiler.jar to $JAR_DIR/." |
|---|
| 34 | exit 1 |
|---|
| 35 | fi |
|---|
| 36 | (cd $JAR_DIR && unzip "/tmp/$$.zip" "compiler.jar") |
|---|
| 37 | rm -f "/tmp/$$.zip" |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | for fn in app common googiespell list; do |
|---|
| 41 | if [ -r "$JS_DIR/${fn}.js.src" ]; then |
|---|
| 42 | echo "$JS_DIR/${fn}.js.src already exists, not overwriting" |
|---|
| 43 | else |
|---|
| 44 | mv "$JS_DIR/${fn}.js" "$JS_DIR/${fn}.js.src" |
|---|
| 45 | fi |
|---|
| 46 | echo "Shrinking $JS_DIR/${fn}.js" |
|---|
| 47 | do_shrink "$JS_DIR/${fn}.js.src" "$JS_DIR/${fn}.js" |
|---|
| 48 | done |
|---|
Note: See
TracBrowser
for help on using the repository browser.