build: remove obsolete build related tools and helper scripts (#34058)

none of these files are needed any more as they were replaced by Bazel.

PR Close #34058
This commit is contained in:
Igor Minar 2019-11-22 16:45:46 -08:00 committed by Miško Hevery
parent df6d6e0b1d
commit d251f22ebd
11 changed files with 0 additions and 604 deletions

View File

@ -51,7 +51,6 @@ gulp.task('validate-commit-messages', loadTask('validate-commit-message'));
gulp.task('source-map-test', loadTask('source-map-test'));
gulp.task('tools:build', loadTask('tools-build'));
gulp.task('check-cycle', loadTask('check-cycle'));
gulp.task('serve', loadTask('serve', 'default'));
gulp.task('changelog', loadTask('changelog'));
gulp.task('changelog:zonejs', loadTask('changelog-zonejs'));
gulp.task('check-env', () => {/* this is a noop because the env test ran already above */});

View File

@ -1,11 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = function(gulp, plugins, config) {
return function(done) { del(config.path, done); };
};

View File

@ -1,20 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var fs = require('fs');
module.exports = function(licenseFile, outputFile) {
var licenseText = fs.readFileSync(licenseFile);
var license = '/**\n @license\n' + licenseText + '\n */\n';
if (outputFile) {
outputFile = licenseFile + '.wrapped';
fs.writeFileSync(outputFile, license, 'utf8');
return outputFile;
} else {
return license;
}
};

View File

@ -1,46 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var kLogsArgument = /^--logs\s*=\s*(.+?)$/;
var kTrimLeft = /^\s+/;
var kTrimRight = /\s+$/;
var kCamelCase = /[-_\s]+(.)?/g;
var logs = findArgvLogs();
function findArgvLogs() {
for (var i = 0; i < process.argv.length; ++i) {
var match = process.argv[i].match(kLogsArgument);
if (match) {
return logsToObject(match[1]);
}
}
return null;
}
function logsToObject(logstr) {
return logstr.split(',').reduce(function(obj, key) {
key = camelize(key);
if (key.length > 0) obj[key] = true;
return obj;
}, Object.create(null));
return logs;
}
function camelize(str) {
return str.replace(kTrimLeft, '').replace(kTrimRight, '').replace(kCamelCase, function(match, c) {
return c ? c.toUpperCase() : '';
});
}
function shouldLog(str) {
if (!logs || logs.quiet) return false;
if (logs.all) return true;
return !!logs[camelize(str)];
}
module.exports = shouldLog;

View File

@ -1,28 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// helper script that will read out the url parameters
// and store them in appropriate form fields on the page
(function() {
var regex = /(\w+)=(\w+)/g;
var search = decodeURIComponent(location.search);
while (match = regex.exec(search)) {
var name = match[1];
var value = match[2];
var els = document.querySelectorAll('input[name="' + name + '"]');
var el;
for (var i = 0; i < els.length; i++) {
el = els[i];
if (el.type === 'radio' || el.type === 'checkbox') {
el.checked = el.value === value;
} else {
el.value = value;
}
}
}
})();

View File

@ -1,124 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var chokidar = require('chokidar');
var runSequence = require('run-sequence');
var path = require('path');
function watch(globs, opts, tasks) {
if (typeof opts !== 'object' || Array.isArray(opts)) {
tasks = opts;
opts = {};
}
var triggerCount = 0;
var useRunSequence = typeof tasks !== 'function';
var runTasks;
if (useRunSequence) {
if (!Array.isArray(tasks)) tasks = [tasks];
tasks = tasks.slice();
tasks.push(tasksDone);
runTasks = function runTaskSequence() { runSequence.apply(null, tasks); };
} else {
var sync = tasks.length === 0;
runTasks = function runCallback() {
try {
tasks(tasksDone);
if (sync) tasksDone();
} catch (e) {
return tasksDone(e);
}
};
}
var events = opts.events = opts.events || ['add', 'change', 'unlink'];
// Don't let chokidar call us while initializing because on large trees it might take too long for
// all the add events to be emitted which causes the initial callback to be triggered more than
// once. Instead, we call handleEvent directly.
var ignoreInitial = opts.ignoreInitial;
opts.ignoreInitial = true;
var delay = opts.delay;
if (delay === undefined) delay = 100;
var watcher =
chokidar.watch(globs, opts).on('all', handleEvent).on('error', function(err) { throw err; });
var log = function watchLogger(triggerCount) {
// Don't report change for initial event
if (!ignoreInitial && !--triggerCount) return;
process.stdout.write([
'',
'==================================================',
' WATCH TRIGGERED BY FILE CHANGE #' + triggerCount,
' On: ' + prettyTime(),
'==================================================\n',
].join('\n'));
function prettyTime() {
var now = new Date();
return now.toLocaleDateString() + ' at ' + now.toLocaleTimeString();
}
};
if (opts.log !== undefined && !opts.log) {
log = function noopLog(triggerCount) {};
}
var close = watcher.close.bind(watcher);
watcher.close = function() {
if (timeoutId !== null) clearTimeout(timeoutId);
close();
};
var eventsRecorded = 0; // Number of events recorded
var timeoutId = null; // If non-null, event capture window is open
if (!ignoreInitial) {
// synthetic event to kick off the first task run
timeoutId = setTimeout(invokeCallback, delay);
}
return watcher;
function handleEvent(event, filepath) {
// Ignore unwatched events
if (events.indexOf(event) < 0) return;
// Increment number of events captured in this window
++eventsRecorded;
if (timeoutId === null) {
timeoutId = setTimeout(invokeCallback, delay);
}
}
function invokeCallback() {
eventsRecorded = 0;
log(++triggerCount);
runTasks();
}
function tasksDone(err) {
if (eventsRecorded) {
// eventsRecorded has increased during the run, run again on the next turn
timeoutId = setTimeout(invokeCallback, 0);
} else {
timeoutId = null;
}
if (!useRunSequence && err) {
// tslint:disable-next-line:no-console
console.log('Watch task error:', err.toString());
}
}
}
module.exports = watch;

View File

@ -1,179 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var rewire = require('rewire');
describe('watch()', function() {
var timeout;
var watch;
var watcher;
var unmock;
beforeEach(function() {
timeout = mockTimeout();
var watchModule = rewire('./watch');
unmock = watchModule.__set__(timeout.mocks);
watch = watchModule.__get__('watch');
});
afterEach(function() {
// Shouldn't really be necessary, but...
if (watcher) {
watcher.close();
watcher = null;
}
unmock();
expect(timeout.pending).toBe(0);
timeout = null;
});
it('should fire callback once for events which occur within `delay` window', function() {
var cb = jasmine.createSpy('callback');
watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('add', './$$fake_path/test.txt');
timeout.flush(9);
expect(cb).not.toHaveBeenCalled();
watcher._emit('change', './$$fake_path/test.txt');
watcher._emit('add', './$$fake_path/test2.txt');
watcher._emit('change', './$$fake_path/test2.txt');
watcher._emit('add', './$$fake_path/test3.txt');
watcher._emit('change', './$$fake_path/test3.txt');
expect(cb).not.toHaveBeenCalled();
timeout.flush(1);
expect(cb.calls.count()).toBe(1);
});
it('should trigger callback if events are collected during task running', function() {
var calls = 0;
function cb(done) {
if (++calls !== 1) return done();
watcher._emit('change', './$$fake_path/test1.txt');
watcher._emit('change', './$$fake_path/test2.txt');
// Before the done callback, there are no pending timer events
expect(timeout.pending).toBe(0);
done();
// Afterwards, there is one
expect(timeout.pending).toBe(1);
}
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
expect(timeout.pending).toBe(1);
expect(calls).toBe(0);
timeout.flush(10);
expect(calls).toBe(2);
});
it('should continue to trigger callbacks if task throws', function() {
var calls = 0;
spyOn(console, 'log');
function cb(done) {
calls += 1;
if (calls === 1) throw new Error('oops!');
done();
}
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
timeout.flush();
expect(calls).toBe(1);
expect(console.log).toHaveBeenCalledWith('Watch task error:', 'Error: oops!');
watcher._emit('change', './$$fake_path/test2.txt');
timeout.flush();
expect(calls).toBe(2);
});
it('should cancel pending callback if FSWatcher is closed', function() {
var cb = jasmine.createSpy('callback');
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
expect(timeout.pending).toBe(1);
expect(cb).not.toHaveBeenCalled();
watcher.close();
expect(timeout.pending).toBe(0);
});
it('should cancel followup pending callback if FSWatcher is closed during task', function() {
var calls = 0;
function cb(done) {
if (++calls !== 1) return done();
watcher._emit('change', './$$fake_path/test2.txt');
done();
expect(timeout.pending).toBe(1);
watcher.close();
expect(timeout.pending).toBe(0);
}
var watcher = watch('./$$fake_path/**/*', {delay: 10, log: false}, cb);
watcher._emit('change', './$$fake_path/test1.txt');
timeout.flush(10);
expect(calls).toBe(1);
});
});
// setTimeout/clearTimeout mocking, mostly stolen from angular-mocks.js
function mockTimeout() {
var events = [];
var id = 0;
var now = 0;
return {
mocks: {setTimeout: mockSetTimeout, clearTimeout: mockClearTimeout},
flush: flush, get pending() { return events.length; }
};
function mockSetTimeout(fn, delay) {
delay = delay || 0;
events.push({time: now + delay, fn: fn, id: id});
events.sort(function(a, b) { return a.time - b.time; });
return id++;
}
function mockClearTimeout(id) {
for (var i = 0; i < events.length; ++i) {
if (events[i].id === id) {
events.splice(i, 1);
break;
}
}
}
function flush(delay) {
if (delay !== undefined)
now += delay;
else if (events.length)
now = events[events.length - 1].time;
else
throw new Error('No timer events registered');
while (events.length && events[0].time <= now) {
events.shift().fn();
}
}
}

View File

@ -1,55 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
const glob = require('glob');
import 'zone.js/lib/node/rollup-main';
const JasmineRunner = require('jasmine');
const path = require('path');
import 'zone.js/lib/zone-spec/long-stack-trace';
import 'zone.js/lib/zone-spec/task-tracing';
import 'zone.js/lib/zone-spec/proxy';
import 'zone.js/lib/zone-spec/sync-test';
import 'zone.js/lib/zone-spec/async-test';
import 'zone.js/lib/zone-spec/fake-async-test';
const {generateSeed} = require('../../../tools/jasmine-seed-generator');
// Let TypeScript know this is a module
export {};
const jrunner = new JasmineRunner({projectBaseDir: path.resolve(__dirname, '../../')});
(global as any)['jasmine'] = jrunner.jasmine;
import 'zone.js/lib/jasmine/jasmine';
// Turn on full stack traces in errors to help debugging
(<any>Error)['stackTraceLimit'] = Infinity;
// Config the test runner
jrunner.jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
jrunner.loadConfig({
random: true,
spec_dir: '',
});
jrunner.seed(generateSeed('cjs-jasmine/index-tools'));
jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1});
jrunner.onComplete((passed: boolean) => process.exit(passed ? 0 : 1));
// Support passing multiple globs
const rootDir = process.cwd();
const globsIndex = process.argv.indexOf('--');
const globs = (globsIndex === -1) ? [process.argv[2]] : process.argv.slice(globsIndex + 1);
const specFiles = globs.map(globstr => glob.sync(globstr, {cwd: rootDir}) as string[])
.reduce((allPaths, paths) => allPaths.concat(paths), []);
// Load helpers and spec files
const rootDirRequire = (relativePath: string) => require(path.join(rootDir, relativePath));
specFiles.forEach(rootDirRequire);
// Run the tests
jrunner.execute();

