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

@ -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();
}
}
}