Skip to content

Commit

Permalink
Remove closure base file dependency (#2976)
Browse files Browse the repository at this point in the history
* Trim down closure's base dependency even further by removing the dependency on closure's base file.
  • Loading branch information
samelhusseini authored Sep 12, 2019
1 parent 09d2a16 commit 8ab51c8
Show file tree
Hide file tree
Showing 162 changed files with 706 additions and 959 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ addons:
env:
- TRAVIS_CI=true
before_script:
# Symlink closure library used by test/jsunit
- ln -s $(npm root)/google-closure-library ../closure-library
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi
Expand Down
487 changes: 218 additions & 269 deletions blockly_compressed.js

Large diffs are not rendered by default.

114 changes: 58 additions & 56 deletions blockly_uncompressed.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def gen_core(self):
# Define the parameters for the POST request.
params = [
("compilation_level", "SIMPLE_OPTIMIZATIONS"),
("use_closure_library", "true"),
("use_closure_library", "false"),
("output_format", "json"),
("output_info", "compiled_code"),
("output_info", "warnings"),
Expand Down
5 changes: 3 additions & 2 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ goog.require('Blockly.Input');
goog.require('Blockly.Mutator');
goog.require('Blockly.utils');
goog.require('Blockly.utils.Coordinate');
goog.require('Blockly.utils.object');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils.string');
goog.require('Blockly.Warning');
Expand Down Expand Up @@ -171,7 +172,7 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
if (!prototype || typeof prototype != 'object') {
throw TypeError('Unknown block type: ' + prototypeName);
}
goog.mixin(this, prototype);
Blockly.utils.object.mixin(this, prototype);
}

workspace.addTopBlock(this);
Expand Down Expand Up @@ -1557,7 +1558,7 @@ Blockly.Block.prototype.mixin = function(mixinObj, opt_disableCheck) {
JSON.stringify(overwrites));
}
}
goog.mixin(this, mixinObj);
Blockly.utils.object.mixin(this, mixinObj);
};

/**
Expand Down
12 changes: 7 additions & 5 deletions core/block_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ goog.provide('Blockly.Events.Move'); // Deprecated.
goog.require('Blockly.Events');
goog.require('Blockly.Events.Abstract');
goog.require('Blockly.utils.Coordinate');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.xml');


Expand All @@ -56,7 +57,8 @@ Blockly.Events.BlockBase = function(block) {
this.blockId = block.id;
this.workspaceId = block.workspace.id;
};
goog.inherits(Blockly.Events.BlockBase, Blockly.Events.Abstract);
Blockly.utils.object.inherits(Blockly.Events.BlockBase,
Blockly.Events.Abstract);

/**
* Encode the event as JSON.
Expand Down Expand Up @@ -97,7 +99,7 @@ Blockly.Events.Change = function(block, element, name, oldValue, newValue) {
this.oldValue = oldValue;
this.newValue = newValue;
};
goog.inherits(Blockly.Events.Change, Blockly.Events.BlockBase);
Blockly.utils.object.inherits(Blockly.Events.Change, Blockly.Events.BlockBase);

/**
* Class for a block change event.
Expand Down Expand Up @@ -224,7 +226,7 @@ Blockly.Events.Create = function(block) {
}
this.ids = Blockly.Events.getDescendantIds_(block);
};
goog.inherits(Blockly.Events.Create, Blockly.Events.BlockBase);
Blockly.utils.object.inherits(Blockly.Events.Create, Blockly.Events.BlockBase);

/**
* Class for a block creation event.
Expand Down Expand Up @@ -306,7 +308,7 @@ Blockly.Events.Delete = function(block) {
}
this.ids = Blockly.Events.getDescendantIds_(block);
};
goog.inherits(Blockly.Events.Delete, Blockly.Events.BlockBase);
Blockly.utils.object.inherits(Blockly.Events.Delete, Blockly.Events.BlockBase);

/**
* Class for a block deletion event.
Expand Down Expand Up @@ -380,7 +382,7 @@ Blockly.Events.Move = function(block) {
this.oldInputName = location.inputName;
this.oldCoordinate = location.coordinate;
};
goog.inherits(Blockly.Events.Move, Blockly.Events.BlockBase);
Blockly.utils.object.inherits(Blockly.Events.Move, Blockly.Events.BlockBase);

/**
* Class for a block move event. Created before the move.
Expand Down
3 changes: 2 additions & 1 deletion core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ goog.require('Blockly.Touch');
goog.require('Blockly.utils');
goog.require('Blockly.utils.Coordinate');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Rect');


Expand Down Expand Up @@ -107,7 +108,7 @@ Blockly.BlockSvg = function(workspace, prototypeName, opt_id) {
this.svgGroup_.dataset.id = this.id;
}
};
goog.inherits(Blockly.BlockSvg, Blockly.Block);
Blockly.utils.object.inherits(Blockly.BlockSvg, Blockly.Block);

/**
* Height of this block, not including any statement blocks above or below.
Expand Down
8 changes: 0 additions & 8 deletions core/blockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,3 @@ Blockly.updateBlockStyles_ = function(blocks) {
Blockly.getTheme = function() {
return Blockly.theme_;
};

// Export symbols that would otherwise be renamed by Closure compiler.
if (!Blockly.utils.global['Blockly']) {
Blockly.utils.global['Blockly'] = {};
}
Blockly.utils.global['Blockly']['getMainWorkspace'] = Blockly.getMainWorkspace;
Blockly.utils.global['Blockly']['addChangeListener'] =
Blockly.addChangeListener;
3 changes: 2 additions & 1 deletion core/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ goog.require('Blockly.Events.BlockChange');
goog.require('Blockly.Events.Ui');
goog.require('Blockly.Icon');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.userAgent');


Expand All @@ -45,7 +46,7 @@ Blockly.Comment = function(block) {
Blockly.Comment.superClass_.constructor.call(this, block);
this.createIcon();
};
goog.inherits(Blockly.Comment, Blockly.Icon);
Blockly.utils.object.inherits(Blockly.Comment, Blockly.Icon);

/**
* Comment text (if bubble is not visible).
Expand Down
5 changes: 3 additions & 2 deletions core/components/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
goog.provide('Blockly.Menu');

goog.require('Blockly.Component');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.aria');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');


/**
Expand All @@ -47,7 +48,7 @@ Blockly.Menu = function() {
*/
this.highlightedIndex_ = -1;
};
goog.inherits(Blockly.Menu, Blockly.Component);
Blockly.utils.object.inherits(Blockly.Menu, Blockly.Component);


