From ddd4700e1dc1b1609df349442942d17a545da24f Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 14 Sep 2017 17:23:50 -0700 Subject: [PATCH] Strip licences from compiled code. (#1318) --- build.py | 25 +++++++++++++++++++++++++ core/block_svg.js | 1 + 2 files changed, 26 insertions(+) diff --git a/build.py b/build.py index 58b65cd35..47234d347 100755 --- a/build.py +++ b/build.py @@ -446,6 +446,30 @@ class Gen_compressed(threading.Thread): code = HEADER + "\n" + json_data["compiledCode"] code = code.replace(remove, "") + + # Trim down Google's (and only Google's) Apache licences. + # The Closure Compiler preserves these. + LICENSE = re.compile("""/\\* + + [\w ]+ + + Copyright \\d+ Google Inc. + https://developers.google.com/blockly/ + + Licensed under the Apache License, Version 2.0 \(the "License"\); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +\\*/""") + code = re.sub(LICENSE, "", code) + stats = json_data["statistics"] original_b = stats["originalSize"] compressed_b = stats["compressedSize"] @@ -590,6 +614,7 @@ developers.google.com/blockly/guides/modify/web/closure""") all_search_paths = calcdeps.ExpandDirectories( ["accessible", "core", "blocks", os.path.join("demos", "fixed-advanced"), os.path.join("msg", "js"), os.path.join(os.path.pardir, "closure-library")]) all_search_paths.sort() # Deterministic build. + print("Compressing " + str(len(all_search_paths)) + " files...") Gen_compressed(all_search_paths, args).start() else: diff --git a/core/block_svg.js b/core/block_svg.js index b781d61e6..3f606afd2 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -30,6 +30,7 @@ goog.require('Blockly.Block'); goog.require('Blockly.ContextMenu'); goog.require('Blockly.Grid'); goog.require('Blockly.RenderedConnection'); +goog.require('Blockly.Tooltip'); goog.require('Blockly.Touch'); goog.require('Blockly.utils'); goog.require('goog.Timer');