-
Notifications
You must be signed in to change notification settings - Fork 3
/
jscompile.sh
executable file
·37 lines (33 loc) · 1.01 KB
/
jscompile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env sh
#See https://developers.google.com/closure/compiler/
#See https://code.google.com/p/closure-compiler/
#See https://code.google.com/p/closure-compiler/wiki/BuildingWithAnt
#Internal variables
_thisDir=`dirname "$0"`
_libDir=$( cd "$_thisDir/../lib"; pwd )
_googleClosureCompilerDir="$_libDir/google-closure-compiler-latest"
#Check setup
if [ ! `which java 2> /dev/null` ]; then
echo "Error: Could not find java" > /dev/stderr
return
fi
if [ ! -d "$_libDir" ]; then
echo "Error: Could not find \"$_libDir\"" > /dev/stderr
return
fi
if [ ! -d "$_googleClosureCompilerDir" ] || [ ! -s "$_googleClosureCompilerDir/compiler.jar" ]; then
echo "Error: Could not find \"$_googleClosureCompilerDir/compiler.jar\"" > /dev/stderr
return
fi
#Execute using its command line intereface.
if [ -z "$*" ]; then
java \
-server -XX:+TieredCompilation \
-jar "$_googleClosureCompilerDir/compiler.jar" \
--help
else
java \
-server -XX:+TieredCompilation \
-jar "$_googleClosureCompilerDir/compiler.jar" \
"$@"
fi