-
Notifications
You must be signed in to change notification settings - Fork 353
/
compile.sh
executable file
·32 lines (28 loc) · 1 KB
/
compile.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
# Script for generating the compiled acorn_interpreter.js file.
# For Linux, BSD, MacOS, etc.
# Download Closure Compiler if not already present.
if test -f "compiler.jar"; then
echo "Found Closure Compiler."
else
echo "Downloading Closure Compiler."
wget -N https://unpkg.com/google-closure-compiler-java/compiler.jar
if test -f "compiler.jar"; then
echo "Downloaded Closure Compiler."
else
echo "Unable to download Closure Compiler."
exit 1
fi
fi
# Make a copy of the interpreter so that polyfill sources can be complied.
cp interpreter.js interpreter.tmp.js
# This step is optional, but reduces the output by 5 KB.
python polyfill_compile.py interpreter.tmp.js
echo "Compiling Acorn + JS-Interpreter..."
java -jar ./compiler.jar \
--compilation_level ADVANCED_OPTIMIZATIONS \
--language_in=ECMASCRIPT5 --language_out=ECMASCRIPT5 \
--warning_level VERBOSE \
--js='acorn.js' --js='interpreter.tmp.js' \
--js_output_file acorn_interpreter.js
rm interpreter.tmp.js
echo "Done"