Add missing utils.global (#3286)

Compile is breaking due to the JS environment sweep.
This commit is contained in:
Neil Fraser
2019-10-18 02:00:31 -07:00
committed by GitHub
parent 19018a5e8e
commit 8e5797e2bc
2 changed files with 4 additions and 2 deletions

View File

@@ -266,6 +266,7 @@ goog.provide('Blockly.Mutator');
# with the compiler.
params.append(("js_code", """
goog.provide('Blockly.Generator');
goog.provide('Blockly.utils.global');
goog.provide('Blockly.utils.string');
"""))
filenames = glob.glob(
@@ -280,7 +281,7 @@ goog.provide('Blockly.utils.string');
# Remove Blockly.Generator and Blockly.utils.string to be compatible
# with Blockly.
remove = r"var Blockly=\{[^;]*\};\s*Blockly.utils.string={};\n?"
remove = r"var Blockly=\{[^;]*\};\s*Blockly.utils.global={};\s*Blockly.utils.string={};\n?"
self.do_compile(params, target_filename, filenames, remove)
def do_compile(self, params, target_filename, filenames, remove):

View File

@@ -173,6 +173,7 @@ goog.provide('Blockly.Mutator');`;
function buildGenerator(language, namespace) {
var provides = `
goog.provide('Blockly.Generator');
goog.provide('Blockly.utils.global');
goog.provide('Blockly.utils.string');`;
return gulp.src([`generators/${language}.js`, `generators/${language}/*.js`], {base: './'})
.pipe(stripApacheLicense())
@@ -185,7 +186,7 @@ goog.provide('Blockly.utils.string');`;
}, argv.verbose))
.pipe(gulp.replace('\'use strict\';', '\'use strict\';\n\n\n'))
// Remove Blockly.Generator and Blockly.utils.string to be compatible with Blockly.
.pipe(gulp.replace(/var Blockly=\{[^;]*\};\s*Blockly.utils.string={};\n?/, ''))
.pipe(gulp.replace(/var Blockly=\{[^;]*\};\s*Blockly.utils.global={};\s*Blockly.utils.string={};\n?/, ''))
.pipe(prependHeader())
.pipe(gulp.dest('./'));
};