mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -11,65 +11,81 @@ const fancyLog = require("fancy-log");
|
||||
const ansiColors = require("ansi-colors");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const allErrors = [];
|
||||
let startTime = null;
|
||||
let count = 0;
|
||||
function onStart() {
|
||||
if (count++ > 0) {
|
||||
return;
|
||||
class ErrorLog {
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
this.allErrors = [];
|
||||
this.startTime = null;
|
||||
this.count = 0;
|
||||
}
|
||||
startTime = new Date().getTime();
|
||||
fancyLog(`Starting ${ansiColors.green('compilation')}...`);
|
||||
}
|
||||
function onEnd() {
|
||||
if (--count > 0) {
|
||||
return;
|
||||
onStart() {
|
||||
if (this.count++ > 0) {
|
||||
return;
|
||||
}
|
||||
this.startTime = new Date().getTime();
|
||||
fancyLog(`Starting ${ansiColors.green('compilation')}${this.id ? ansiColors.blue(` ${this.id}`) : ''}...`);
|
||||
}
|
||||
onEnd() {
|
||||
if (--this.count > 0) {
|
||||
return;
|
||||
}
|
||||
this.log();
|
||||
}
|
||||
log() {
|
||||
const errors = _.flatten(this.allErrors);
|
||||
const seen = new Set();
|
||||
errors.map(err => {
|
||||
if (!seen.has(err)) {
|
||||
seen.add(err);
|
||||
fancyLog(`${ansiColors.red('Error')}: ${err}`);
|
||||
}
|
||||
});
|
||||
fancyLog(`Finished ${ansiColors.green('compilation')}${this.id ? ansiColors.blue(` ${this.id}`) : ''} with ${errors.length} errors after ${ansiColors.magenta((new Date().getTime() - this.startTime) + ' ms')}`);
|
||||
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/s;
|
||||
const messages = errors
|
||||
.map(err => regex.exec(err))
|
||||
.filter(match => !!match)
|
||||
.map(x => x)
|
||||
.map(([, path, line, column, message]) => ({ path, line: parseInt(line), column: parseInt(column), message }));
|
||||
try {
|
||||
const logFileName = 'log' + (this.id ? `_${this.id}` : '');
|
||||
fs.writeFileSync(path.join(buildLogFolder, logFileName), JSON.stringify(messages));
|
||||
}
|
||||
catch (err) {
|
||||
//noop
|
||||
}
|
||||
}
|
||||
log();
|
||||
}
|
||||
const buildLogPath = path.join(path.dirname(path.dirname(__dirname)), '.build', 'log');
|
||||
const errorLogsById = new Map();
|
||||
function getErrorLog(id = '') {
|
||||
let errorLog = errorLogsById.get(id);
|
||||
if (!errorLog) {
|
||||
errorLog = new ErrorLog(id);
|
||||
errorLogsById.set(id, errorLog);
|
||||
}
|
||||
return errorLog;
|
||||
}
|
||||
const buildLogFolder = path.join(path.dirname(path.dirname(__dirname)), '.build');
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(buildLogPath));
|
||||
fs.mkdirSync(buildLogFolder);
|
||||
}
|
||||
catch (err) {
|
||||
// ignore
|
||||
}
|
||||
function log() {
|
||||
const errors = _.flatten(allErrors);
|
||||
const seen = new Set();
|
||||
errors.map(err => {
|
||||
if (!seen.has(err)) {
|
||||
seen.add(err);
|
||||
fancyLog(`${ansiColors.red('Error')}: ${err}`);
|
||||
}
|
||||
});
|
||||
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
||||
const messages = errors
|
||||
.map(err => regex.exec(err))
|
||||
.filter(match => !!match)
|
||||
.map(x => x)
|
||||
.map(([, path, line, column, message]) => ({ path, line: parseInt(line), column: parseInt(column), message }));
|
||||
try {
|
||||
fs.writeFileSync(buildLogPath, JSON.stringify(messages));
|
||||
}
|
||||
catch (err) {
|
||||
//noop
|
||||
}
|
||||
fancyLog(`Finished ${ansiColors.green('compilation')} with ${errors.length} errors after ${ansiColors.magenta((new Date().getTime() - startTime) + ' ms')}`);
|
||||
}
|
||||
function createReporter() {
|
||||
function createReporter(id) {
|
||||
const errorLog = getErrorLog(id);
|
||||
const errors = [];
|
||||
allErrors.push(errors);
|
||||
errorLog.allErrors.push(errors);
|
||||
const result = (err) => errors.push(err);
|
||||
result.hasErrors = () => errors.length > 0;
|
||||
result.end = (emitError) => {
|
||||
errors.length = 0;
|
||||
onStart();
|
||||
errorLog.onStart();
|
||||
return es.through(undefined, function () {
|
||||
onEnd();
|
||||
errorLog.onEnd();
|
||||
if (emitError && errors.length > 0) {
|
||||
if (!errors.__logged__) {
|
||||
log();
|
||||
errorLog.log();
|
||||
}
|
||||
errors.__logged__ = true;
|
||||
const err = new Error(`Found ${errors.length} errors`);
|
||||
|
||||
Reference in New Issue
Block a user