Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix the compiler test, and check if it worked. #6638

Merged
merged 10 commits into from
Nov 25, 2022
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/tests/compile/*
/tests/jsunit/*
/tests/generators/*
/tests/mocha/run_mocha_tests_in_browser.js
/tests/mocha/webdriver.js
/tests/screenshot/*
/tests/test_runner.js
/tests/workspace_svg/*
Expand Down
22 changes: 11 additions & 11 deletions scripts/gulpfiles/appengine_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
* @fileoverview Gulp script to deploy Blockly demos on appengine.
*/

var gulp = require('gulp');
const gulp = require('gulp');

var fs = require('fs');
var rimraf = require('rimraf');
var path = require('path');
var execSync = require('child_process').execSync;
const fs = require('fs');
const rimraf = require('rimraf');
const path = require('path');
const execSync = require('child_process').execSync;
const buildTasks = require('./build_tasks.js');
const packageTasks = require('./package_tasks.js');

var packageJson = require('../../package.json');
const packageJson = require('../../package.json');
const demoTmpDir = '../_deploy';
const demoStaticTmpDir = '../_deploy/static';

Expand Down Expand Up @@ -121,10 +121,10 @@ function deployAndClean(done) {
* Constructs a beta demo version name based on the current date.
*/
function getDemosBetaVersion() {
var date = new Date();
var mm = date.getMonth() + 1; // Month, 0-11
var dd = date.getDate(); // Day of the month, 1-31
var yyyy = date.getFullYear();
const date = new Date();
const mm = date.getMonth() + 1; // Month, 0-11
const dd = date.getDate(); // Day of the month, 1-31
const yyyy = date.getFullYear();
return `${yyyy}${mm < 10 ? '0' + mm : mm}${dd}-beta`;
}

Expand All @@ -140,7 +140,7 @@ function deployBetaAndClean(done) {

/**
* Prepares demos.
*
*
* Prerequisites (invoked): clean, build
*/
const prepareDemos = gulp.series(
Expand Down
55 changes: 32 additions & 23 deletions scripts/gulpfiles/build_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
* @fileoverview Gulp script to build Blockly for Node & NPM.
*/

var gulp = require('gulp');
const gulp = require('gulp');
gulp.replace = require('gulp-replace');
gulp.rename = require('gulp-rename');
gulp.sourcemaps = require('gulp-sourcemaps');

var path = require('path');
var fs = require('fs');
const path = require('path');
const fs = require('fs');
const {exec, execSync} = require('child_process');
var through2 = require('through2');
const through2 = require('through2');

const clangFormat = require('clang-format');
const clangFormatter = require('gulp-clang-format');
var closureCompiler = require('google-closure-compiler').gulp();
var closureDeps = require('google-closure-deps');
var argv = require('yargs').argv;
var rimraf = require('rimraf');
const closureCompiler = require('google-closure-compiler').gulp();
const closureDeps = require('google-closure-deps');
const argv = require('yargs').argv;
const rimraf = require('rimraf');

var {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
var {getPackageJson} = require('./helper_tasks');
const {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config');
const {getPackageJson} = require('./helper_tasks');

var {posixPath} = require('../helpers');
const {posixPath} = require('../helpers');

////////////////////////////////////////////////////////////
// Build //
Expand Down Expand Up @@ -173,9 +173,9 @@ function stripApacheLicense() {
}

/**
* Closure compiler diagnostic groups we want to be treated as errors.
* Closure Compiler diagnostic groups we want to be treated as errors.
* These are effected when the --debug or --strict flags are passed.
* For a full list of closure compiler groups, consult the output of
* For a full list of Closure Compiler groups, consult the output of
* google-closure-compiler --help or look in the source here:
* https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/DiagnosticGroups.java#L117
*
Expand All @@ -185,7 +185,7 @@ function stripApacheLicense() {
* appearing on any list will default to setting provided by the
* compiler, which may vary depending on compilation level.
*/
var JSCOMP_ERROR = [
const JSCOMP_ERROR = [
// 'accessControls', // Deprecated; means same as visibility.
// 'checkPrototypalTypes', // override annotations are stripped by tsc.
'checkRegExp',
Expand Down Expand Up @@ -235,25 +235,25 @@ var JSCOMP_ERROR = [
];

/**
* Closure compiler diagnostic groups we want to be treated as warnings.
* Closure Compiler diagnostic groups we want to be treated as warnings.
* These are effected when the --debug or --strict flags are passed.
*
* For most (all?) diagnostic groups this is the default level, so
* it's generally sufficient to remove them from JSCOMP_ERROR.
*/
var JSCOMP_WARNING = [
const JSCOMP_WARNING = [
];

/**
* Closure compiler diagnostic groups we want to be ignored. These
* Closure Compiler diagnostic groups we want to be ignored. These
* suppressions are always effected by default.
*
* Make sure that anything added here is commented out of JSCOMP_ERROR
* above, as that takes precedence.)
*/
var JSCOMP_OFF = [
const JSCOMP_OFF = [
/* The removal of Closure type system types from our JSDoc
* annotations means that the closure compiler now generates certain
* annotations means that the Closure Compiler now generates certain
* diagnostics because it no longer has enough information to be
* sure that the input code is correct. The following diagnostic
* groups are turned off to suppress such errors.
Expand Down Expand Up @@ -315,6 +315,7 @@ function buildJavaScript(done) {
execSync(
`tsc -outDir "${TSC_OUTPUT_DIR}" -declarationDir "${TYPINGS_BUILD_DIR}"`,
{stdio: 'inherit'});
execSync(`node scripts/tsick.js "${TSC_OUTPUT_DIR}"`, {stdio: 'inherit'});
done();
}

Expand Down Expand Up @@ -452,7 +453,7 @@ function buildLangfiles(done) {
}

/**
* A helper method to return an closure compiler chunk wrapper that
* A helper method to return an Closure Compiler chunk wrapper that
* wraps the compiler output for the given chunk in a Universal Module
* Definition.
*/
Expand Down Expand Up @@ -612,7 +613,7 @@ function getChunkOptions() {
const pathSepRegExp = new RegExp(path.sep.replace(/\\/, '\\\\'), "g");

/**
* Helper method for calling the Closure compiler, establishing
* Helper method for calling the Closure Compiler, establishing
* default options (that can be overridden by the caller).
* @param {*} options Caller-supplied options that will override the
* defaultOptions.
Expand Down Expand Up @@ -663,7 +664,7 @@ function buildCompiled() {
const packageJson = getPackageJson(); // For version number.
const options = {
// The documentation for @define claims you can't use it on a
// non-global, but the closure compiler turns everything in to a
// non-global, but the Closure Compiler turns everything in to a
// global - you just have to know what the new name is! With
// declareLegacyNamespace this was very straightforward. Without
// it, we have to rely on implmentation details. See
Expand All @@ -688,11 +689,19 @@ function buildCompiled() {

/**
* This task builds Blockly core, blocks and generators together and uses
* closure compiler's ADVANCED_COMPILATION mode.
* Closure Compiler's ADVANCED_COMPILATION mode.
*
* Prerequisite: buildDeps.
*/
function buildAdvancedCompilationTest() {
// If main_compressed.js exists (from a previous run) delete it so that
// a later browser-based test won't check it should the compile fail.
try {
fs.unlinkSync('./tests/compile/main_compressed.js');
} catch (_e) {
// Probably it didn't exist.
}

const srcs = [
TSC_OUTPUT_DIR + '/closure/goog/base_minimal.js',
TSC_OUTPUT_DIR + '/closure/goog/goog.js',
Expand Down
2 changes: 1 addition & 1 deletion scripts/gulpfiles/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @fileoverview Common configuration for Gulp scripts.
*/

var path = require('path');
const path = require('path');

// Paths are all relative to the repository root. Do not include
// trailing slash.
Expand Down
26 changes: 13 additions & 13 deletions scripts/gulpfiles/git_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* @fileoverview Git-related gulp tasks for Blockly.
*/

var gulp = require('gulp');
var execSync = require('child_process').execSync;
const gulp = require('gulp');
const execSync = require('child_process').execSync;

var buildTasks = require('./build_tasks');
const buildTasks = require('./build_tasks');
const packageTasks = require('./package_tasks');

const upstream_url = "https://github.com/google/blockly.git";
Expand Down Expand Up @@ -41,18 +41,18 @@ function syncMaster() {

// Helper function: get a name for a rebuild branch. Format: rebuild_mm_dd_yyyy.
function getRebuildBranchName() {
var date = new Date();
var mm = date.getMonth() + 1; // Month, 0-11
var dd = date.getDate(); // Day of the month, 1-31
var yyyy = date.getFullYear();
const date = new Date();
const mm = date.getMonth() + 1; // Month, 0-11
const dd = date.getDate(); // Day of the month, 1-31
const yyyy = date.getFullYear();
return 'rebuild_' + mm + '_' + dd + '_' + yyyy;
};

// Helper function: get a name for a rebuild branch. Format: rebuild_yyyy_mm.
function getRCBranchName() {
var date = new Date();
var mm = date.getMonth() + 1; // Month, 0-11
var yyyy = date.getFullYear();
const date = new Date();
const mm = date.getMonth() + 1; // Month, 0-11
const yyyy = date.getFullYear();
return 'rc_' + yyyy + '_' + mm;
};

Expand All @@ -68,7 +68,7 @@ function checkoutBranch(branchName) {
const createRC = gulp.series(
syncDevelop(),
function(done) {
var branchName = getRCBranchName();
const branchName = getRCBranchName();
execSync('git checkout -b ' + branchName, { stdio: 'inherit' });
execSync('git push ' + upstream_url + ' ' + branchName,
{ stdio: 'inherit' });
Expand All @@ -78,7 +78,7 @@ const createRC = gulp.series(

// Create the rebuild branch.
function createRebuildBranch(done) {
var branchName = getRebuildBranchName();
const branchName = getRebuildBranchName();
console.log('make-rebuild-branch: creating branch ' + branchName);
execSync('git checkout -b ' + branchName, { stdio: 'inherit' });
done();
Expand All @@ -88,7 +88,7 @@ function createRebuildBranch(done) {
function pushRebuildBranch(done) {
console.log('push-rebuild-branch: committing rebuild');
execSync('git commit -am "Rebuild"', { stdio: 'inherit' });
var branchName = getRebuildBranchName();
const branchName = getRebuildBranchName();
execSync('git push origin ' + branchName, { stdio: 'inherit' });
console.log('Branch ' + branchName + ' pushed to GitHub.');
console.log('Next step: create a pull request against develop.');
Expand Down
16 changes: 8 additions & 8 deletions scripts/gulpfiles/package_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
* @fileoverview Gulp tasks to package Blockly for distribution on NPM.
*/

var gulp = require('gulp');
const gulp = require('gulp');
gulp.concat = require('gulp-concat');
gulp.replace = require('gulp-replace');
gulp.rename = require('gulp-rename');
gulp.insert = require('gulp-insert');
gulp.umd = require('gulp-umd');
gulp.replace = require('gulp-replace');

var path = require('path');
var fs = require('fs');
var rimraf = require('rimraf');
var build = require('./build_tasks');
var {getPackageJson} = require('./helper_tasks');
var {BUILD_DIR, RELEASE_DIR, TYPINGS_BUILD_DIR} = require('./config');
const path = require('path');
const fs = require('fs');
const rimraf = require('rimraf');
const build = require('./build_tasks');
const {getPackageJson} = require('./helper_tasks');
const {BUILD_DIR, RELEASE_DIR, TYPINGS_BUILD_DIR} = require('./config');

// Path to template files for gulp-umd.
const TEMPLATE_DIR = 'scripts/package/templates';
Expand Down Expand Up @@ -290,7 +290,7 @@ function packageLocales() {
* @example <script src="https://unpkg.com/blockly/blockly.min.js"></script>
*/
function packageUMDBundle() {
var srcs = [
const srcs = [
`${RELEASE_DIR}/blockly_compressed.js`,
`${RELEASE_DIR}/msg/en.js`,
`${RELEASE_DIR}/blocks_compressed.js`,
Expand Down
Loading