Files
blockly/tests/compile/compile.sh
Neil Fraser 82705923cb Convert compile demo into a unit test. (#1360)
* Intentionally break Travis.

* Alphabetize tests, remove orphaned test, and add fail to test that's running.

* Unbreak test, disable OS X, move scripts, list compiler directory.

* Test Java, break test.

* Unbreak test, call compile script.

* Compile main_compressed.js

* Run test command using bash.

* Fix path.

* Exclude node modules.

* Be more specific about JS files to compile.

* Test failure.

* Restore OSX, undo Blockly failure, remove compilation demo, add compilation test.

* Delete manual test files.

* Ignore downloaded/generated files.

* Whitespace cleanup.
2017-10-12 14:54:57 -07:00

35 lines
1.1 KiB
Bash
Executable File

# Find the Closure Compiler.
if [ -f "$(npm root)/google-closure-compiler/compiler.jar" ]; then
# Travis test.
COMPILER="$(npm root)/google-closure-compiler/compiler.jar"
elif [ -f *compiler*.jar ]; then
# Manual test.
COMPILER="*compiler*.jar"
else
echo "ERROR: Closure Compiler not found."
echo "Download from this URL, and place jar file in current directory."
echo "https://dl.google.com/closure-compiler/compiler-latest.zip"
exit 1
fi
rm main_compressed.js 2> /dev/null
echo Compiling Blockly...
java -jar $COMPILER --js='main.js' \
--js='../../core/**.js' \
--js='../../blocks/**.js' \
--js='../../generators/**.js' \
--js='../../msg/js/**.js' \
--js='../../../closure-library/closure/goog/**.js' \
--js='../../../closure-library/third_party/closure/goog/**.js' \
--generate_exports \
--externs ../../externs/svg-externs.js \
--compilation_level ADVANCED_OPTIMIZATIONS \
--dependency_mode=STRICT --entry_point=Main \
--js_output_file main_compressed.js
if [ -s main_compressed.js ]; then
echo Compilation OK.
else
echo Compilation FAIL.
exit 1
fi