/**
Expand Down
5 changes: 3 additions & 2 deletions core/components/menu/menuitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
goog.provide('Blockly.MenuItem');

goog.require('Blockly.Component');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.aria');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');


/**
Expand Down Expand Up @@ -64,7 +65,7 @@ Blockly.MenuItem = function(content, opt_value) {
*/
this.nextSibling_;
};
goog.inherits(Blockly.MenuItem, Blockly.Component);
Blockly.utils.object.inherits(Blockly.MenuItem, Blockly.Component);


/**
Expand Down
3 changes: 2 additions & 1 deletion core/components/tree/basenode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ goog.provide('Blockly.tree.BaseNode');

goog.require('Blockly.Component');
goog.require('Blockly.utils.aria');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.KeyCodes');
goog.require('Blockly.utils.style');

Expand Down Expand Up @@ -112,7 +113,7 @@ Blockly.tree.BaseNode = function(content, config) {
*/
this.depth_ = -1;
};
goog.inherits(Blockly.tree.BaseNode, Blockly.Component);
Blockly.utils.object.inherits(Blockly.tree.BaseNode, Blockly.Component);


/**
Expand Down
3 changes: 2 additions & 1 deletion core/components/tree/treecontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ goog.provide('Blockly.tree.TreeControl');
goog.require('Blockly.tree.TreeNode');
goog.require('Blockly.tree.BaseNode');
goog.require('Blockly.utils.aria');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.style');


Expand Down Expand Up @@ -58,7 +59,7 @@ Blockly.tree.TreeControl = function(toolbox, config) {
*/
this.selectedItem_ = this;
};
goog.inherits(Blockly.tree.TreeControl, Blockly.tree.BaseNode);
Blockly.utils.object.inherits(Blockly.tree.TreeControl, Blockly.tree.BaseNode);

