From 493470807d3f015dab9cddc914005a403054869c Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Fri, 16 Aug 2019 11:03:40 -0700 Subject: [PATCH] Remove check for renderer name from build and compile scripts (#2842) --- build.py | 31 ++++-------------------- tests/compile/compile.sh | 52 ++++++++++------------------------------ 2 files changed, 17 insertions(+), 66 deletions(-) diff --git a/build.py b/build.py index 0647a0f69..c3fdae93e 100755 --- a/build.py +++ b/build.py @@ -491,26 +491,10 @@ class Arguments: self.core = False self.generators = False self.langfiles = False - self.render_name = "block_rendering_rewrite" - -# Add all directories to the path list except for any extra renderers. -def find_path(args, directories): - new_list = [] - render_path = 'core/renderers/' + args.render_name - core_search_paths = calcdeps.ExpandDirectories(directories) - for path in core_search_paths: - # If it is the desired renderer - if path.find('core/renderers') > -1 and path.find(render_path) > -1: - new_list.append(path) - # If it is not a renderer - elif (path.find('core/renderers') == -1): - new_list.append(path) - return sorted(new_list) # Setup the argument parser. def setup_parser(): - parser = argparse.ArgumentParser(description="Decide which files to build with what renderer.") - parser.add_argument('-renderer', dest="render_name", default="block_rendering_rewrite", help="The name of the desired renderer. The name should corresspond to the name of a folder in core/renderers") + parser = argparse.ArgumentParser(description="Decide which files to build.") parser.add_argument('-core', action="store_true", default=False, help="Build core") parser.add_argument('-generators', action="store_true", default=False, help="Build the generators") parser.add_argument('-langfiles', action="store_true", default=False, help="Build all the language files") @@ -530,17 +514,8 @@ def get_args(): args.langfiles = 'langfiles' in sys.argv if 'accessible' in sys.argv: print("The Blockly accessibility demo has moved to https://github.com/google/blockly-experimental") - if '-renderer' in sys.argv: - print ("Please use the new arguments -core, -generators, -langfiles") - sys.exit() - verify_render_name(args.render_name) return args -# Verify that the passed in renderer name can be found in the renderers directory. -def verify_render_name(render_name): - if (not render_name in next(os.walk('core/renderers'))[1]): - print (render_name + " is not a valid renderer.") - if __name__ == "__main__": try: args = get_args() @@ -565,7 +540,9 @@ if __name__ == "__main__": developers.google.com/blockly/guides/modify/web/closure""") sys.exit(1) - full_search_paths = find_path(args, ["core", os.path.join(os.path.pardir, "closure-library")]) + full_search_paths = calcdeps.ExpandDirectories( + ["core", os.path.join(os.path.pardir, "closure-library")]) + full_search_paths = sorted(full_search_paths) # Deterministic build. # Uncompressed and compressed are run in parallel threads. # Uncompressed is limited by processor speed. diff --git a/tests/compile/compile.sh b/tests/compile/compile.sh index 03314a06b..ff461dec0 100755 --- a/tests/compile/compile.sh +++ b/tests/compile/compile.sh @@ -73,54 +73,28 @@ if [ -f "$BLOCKLY_ROOT/tests/compile/main_compressed.js" ]; then rm "$BLOCKLY_ROOT/tests/compile/main_compressed.js" fi -# If an argument is passed and is a valid renderer name use it. Otherwise use -# the default renderer name. -if [[ $# == 1 ]]; then - if [ $(find "$BLOCKLY_ROOT/core" -name "$1") ]; then - renderName=$1 - else - echo "A renderer with the name $1 does not exist" - echo "Please provide a valid renderer name" - exit 1 - fi -else - renderName="block_rendering_rewrite" -fi - tempPath="$BLOCKLY_ROOT/temp_core" corePath="$BLOCKLY_ROOT/core/*" mkdir $tempPath cp $corePath $tempPath -# Copy over all files except for the extra renderers to the temp_core directory. -for dir in ./core/*/ ; do - # If we are in the renderers directory - if [[ $dir == *"/renderers/"* ]]; then - renderers="$dir*" - # Go through all folders in the renderers direcotry - for renderer in $renderers ; do - if [[ $renderer == *"${renderName}" ]]; then - # Copy over all files from the desired render folder - find $renderer -type f -exec cp {} $tempPath \; - fi - done - else - # 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 - fi +# 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='$BLOCKLY_ROOT/$tempPath/**.js' \ + --js='$tempPath/**.js' \ --js='$BLOCKLY_ROOT/blocks/**.js' \ --js='$BLOCKLY_ROOT/generators/**.js' \ --js='$BLOCKLY_ROOT/msg/js/**.js' \