Strip licences from compiled code. (#1318)

This commit is contained in:
Neil Fraser 2017-09-14 17:23:50 -07:00 committed by Paul Kaplan
parent 9ce71d1099
commit 75f52db086
2 changed files with 25 additions and 0 deletions

View file

@ -337,6 +337,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"]

View file

@ -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');