From e8d95c9137dd09ff1c55725fb984ea3fa4e8a912 Mon Sep 17 00:00:00 2001
From: Rachel Fenichel
Date: Tue, 13 Apr 2021 14:28:54 -0700
Subject: [PATCH] Remove compile.sh
---
tests/compile/compile.sh | 114 ---------------------------------------
tests/compile/index.html | 2 +-
tests/run_all_tests.sh | 2 +-
3 files changed, 2 insertions(+), 116 deletions(-)
delete mode 100755 tests/compile/compile.sh
diff --git a/tests/compile/compile.sh b/tests/compile/compile.sh
deleted file mode 100755
index c916eba5a..000000000
--- a/tests/compile/compile.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/bash
-#
-# Deprecation warning: (July 2020)
-# This advanced compilation test script has been deprecated in favour of
-# npm run test:compile:advanced
-#
-# The script will be removed from Blockly core in Q4 of 2020.
-#
-echo "Deprecation warning: (July 2020)"
-echo "This advanced compilation test script has been deprecated in favour of"
-echo " npm run test:compile:advanced"
-echo ""
-echo "The script will be removed from Blockly core in Q4 of 2020."
-echo ""
-
-echo "Executing compile.sh from $(pwd)"
-
-# Find the Blockly project root if pwd is the root
-# or if pwd is the directory containing this script.
-if [ -f ./main.js ] && [ -f ./compile.sh ]; then
- BLOCKLY_ROOT="../.."
-elif [ -f tests/compile/compile.sh ]; then
- BLOCKLY_ROOT="."
-else
- echo "ERROR: Cannot determine BLOCKLY_ROOT" 1>&2;
- exit 1
-fi
-
-# Test for npm and node_modules directory.
-if command -v npm >/dev/null 2>&1; then
- NODE_MODULES=$(npm root)
- # npm root will invent a location based on pwd if it can't find
- # one, such as when the project has not been `npm install`ed.
- # Clear the variable if the directory doesn't already exist.
- [[ ! -d $NODE_MODULES ]] && NODE_MODULES=""
-fi
-
-# Find the Closure Compiler.
-if [ -n $NODE_MODULES ] && \
- [ -s $NODE_MODULES/google-closure-compiler-java/compiler.jar ]; then
- COMPILER=$NODE_MODULES/google-closure-compiler-java/compiler.jar
- echo "Found npm google-closure-compiler:"
- echo " $COMPILER"
- npm list google-closure-compiler | grep google-closure-compiler
-else
- COMPILER_JARS=$(find $BLOCKLY_ROOT/tests/compile/ -maxdepth 1 -name "*compiler*.jar")
- if [ -n "$COMPILER_JARS" ]; then
- if [ $(echo "$COMPILER_JARS" | wc -l) -ne 1 ]; then
- echo "ERROR: Found too many Closure *compiler*.jar files:" 1>&2;
- echo "$COMPILER_JARS" 1>&2;
- exit 1
- fi
- COMPILER=$COMPILER_JARS
- echo "Found local Closure compiler .jar:"
- echo " $COMPILER"
- else
- echo "ERROR: Closure Compiler not found." 1>&2;
- echo "Either npm install google-closure-compiler" 1>&2;
- echo "Or download from this URL, and place jar file in current directory." 1>&2;
- echo "https://dl.google.com/closure-compiler/compiler-latest.zip" 1>&2;
- exit 1
- fi
-fi
-
-if [ -f "$BLOCKLY_ROOT/tests/compile/main_compressed.js" ]; then
- echo "Removing previous output."
- rm "$BLOCKLY_ROOT/tests/compile/main_compressed.js"
-fi
-
-tempPath="$BLOCKLY_ROOT/temp_core"
-corePath="$BLOCKLY_ROOT/core/*"
-mkdir $tempPath
-cp $corePath $tempPath
-# Copy over all files in core and any subdirectories to the temp_core directory.
-for dir in "$corePath/" ; do
- # For all files in the directory and any subdirectories rename them to
- # include the subirectory name and copy them to temporary directory.
- # Ex: subdir/file.js -> temp_core/subdir_file.js
- for file in $(find $dir -name \*.js); do
- # Replace all / with _ and remove core
- newName="${file//\//_}"
- newName="${newName//._core_/}"
- newFilePath="$tempPath/$newName"
- cp $file $newFilePath
- done
-done
-
-echo "Compiling Blockly..."
-COMPILATION_COMMAND="java -jar $COMPILER --js='$BLOCKLY_ROOT/tests/compile/main.js' \
- --js='$tempPath/**.js' \
- --js='$BLOCKLY_ROOT/tests/blocks/**.js' \
- --js='$BLOCKLY_ROOT/blocks/**.js' \
- --js='$BLOCKLY_ROOT/generators/**.js' \
- --generate_exports \
- --externs $BLOCKLY_ROOT/externs/goog-externs.js \
- --externs $BLOCKLY_ROOT/externs/svg-externs.js \
- --compilation_level ADVANCED_OPTIMIZATIONS \
- --language_in ECMASCRIPT5_STRICT \
- --language_out ECMASCRIPT5_STRICT \
- --dependency_mode=PRUNE --entry_point=Main \
- --js_output_file $BLOCKLY_ROOT/tests/compile/main_compressed.js"
-echo "$COMPILATION_COMMAND"
-$COMPILATION_COMMAND
-EXIT_CODE=$?
-echo "Compiler exit code: $EXIT_CODE"
-if [ "$EXIT_CODE" -eq 0 ] && [ -s "$BLOCKLY_ROOT/tests/compile/main_compressed.js" ]; then
- echo "Compilation SUCCESS."
-else
- echo "Compilation FAIL."
- exit 1
-fi
-
-# Cleanup temp_core directory
-rm -r $tempPath
diff --git a/tests/compile/index.html b/tests/compile/index.html
index 1ec1ce85a..8ffadca88 100644
--- a/tests/compile/index.html
+++ b/tests/compile/index.html
@@ -24,7 +24,7 @@
To run this test manually, download
closure-compiler-vxxxxxxxx.jar,
- place it in this directory, then run compile.sh from the command line.
+ place it in this directory, then run `npm run test:compile:advanced` from the command line.
Measure the size of main_compressed.js (295kb as of October 2017), then reload
this page and see if Blockly works.
diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh
index 2ab36c251..5107a6ebf 100755
--- a/tests/run_all_tests.sh
+++ b/tests/run_all_tests.sh
@@ -73,7 +73,7 @@ run_test_command "generators" "tests/scripts/run_generators.sh"
run_test_command "node" "./node_modules/.bin/mocha tests/node --config tests/node/.mocharc.js"
# # Attempt advanced compilation of a Blockly app.
-# run_test_command "advanced_compile" "tests/compile/compile.sh"
+# run_test_command "advanced_compile" "npm run test:compile:advanced"
# End of tests.