mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 08:04:00 +01:00
Render more task names
This commit is contained in:
@@ -100,18 +100,20 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
const srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
|
||||
const cleanTask = () => util.primraf(out);
|
||||
const cleanTask = util.rimraf(out);
|
||||
|
||||
const compileTask = util.task.series(cleanTask, () => {
|
||||
const compileTask_ = () => {
|
||||
const pipeline = createPipeline(false, true);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
.pipe(gulp.dest(out));
|
||||
});
|
||||
};
|
||||
compileTask_.displayName = `compile-extension-${name}`;
|
||||
const compileTask = util.task.series(cleanTask, compileTask_);
|
||||
|
||||
const watchTask = util.task.series(cleanTask, () => {
|
||||
const watchTask_ = () => {
|
||||
const pipeline = createPipeline(false);
|
||||
const input = gulp.src(src, srcOpts);
|
||||
const watchInput = watcher(src, srcOpts);
|
||||
@@ -119,7 +121,9 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
return watchInput
|
||||
.pipe(util.incremental(pipeline, input))
|
||||
.pipe(gulp.dest(out));
|
||||
});
|
||||
};
|
||||
watchTask_.displayName = `watch-extension-${name}`;
|
||||
const watchTask = util.task.series(cleanTask, watchTask_);
|
||||
|
||||
const compileBuildTask = util.task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(true, true);
|
||||
|
||||
@@ -78,7 +78,7 @@ const typesDts = [
|
||||
'!node_modules/@types/uglify-js/**/*',
|
||||
];
|
||||
function compileTask(src, out, build) {
|
||||
return function () {
|
||||
const result = function () {
|
||||
const compile = createCompile(src, build, true);
|
||||
const srcPipe = es.merge(gulp.src(`${src}/**`, { base: `${src}` }), gulp.src(typesDts));
|
||||
let generator = new MonacoGenerator(false);
|
||||
@@ -90,10 +90,12 @@ function compileTask(src, out, build) {
|
||||
.pipe(compile())
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
result.displayName = `compile-task-${out}${build ? '-build' : ''}`;
|
||||
return result;
|
||||
}
|
||||
exports.compileTask = compileTask;
|
||||
function watchTask(out, build) {
|
||||
return function () {
|
||||
const result = function () {
|
||||
const compile = createCompile('src', build);
|
||||
const src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src(typesDts));
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
@@ -104,6 +106,8 @@ function watchTask(out, build) {
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
result.displayName = `watch-task-${out}${build ? '-build' : ''}`;
|
||||
return result;
|
||||
}
|
||||
exports.watchTask = watchTask;
|
||||
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
|
||||
|
||||
@@ -90,7 +90,7 @@ const typesDts = [
|
||||
|
||||
export function compileTask(src: string, out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
const result = function () {
|
||||
const compile = createCompile(src, build, true);
|
||||
|
||||
const srcPipe = es.merge(
|
||||
@@ -108,11 +108,13 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
|
||||
.pipe(compile())
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
result.displayName = `compile-task-${out}${build ? '-build' : ''}`;
|
||||
return result;
|
||||
}
|
||||
|
||||
export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
const result = function () {
|
||||
const compile = createCompile('src', build);
|
||||
|
||||
const src = es.merge(
|
||||
@@ -129,6 +131,8 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
result.displayName = `watch-task-${out}${build ? '-build' : ''}`;
|
||||
return result;
|
||||
}
|
||||
|
||||
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
|
||||
|
||||
+25
-16
@@ -14,6 +14,8 @@ const fs = require("fs");
|
||||
const _rimraf = require("rimraf");
|
||||
const git = require("./git");
|
||||
const VinylFile = require("vinyl");
|
||||
const fancyLog = require("fancy-log");
|
||||
const ansiColors = require("ansi-colors");
|
||||
const NoCancellationToken = { isCancellationRequested: () => false };
|
||||
function incremental(streamProvider, initial, supportsCancellation) {
|
||||
const input = es.through();
|
||||
@@ -180,24 +182,10 @@ function rimraf(dir) {
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
return cb => retry(cb);
|
||||
retry.displayName = `clean-${path.basename(dir)}`;
|
||||
return retry;
|
||||
}
|
||||
exports.rimraf = rimraf;
|
||||
/**
|
||||
* Like rimraf (with 5 retries), but with a promise instead of a callback.
|
||||
*/
|
||||
function primraf(dir) {
|
||||
const fn = rimraf(dir);
|
||||
return new Promise((resolve, reject) => {
|
||||
fn((err) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.primraf = primraf;
|
||||
var task;
|
||||
(function (task_1) {
|
||||
function _isPromise(p) {
|
||||
@@ -206,7 +194,28 @@ var task;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function _renderTime(time) {
|
||||
if (time < 1000) {
|
||||
return `${time.toFixed(2)} ms`;
|
||||
}
|
||||
let seconds = time / 1000;
|
||||
if (seconds < 60) {
|
||||
return `${seconds.toFixed(1)} s`;
|
||||
}
|
||||
let minutes = Math.floor(seconds / 60);
|
||||
seconds -= minutes * 60;
|
||||
return `${minutes} m and ${seconds} s`;
|
||||
}
|
||||
async function _execute(task) {
|
||||
const name = task.displayName || task.name || `<anonymous>`;
|
||||
fancyLog('Starting', ansiColors.cyan(name), '...');
|
||||
const startTime = process.hrtime();
|
||||
await _doExecute(task);
|
||||
const elapsedArr = process.hrtime(startTime);
|
||||
const elapsedNanoseconds = (elapsedArr[0] * 1e9 + elapsedArr[1]);
|
||||
fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.green(_renderTime(elapsedNanoseconds / 1e6)));
|
||||
}
|
||||
async function _doExecute(task) {
|
||||
// Always invoke as if it were a callback task
|
||||
return new Promise((resolve, reject) => {
|
||||
if (task.length === 1) {
|
||||
|
||||
+27
-17
@@ -17,6 +17,8 @@ import * as git from './git';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import { ThroughStream } from 'through';
|
||||
import * as sm from 'source-map';
|
||||
import * as fancyLog from 'fancy-log';
|
||||
import * as ansiColors from 'ansi-colors';
|
||||
|
||||
export interface ICancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
@@ -233,23 +235,8 @@ export function rimraf(dir: string): (cb: any) => void {
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
return cb => retry(cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like rimraf (with 5 retries), but with a promise instead of a callback.
|
||||
*/
|
||||
export function primraf(dir: string): Promise<void> {
|
||||
const fn = rimraf(dir);
|
||||
return new Promise((resolve, reject) => {
|
||||
fn((err: any) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
retry.displayName = `clean-${path.basename(dir)}`;
|
||||
return retry;
|
||||
}
|
||||
|
||||
export type PromiseTask = () => Promise<void>;
|
||||
@@ -266,7 +253,30 @@ export namespace task {
|
||||
return false;
|
||||
}
|
||||
|
||||
function _renderTime(time: number): string {
|
||||
if (time < 1000) {
|
||||
return `${time.toFixed(2)} ms`;
|
||||
}
|
||||
let seconds = time / 1000;
|
||||
if (seconds < 60) {
|
||||
return `${seconds.toFixed(1)} s`;
|
||||
}
|
||||
let minutes = Math.floor(seconds / 60);
|
||||
seconds -= minutes * 60;
|
||||
return `${minutes} m and ${seconds} s`;
|
||||
}
|
||||
|
||||
async function _execute(task: Task): Promise<void> {
|
||||
const name = (<any>task).displayName || task.name || `<anonymous>`;
|
||||
fancyLog('Starting', ansiColors.cyan(name), '...');
|
||||
const startTime = process.hrtime();
|
||||
await _doExecute(task);
|
||||
const elapsedArr = process.hrtime(startTime);
|
||||
const elapsedNanoseconds = (elapsedArr[0] * 1e9 + elapsedArr[1]);
|
||||
fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.green(_renderTime(elapsedNanoseconds / 1e6)));
|
||||
}
|
||||
|
||||
async function _doExecute(task: Task): Promise<void> {
|
||||
// Always invoke as if it were a callback task
|
||||
return new Promise((resolve, reject) => {
|
||||
if (task.length === 1) {
|
||||
|
||||
Reference in New Issue
Block a user