View File

@ -1,101 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
'use strict';
const glob = require('glob');
require('zone.js/lib/node/rollup-main.js');
const JasmineRunner = require('jasmine');
const path = require('path');
require('source-map-support').install();
require('zone.js/lib/zone-spec/long-stack-trace.js');
require('zone.js/lib/zone-spec/task-tracking.js');
require('zone.js/lib/zone-spec/proxy.js');
require('zone.js/lib/zone-spec/sync-test.js');
require('zone.js/lib/zone-spec/async-test.js');
require('zone.js/lib/zone-spec/fake-async-test.js');
require('reflect-metadata/Reflect');
const {generateSeed} = require('../../../tools/jasmine-seed-generator');
// Let TypeScript know this is a module
export {};
const jrunner = new JasmineRunner({projectBaseDir: path.resolve(__dirname, '../../')});
(global as any)['jasmine'] = jrunner.jasmine;
require('zone.js/lib/jasmine/jasmine.js');
(global as any).isBrowser = false;
(global as any).isNode = true;
// Turn on full stack traces in errors to help debugging
(<any>Error)['stackTraceLimit'] = Infinity;
// Config the test runner
jrunner.jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
jrunner.loadConfig({
random: true,
spec_dir: '',
});
jrunner.seed(generateSeed('cjs-jasmine/index'));
jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1});
jrunner.onComplete((passed: boolean) => process.exit(passed ? 0 : 1));
// Support passing multiple globs
const distAll = process.cwd() + '/dist/all';
const globsIndex = process.argv.indexOf('--');
const globs = (globsIndex === -1) ? [process.argv[2]] : process.argv.slice(globsIndex + 1);
const specFiles =
globs
.map(globstr => glob.sync(globstr, {
cwd: distAll,
ignore: [
// the following code and tests are not compatible with CJS/node environment
'@angular/_testing_init/**',
'@angular/compiler/test/aot/**',
'@angular/compiler/test/render3/**',
'@angular/compiler-cli/test/compliance/**',
'@angular/core/test/bundling/**',
'@angular/core/test/fake_async_spec.*',
'@angular/core/test/render3/**',
'@angular/core/test/zone/**',
'@angular/elements/**',
'@angular/examples/**',
'@angular/forms/test/**',
'@angular/integration_test/symbol_inspector/**',
'@angular/platform-browser/**',
'@angular/platform-browser-dynamic/**',
'@angular/router/test/integration/bootstrap_spec.*',
'@angular/router/test/route_config/route_config_spec.*',
'@angular/upgrade/**',
'@angular/**/e2e_test/**',
'angular1_router/**',
'payload_tests/**',
],
}) as string[])
// Run relevant subset of browser tests for features reused on the server side.
// Make sure the security spec works on the server side!
.concat(glob.sync('@angular/platform-browser/test/security/**/*_spec.js', {cwd: distAll}))
.concat(['/@angular/platform-browser/test/browser/meta_spec.js'])
.concat(['/@angular/platform-browser/test/browser/title_spec.js'])
.concat(['/@angular/platform-browser/test/browser/transfer_state_spec.js'])
.reduce((allPaths, paths) => allPaths.concat(paths), []);
// Load helpers and spec files
const distAllRequire = (relativePath: string) => {
const mod = require(path.join(distAll, relativePath));
if (mod.main) {
mod.main();
}
return mod;
};
require('./test-cjs-main');
distAllRequire('@angular/platform-server/src/domino_adapter').DominoAdapter.makeCurrent();
specFiles.forEach(distAllRequire);
// Run the tests
jrunner.execute();

View File

@ -1,13 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const testingPlatformServer = require('../../all/@angular/platform-server/testing/src/server.js');
const coreTesting = require('../../all/@angular/core/testing');
coreTesting.TestBed.initTestEnvironment(
testingPlatformServer.ServerTestingModule, testingPlatformServer.platformServerTesting());

View File

@ -1,26 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = {
// Serve the built files
default: (gulp) => () => {
const connect = require('gulp-connect');
const cors = require('cors');
const path = require('path');
connect.server({
root: path.resolve(__dirname, '../../dist'),
port: 8000,
livereload: false,
open: false,
middleware: (connect, opt) => [cors()],
});
},
};