/**
* Returns the tree.
Expand Down
3 changes: 2 additions & 1 deletion core/components/tree/treenode.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
goog.provide('Blockly.tree.TreeNode');

goog.require('Blockly.tree.BaseNode');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.KeyCodes');


Expand All @@ -46,7 +47,7 @@ Blockly.tree.TreeNode = function(toolbox, content, config) {
this.toolbox_ = toolbox;
Blockly.tree.BaseNode.call(this, content, config);
};
goog.inherits(Blockly.tree.TreeNode, Blockly.tree.BaseNode);
Blockly.utils.object.inherits(Blockly.tree.TreeNode, Blockly.tree.BaseNode);

/**
* Returns the tree.
Expand Down
3 changes: 2 additions & 1 deletion core/field_angle.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ goog.require('Blockly.fieldRegistry');
goog.require('Blockly.FieldTextInput');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.math');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.userAgent');


Expand All @@ -52,7 +53,7 @@ Blockly.FieldAngle = function(opt_value, opt_validator) {
Blockly.FieldAngle.superClass_.constructor.call(
this, opt_value, opt_validator);
};
goog.inherits(Blockly.FieldAngle, Blockly.FieldTextInput);
Blockly.utils.object.inherits(Blockly.FieldAngle, Blockly.FieldTextInput);

/**
* Construct a FieldAngle from a JSON arg object.
Expand Down
3 changes: 2 additions & 1 deletion core/field_checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ goog.require('Blockly.Events.BlockChange');
goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Size');


Expand Down Expand Up @@ -68,7 +69,7 @@ Blockly.FieldCheckbox = function(opt_value, opt_validator, opt_config) {

this.configure_(opt_config);
};
goog.inherits(Blockly.FieldCheckbox, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldCheckbox, Blockly.Field);

/**
* Construct a FieldCheckbox from a JSON arg object.
Expand Down
5 changes: 3 additions & 2 deletions core/field_colour.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ goog.require('Blockly.Events.BlockChange');
goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils.aria');
goog.require('Blockly.utils.colour');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.IdGenerator');
goog.require('Blockly.utils.colour');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Size');


Expand All @@ -61,7 +62,7 @@ Blockly.FieldColour = function(opt_value, opt_validator, opt_config) {

this.configure_(opt_config);
};
goog.inherits(Blockly.FieldColour, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldColour, Blockly.Field);

/**
* Construct a FieldColour from a JSON arg object.
Expand Down
37 changes: 35 additions & 2 deletions core/field_date.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ goog.require('Blockly.Events');
goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.string');

goog.require('goog.date');
Expand All @@ -55,9 +56,10 @@ Blockly.FieldDate = function(opt_value, opt_validator) {
if (!opt_value) {
opt_value = new goog.date.Date().toIsoString(true);
}
Blockly.FieldDate.superClass_.constructor.call(this, opt_value, opt_validator);
Blockly.FieldDate.superClass_.constructor.call(this,
opt_value, opt_validator);
};
goog.inherits(Blockly.FieldDate, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldDate, Blockly.Field);

/**
* Construct a FieldDate from a JSON arg object.
Expand Down Expand Up @@ -325,3 +327,34 @@ Blockly.FieldDate.CSS = [
];

Blockly.fieldRegistry.register('field_date', Blockly.FieldDate);


/**
* Back up original getMsg function.
* @type {!Function}
*/
goog.getMsgOrig = goog.getMsg;

/**
* Gets a localized message.
* Overrides the default Closure function to check for a Blockly.Msg first.
* Used infrequently, only known case is TODAY button in date picker.
* @param {string} str Translatable string, places holders in the form {$foo}.
* @param {Object.<string, string>=} opt_values Maps place holder name to value.
* @return {string} Message with placeholders filled.
* @suppress {duplicate}
*/
goog.getMsg = function(str, opt_values) {
var key = goog.getMsg.blocklyMsgMap[str];
if (key) {
str = Blockly.Msg[key];
}
return goog.getMsgOrig(str, opt_values);
};

/**
* Mapping of Closure messages to Blockly.Msg names.
*/
goog.getMsg.blocklyMsgMap = {
'Today': 'TODAY'
};
3 changes: 2 additions & 1 deletion core/field_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ goog.require('Blockly.Menu');
goog.require('Blockly.MenuItem');
goog.require('Blockly.utils');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Size');
goog.require('Blockly.utils.string');
goog.require('Blockly.utils.uiMenu');
Expand Down Expand Up @@ -82,7 +83,7 @@ Blockly.FieldDropdown = function(menuGenerator, opt_validator) {
*/
this.selectedMenuItem_ = null;
};
goog.inherits(Blockly.FieldDropdown, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldDropdown, Blockly.Field);

/**
* Dropdown image properties.
Expand Down
3 changes: 2 additions & 1 deletion core/field_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Size');


Expand Down Expand Up @@ -90,7 +91,7 @@ Blockly.FieldImage = function(src, width, height,
this.clickHandler_ = opt_onClick;
}
};
goog.inherits(Blockly.FieldImage, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldImage, Blockly.Field);

/**
* Construct a FieldImage from a JSON arg object,
Expand Down
3 changes: 2 additions & 1 deletion core/field_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
goog.require('Blockly.utils.Size');


Expand All @@ -51,7 +52,7 @@ Blockly.FieldLabel = function(opt_value, opt_class) {
}
this.setValue(opt_value);
};
goog.inherits(Blockly.FieldLabel, Blockly.Field);
Blockly.utils.object.inherits(Blockly.FieldLabel, Blockly.Field);

/**
* Construct a FieldLabel from a JSON arg object,
Expand Down
Loading

0 comments on commit 8ab51c8

Please sign in to comment.