Work in progress (Needed a Travis run) (#1869)

Fix advanced compilation on Travis
This commit is contained in:
Andrew n marshall
2018-05-16 14:16:02 -07:00
committed by GitHub
parent 9ab746e143
commit f2b6c9a948
4 changed files with 31 additions and 21 deletions

View File

@@ -13,14 +13,9 @@ matrix:
node_js: stable
osx_image: xcode8.3
before_install:
- npm install google-closure-library
- npm install google-closure-compiler
- npm install webdriverio
# Symlink closure library
- ln -s $(npm root)/google-closure-library ../closure-library
before_script:
# Symlink closure library used by test/jsunit
- ln -s $(npm root)/google-closure-library ../closure-library
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi
@@ -30,4 +25,4 @@ script:
- set -x
- npm run lint
- npm test
- cd tests/compile; compile.sh; cd ..
- tests/compile/compile.sh

View File

@@ -27,6 +27,7 @@
"private": true,
"devDependencies": {
"eslint": "^4.16",
"google-closure-compiler": "^20180506.0.0",
"google-closure-library": "^20180506.0.0",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",

View File

@@ -1,8 +1,12 @@
echo "Executing compile.sh from $(pwd)"
# TODO: Find relative path to Blockly root. For now, assume it is pwd.
# Find the Closure Compiler.
if [ -f "$(npm root)/google-closure-compiler/compiler.jar" ]; then
COMPILER="$(npm root)/google-closure-compiler/compiler.jar"
elif [ -f *compiler*.jar ]; then
COMPILER="*compiler*.jar"
elif [ -f tests/compile/*compiler*.jar ]; then
COMPILER="tests/compile/*compiler*.jar"
# TODO: Check whether multiple files were found.
else
echo "ERROR: Closure Compiler not found."
@@ -12,21 +16,25 @@ else
fi
echo Using $COMPILER as the compiler.
rm main_compressed.js 2> /dev/null
rm tests/compile/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' \
COMPILATION_COMMAND="java -jar $COMPILER --js='tests/compile/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 \
--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
--js_output_file tests/compile/main_compressed.js"
echo $COMPILATION_COMMAND
$COMPILATION_COMMAND
EXIT_CODE=$?
echo "Compiler exit code: $EXIT_CODE"
if [ "$EXIT_CODE" -eq 0 ] && [ -s tests/compile/main_compressed.js ]; then
echo Compilation OK.
else
echo Compilation FAIL.

View File

@@ -8,6 +8,12 @@ goog.require('Blockly.Constants.Logic');
goog.require('Blockly.Constants.Loops');
goog.require('Blockly.Constants.Math');
goog.require('Blockly.Constants.Text');
// TODO: Add the following. Expecting additional warnings.
//goog.require('Blockly.Constants.Lists');
//goog.require('Blockly.Constants.Colour');
//goog.require('Blockly.Constants.Variables');
//goog.require('Blockly.Constants.VariablesDynamic');
//goog.require('Blockly.Constants.procedures');
Main.init = function() {
Blockly.inject('blocklyDiv', {