diff --git a/.travis.yml b/.travis.yml index a0fd4327c..a33f15001 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,8 @@ script: - npm run cov:instrument - npm test --silent - npm run cov:report - - npm run test:release + - npm run test:artifacts + - 'if [[ "$TRAVIS_TAG" != "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then npm run test:release; fi' after_failure: - ./.travis/printLogs.sh diff --git a/gulpfile.js b/gulpfile.ts similarity index 59% rename from gulpfile.js rename to gulpfile.ts index dd2b06202..fa6b04e1d 100644 --- a/gulpfile.js +++ b/gulpfile.ts @@ -5,21 +5,24 @@ 'use strict'; -const fs = require('fs'); -const path = require('path'); -const del = require('del'); -const gulp = require('gulp'); -const mocha = require('gulp-mocha'); -const tslint = require('gulp-tslint'); -const vsce = require('vsce'); -const debugUtil = require('./out/src/coreclr-debug/util'); -const packages = require('./out/src/packages'); -const logger = require('./out/src/logger'); -const platform = require('./out/src/platform'); -const util = require('./out/src/common'); -const child_process = require('child_process'); -const optionsSchemaGenerator = require('./out/src/tools/GenerateOptionsSchema'); -const packageDependencyUpdater = require('./out/src/tools/UpdatePackageDependencies'); +import * as child_process from 'child_process'; +import * as debugUtil from './src/coreclr-debug/util'; +import * as del from 'del'; +import * as fs from 'fs'; +import * as gulp from 'gulp'; +import * as logger from './src/logger'; +import * as mocha from 'gulp-mocha'; +import * as optionsSchemaGenerator from './src/tools/GenerateOptionsSchema'; +import * as packageDependencyUpdater from './src/tools/UpdatePackageDependencies'; +import * as packages from './src/packages'; +import * as path from 'path'; +import * as platform from './src/platform'; +import * as util from './src/common'; +import * as vsce from 'vsce'; + +import { CsharpLoggerObserver } from './src/observers/CsharpLoggerObserver'; +import { EventStream } from './src/EventStream'; +import tslint from 'gulp-tslint'; const Logger = logger.Logger; const PackageManager = packages.PackageManager; @@ -51,15 +54,18 @@ gulp.task('updatePackageDependencies', () => { // Install Tasks function install(platformInfo, packageJSON) { const packageManager = new PackageManager(platformInfo, packageJSON); + let eventStream = new EventStream(); const logger = new Logger(message => process.stdout.write(message)); - const debuggerUtil = new debugUtil.CoreClrDebugUtil(path.resolve('.'), logger); + let stdoutObserver = new CsharpLoggerObserver(logger); + eventStream.subscribe(stdoutObserver.post); + const debuggerUtil = new debugUtil.CoreClrDebugUtil(path.resolve('.')); - return packageManager.DownloadPackages(logger) + return packageManager.DownloadPackages(eventStream, undefined, undefined, undefined) .then(() => { - return packageManager.InstallPackages(logger); + return packageManager.InstallPackages(eventStream, undefined); }) .then(() => { - return util.touchInstallFile(util.InstallFileType.Lock) + return util.touchInstallFile(util.InstallFileType.Lock); }) .then(() => { return debugUtil.CoreClrDebugUtil.writeEmptyFile(debuggerUtil.installCompleteFilePath()); @@ -76,24 +82,30 @@ gulp.task('install', ['clean'], () => { }); /// Packaging (VSIX) Tasks -function doPackageSync(packageName) { +function doPackageSync(packageName, outputFolder) { - var vsceArgs = []; - vsceArgs.push(path.join(__dirname, 'node_modules', 'vsce', 'out', 'vsce')) + let vsceArgs = []; + vsceArgs.push(path.join(__dirname, 'node_modules', 'vsce', 'out', 'vsce')); vsceArgs.push('package'); // package command if (packageName !== undefined) { vsceArgs.push('-o'); - vsceArgs.push(packageName); + if (outputFolder) { + //if we have specified an output folder then put the files in that output folder + vsceArgs.push(path.join(outputFolder, packageName)); + } + else { + vsceArgs.push(packageName); + } } - var proc = child_process.spawnSync('node', vsceArgs); + let proc = child_process.spawnSync('node', vsceArgs); if (proc.error) { console.error(proc.error.toString()); } } -function doOfflinePackage(platformInfo, packageName, packageJSON) { +function doOfflinePackage(platformInfo, packageName, packageJSON, outputFolder) { if (process.platform === 'win32') { throw new Error('Do not build offline packages on windows. Runtime executables will not be marked executable in *nix packages.'); } @@ -101,12 +113,12 @@ function doOfflinePackage(platformInfo, packageName, packageJSON) { cleanSync(false); return install(platformInfo, packageJSON) .then(() => { - doPackageSync(packageName + '-' + platformInfo.platform + '-' + platformInfo.architecture + '.vsix'); + doPackageSync(packageName + '-' + platformInfo.platform + '-' + platformInfo.architecture + '.vsix', outputFolder); }); } function getPackageJSON() { - return JSON.parse(fs.readFileSync('package.json')); + return JSON.parse(fs.readFileSync('package.json').toString()); } gulp.task('package:clean', () => { @@ -114,28 +126,42 @@ gulp.task('package:clean', () => { }); gulp.task('package:online', ['clean'], () => { - doPackageSync(); + doPackageSync(undefined, undefined); }); -gulp.task('package:offline', ['clean'], () => { +gulp.task('package:offline', () => { util.setExtensionPath(__dirname); - var packageJSON = getPackageJSON(); - var name = packageJSON.name; - var version = packageJSON.version; - var packageName = name + '.' + version; + let argv = require('minimist')(process.argv.slice(2), { boolean: ['retainVsix'] }); + if (argv['retainVsix']) { + //if user doesnot want to clean up the existing vsix packages + cleanSync(false); + } + else { + cleanSync(true); + } + + let outputFolder; + if (argv['o']) { + outputFolder = argv['o']; + } - var packages = []; + const packageJSON = getPackageJSON(); + const name = packageJSON.name; + const version = packageJSON.version; + const packageName = name + '.' + version; + + const packages = []; packages.push(new PlatformInformation('win32', 'x86_64')); packages.push(new PlatformInformation('darwin', 'x86_64')); packages.push(new PlatformInformation('linux', 'x86_64')); - var promise = Promise.resolve(); + let promise = Promise.resolve(); packages.forEach(platformInfo => { promise = promise .then(() => { - return doOfflinePackage(platformInfo, packageName, packageJSON); + return doOfflinePackage(platformInfo, packageName, packageJSON, outputFolder); }); }); @@ -151,9 +177,9 @@ const allTypeScript = [ const lintReporter = (output, file, options) => { //emits: src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’ - var relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/'); + let relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/'); output.forEach(e => { - var message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure; + let message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure; console.log('[tslint] ' + message); }); }; @@ -164,8 +190,8 @@ gulp.task('tslint', () => { program: require('tslint').Linter.createProgram("./tsconfig.json"), configuration: "./tslint.json" })) - .pipe(tslint.report(lintReporter, { + .pipe(tslint.report({ summarizeFailureOutput: false, emitError: false - })) + })); }); diff --git a/package-lock.json b/package-lock.json index 30df8c9e8..1d31d2691 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "csharp", - "version": "1.15.0-beta3", + "version": "1.15.0-beta4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -238,7 +238,8 @@ "abbrev": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true }, "agent-base": { "version": "4.1.2", @@ -264,6 +265,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, "requires": { "kind-of": "3.2.2", "longest": "1.0.1", @@ -273,7 +275,8 @@ "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true }, "ansi-colors": { "version": "1.1.0", @@ -349,6 +352,7 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, "requires": { "sprintf-js": "1.0.3" } @@ -480,7 +484,8 @@ "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true }, "async-arrays": { "version": "1.0.1", @@ -561,7 +566,8 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base64-js": { "version": "1.2.3", @@ -622,6 +628,7 @@ "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -677,6 +684,7 @@ "version": "0.1.3", "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, "optional": true, "requires": { "align-text": "0.1.4", @@ -994,7 +1002,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "convert-source-map": { "version": "1.5.1", @@ -1221,7 +1230,8 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "deep-assign": { "version": "1.0.0", @@ -1244,7 +1254,8 @@ "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true }, "defaults": { "version": "1.0.3", @@ -1534,6 +1545,7 @@ "version": "1.8.1", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, "requires": { "esprima": "2.7.3", "estraverse": "1.9.3", @@ -1546,6 +1558,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, "optional": true, "requires": { "amdefine": "1.0.1" @@ -1556,17 +1569,20 @@ "esprima": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=" + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true }, "estraverse": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=" + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true }, "event-stream": { "version": "3.3.4", @@ -1705,7 +1721,8 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true }, "fd-slicer": { "version": "1.0.1", @@ -2008,6 +2025,15 @@ "is-glob": "2.0.1" } }, + "glob-promise": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/glob-promise/-/glob-promise-3.4.0.tgz", + "integrity": "sha512-q08RJ6O+eJn+dVanerAndJwIcumgbDdYiUT7zFQl3Wm1xD6fBKtah7H8ZJChj4wP+8C+QfeVy8xautR7rdmKEw==", + "dev": true, + "requires": { + "@types/glob": "5.0.35" + } + }, "glob-stream": { "version": "3.1.18", "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", @@ -3158,6 +3184,7 @@ "version": "4.0.11", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, "requires": { "async": "1.5.2", "optimist": "0.6.1", @@ -3169,6 +3196,7 @@ "version": "0.4.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, "requires": { "amdefine": "1.0.1" } @@ -3214,7 +3242,8 @@ "has-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=" + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true }, "has-gulplog": { "version": "0.1.0", @@ -3359,6 +3388,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "1.4.0", "wrappy": "1.0.2" @@ -3367,7 +3397,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "ini": { "version": "1.3.5", @@ -3420,7 +3451,8 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true }, "is-builtin-module": { "version": "1.0.0", @@ -3653,7 +3685,8 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "2.1.0", @@ -3682,6 +3715,7 @@ "version": "0.4.5", "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "dev": true, "requires": { "abbrev": "1.0.9", "async": "1.5.2", @@ -3703,6 +3737,7 @@ "version": "5.0.15", "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, "requires": { "inflight": "1.0.6", "inherits": "2.0.3", @@ -3714,12 +3749,14 @@ "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true }, "supports-color": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, "requires": { "has-flag": "1.0.0" } @@ -3881,6 +3918,7 @@ "version": "3.11.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", + "dev": true, "requires": { "argparse": "1.0.9", "esprima": "4.0.0" @@ -3889,7 +3927,8 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true } } }, @@ -3982,6 +4021,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "requires": { "is-buffer": "1.1.6" } @@ -3990,6 +4030,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, "optional": true }, "lazystream": { @@ -4052,6 +4093,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, "requires": { "prelude-ls": "1.1.2", "type-check": "0.3.2" @@ -4288,7 +4330,8 @@ "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true }, "lru-cache": { "version": "4.1.1", @@ -4457,14 +4500,16 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "1.1.8" } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true }, "mkdirp": { "version": "0.5.1", @@ -4472,6 +4517,13 @@ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } } }, "mocha": { @@ -4616,6 +4668,7 @@ "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, "requires": { "abbrev": "1.0.9" } @@ -7568,6 +7621,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1.0.2" } @@ -7581,15 +7635,23 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, "requires": { - "minimist": "0.0.8", + "minimist": "0.0.10", "wordwrap": "0.0.3" }, "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true } } }, @@ -7597,6 +7659,7 @@ "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, "requires": { "deep-is": "0.1.3", "fast-levenshtein": "2.0.6", @@ -7763,7 +7826,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-is-inside": { "version": "1.0.2", @@ -7899,7 +7963,8 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true }, "preserve": { "version": "0.2.0", @@ -8198,7 +8263,8 @@ "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true }, "replace-ext": { "version": "0.0.1", @@ -8448,6 +8514,7 @@ "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, "optional": true, "requires": { "align-text": "0.1.4" @@ -8612,7 +8679,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sshpk": { "version": "1.13.1", @@ -9117,6 +9185,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, "requires": { "prelude-ls": "1.1.2" } @@ -9153,6 +9222,7 @@ "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, "optional": true, "requires": { "source-map": "0.5.7", @@ -9164,12 +9234,14 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, "optional": true }, "cliui": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, "optional": true, "requires": { "center-align": "0.1.3", @@ -9181,18 +9253,21 @@ "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, "optional": true }, "wordwrap": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, "optional": true }, "yargs": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, "optional": true, "requires": { "camelcase": "1.2.1", @@ -9207,6 +9282,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, "optional": true }, "unc-path-regex": { @@ -9568,6 +9644,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, "requires": { "isexe": "2.0.0" } @@ -9582,6 +9659,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, "optional": true }, "wolfy87-eventemitter": { @@ -9593,7 +9671,8 @@ "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true }, "wrap-ansi": { "version": "2.1.0", @@ -9608,7 +9687,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "xmlbuilder": { "version": "9.0.7", diff --git a/package.json b/package.json index fb6771842..486fae364 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "test:runSuiteInVsCode": "cross-env CODE_EXTENSIONS_PATH=./ CODE_TESTS_PATH=./out/test/integrationTests CODE_TESTS_WORKSPACE=./test/integrationTests/testAssets/$OSVC_SUITE npm run test:runInVsCode", "test:runInVsCode": "node ./test/runVsCodeTestsWithAbsolutePaths.js", "test:release": "mocha --opts ./mocha.opts test/releaseTests/**/*.test.ts", + "test:artifacts": "mocha --opts ./mocha.opts test/artifactTests/**/*.test.ts", "postinstall": "node ./node_modules/vscode/bin/install", "cov:instrument": "rimraf ./coverage && rimraf ./.nyc_output && rimraf ./out && npm run compile && cd out && nyc instrument --require source-map-support/register --cwd ../ . . && cd ..", "cov:merge": "cd ./out && istanbul-combine -d ../coverage/integration -r lcovonly ../.nyc_output/integration/*.json && cd ..", @@ -109,6 +110,7 @@ "istanbul": "^0.4.5", "istanbul-combine": "^0.3.0", "ltcdr": "^2.2.1", + "minimist": "^1.2.0", "mocha": "^5.0.4", "mocha-typescript": "^1.1.12", "npm-run-all": "^4.1.2", diff --git a/src/observers/BaseLoggerObserver.ts b/src/observers/BaseLoggerObserver.ts index b68614b30..d40a4c80b 100644 --- a/src/observers/BaseLoggerObserver.ts +++ b/src/observers/BaseLoggerObserver.ts @@ -9,8 +9,13 @@ import { BaseEvent } from '../omnisharp/loggingEvents'; export abstract class BaseLoggerObserver { public logger: Logger; - constructor(channel: vscode.OutputChannel) { - this.logger = new Logger((message) => channel.append(message)); + constructor(channel: vscode.OutputChannel | Logger) { + if (channel instanceof Logger) { + this.logger = channel as Logger; + } + else { + this.logger = new Logger((message) => channel.append(message)); + } } abstract post: (event: BaseEvent) => void; diff --git a/test/releaseTests/vsix.test.ts b/test/artifactTests/vsix.test.ts similarity index 100% rename from test/releaseTests/vsix.test.ts rename to test/artifactTests/vsix.test.ts diff --git a/test/releaseTests/offlinePackage.test.ts b/test/releaseTests/offlinePackage.test.ts new file mode 100644 index 000000000..fbfca08db --- /dev/null +++ b/test/releaseTests/offlinePackage.test.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as chai from 'chai'; +import * as glob from 'glob-promise'; +import * as path from 'path'; +import { invokeNode } from './testAssets/testAssets'; +import { PlatformInformation } from '../../src/platform'; +import { rimraf } from 'async-file'; + +let tmp = require('tmp'); + +suite("Offline packaging of VSIX", function () { + let vsixFiles: string[]; + this.timeout(1000000); + let tmpDir = null; + + suiteSetup(() => { + chai.should(); + tmpDir = tmp.dirSync(); + let args: string[] = []; + args.push(path.join("node_modules", "gulp", "bin", "gulp.js")); + args.push("package:offline"); + args.push("--retainVsix");// do not delete the existing vsix in the repo + args.push(`-o`); + args.push(tmpDir.name); + invokeNode(args); + vsixFiles = glob.sync(path.join(tmpDir.name, '*.vsix')); + }); + + test("Exactly 3 vsix files should be produced", () => { + vsixFiles.length.should.be.equal(3, "the build should produce exactly 3 vsix files"); + }); + + [ + new PlatformInformation('win32', 'x86_64'), + new PlatformInformation('darwin', 'x86_64'), + new PlatformInformation('linux', 'x86_64') + ].forEach(element => { + test(`Given Platform: ${element.platform} and Architecture: ${element.architecture}, the vsix file is created`, () => { + vsixFiles.findIndex(elem => elem.indexOf(element.platform) != -1).should.not.be.equal(-1); + vsixFiles.findIndex(elem => elem.indexOf(element.architecture) != -1).should.not.be.equal(-1); + }); + }); + + suiteTeardown(async () => { + if (tmpDir) { + await rimraf(tmpDir.name); + } + + tmpDir = null; + }); +}); diff --git a/test/releaseTests/testAssets/testAssets.ts b/test/releaseTests/testAssets/testAssets.ts new file mode 100644 index 000000000..26616481d --- /dev/null +++ b/test/releaseTests/testAssets/testAssets.ts @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as cp from 'child_process'; +import * as path from 'path'; + +export function invokeNode(args: string[]){ + let proc = cp.spawnSync('node', args); + if (proc.error) { + console.error(proc.error.toString()); + } +} \ No newline at end of file