Strip MIT’s licence out of compiled code.

Matches existing stripping of Google’s licence.  Done with MIT’s permission.  Resolves issue 2412.
This commit is contained in:
Neil Fraser
2019-04-29 15:00:30 -07:00
committed by Neil Fraser
parent 67ee390ef9
commit 8d4a73e33d
2 changed files with 6 additions and 23 deletions

View File

@@ -1581,25 +1581,7 @@ Blockly.BlockSvg.prototype.renderDummyInput_=function(a,b,c,d,e){var f=a.steps;a
Blockly.BlockSvg.prototype.renderStatementInput_=function(a,b,c,d,e,f){var g=a.steps;a=a.highlightSteps;var h=b[0];0==f&&(g.push("v",Blockly.BlockSvg.SEP_SPACE_Y),this.RTL&&a.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c.y+=Blockly.BlockSvg.SEP_SPACE_Y);var k=c.x,l=c.y;if(h.align!=Blockly.ALIGN_LEFT){var n=e.statementEdge-h.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X;h.align==Blockly.ALIGN_RIGHT?k+=n:h.align==Blockly.ALIGN_CENTRE&&(k+=n/2)}this.renderFields_(h.fieldRow,k,l);c.x=e.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH;
g.push("H",c.x);g.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER);g.push("v",b.height-2*Blockly.BlockSvg.CORNER_RADIUS);g.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER);g.push("H",e.rightEdge);this.RTL?(a.push("M",c.x-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c.y+Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),a.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),a.push("v",b.height-2*Blockly.BlockSvg.CORNER_RADIUS),a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL)):
(a.push("M",c.x-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c.y+b.height-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR));a.push("H",e.rightEdge-.5);d.x=this.RTL?-c.x:c.x+1;h.connection.setOffsetInBlock(d.x,c.y+1);h.connection.isConnected()&&(this.width=Math.max(this.width,e.statementEdge+h.connection.targetBlock().getHeightWidth().width));if(f==e.length-1||e[f+1].type==Blockly.NEXT_STATEMENT)g.push("v",Blockly.BlockSvg.SEP_SPACE_Y),
this.RTL&&a.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c.y+=Blockly.BlockSvg.SEP_SPACE_Y};Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?Blockly.utils.addClass(this.svgGroup_,"blocklyReplaceable"):Blockly.utils.removeClass(this.svgGroup_,"blocklyReplaceable")};/*
Visual Blocks Editor
Copyright 2016 Massachusetts Institute of Technology
All rights reserved.
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.
*/
this.RTL&&a.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c.y+=Blockly.BlockSvg.SEP_SPACE_Y};Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?Blockly.utils.addClass(this.svgGroup_,"blocklyReplaceable"):Blockly.utils.removeClass(this.svgGroup_,"blocklyReplaceable")};
Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.DIV_=null;Blockly.DropDownDiv.boundsElement_=null;Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.positionToField_=null;Blockly.DropDownDiv.ARROW_SIZE=16;Blockly.DropDownDiv.BORDER_SIZE=1;Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING=12;Blockly.DropDownDiv.PADDING_Y=16;Blockly.DropDownDiv.ANIMATION_TIME=.25;Blockly.DropDownDiv.animateOutTimer_=null;Blockly.DropDownDiv.onHide_=0;
Blockly.DropDownDiv.createDom=function(){if(!Blockly.DropDownDiv.DIV_){var a=document.createElement("div");a.className="blocklyDropDownDiv";document.body.appendChild(a);Blockly.DropDownDiv.DIV_=a;var b=document.createElement("div");b.className="blocklyDropDownContent";a.appendChild(b);Blockly.DropDownDiv.content_=b;b=document.createElement("div");b.className="blocklyDropDownArrow";a.appendChild(b);Blockly.DropDownDiv.arrow_=b;Blockly.DropDownDiv.DIV_.style.transition="transform "+Blockly.DropDownDiv.ANIMATION_TIME+
"s, opacity "+Blockly.DropDownDiv.ANIMATION_TIME+"s"}};Blockly.DropDownDiv.setBoundsElement=function(a){Blockly.DropDownDiv.boundsElement_=a};Blockly.DropDownDiv.getContentDiv=function(){return Blockly.DropDownDiv.content_};Blockly.DropDownDiv.clearContent=function(){Blockly.DropDownDiv.content_.innerHTML="";Blockly.DropDownDiv.content_.style.width=""};Blockly.DropDownDiv.setColour=function(a,b){Blockly.DropDownDiv.DIV_.style.backgroundColor=a;Blockly.DropDownDiv.DIV_.style.borderColor=b};

View File

@@ -391,14 +391,15 @@ 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.
# The Closure Compiler preserves licences.
# Trim out Google's and MIT's (and nobody else's) Apache licences.
# MIT's permission to do this is logged in Blockly issue 2412.
LICENSE = re.compile("""/\\*
[\w ]+
Copyright \\d+ Google Inc.
https://developers.google.com/blockly/
Copyright \\d+ (Google Inc.|Massachusetts Institute of Technology)
(https://developers.google.com/blockly/|All rights reserved.)
Licensed under the Apache License, Version 2.0 \(the "License"\);
you may not use this file except in compliance with the License.