Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix offline packaging using event stream #2138

Merged
merged 25 commits into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ 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');
const eventStream = require('./out/src/EventStream');
const csharpLoggerObserver = require('./out/src/observers/CsharpLoggerObserver');

const EventStream = eventStream.EventStream;
const Logger = logger.Logger;
const PackageManager = packages.PackageManager;
const LinuxDistribution = platform.LinuxDistribution;
const PlatformInformation = platform.PlatformInformation;
const CsharpLoggerObserver = csharpLoggerObserver.CsharpLoggerObserver;

function cleanSync(deleteVsix) {
del.sync('install.*');
Expand All @@ -51,12 +55,15 @@ 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));
let stdoutObserver = new CsharpLoggerObserver(logger);
eventStream.subscribe(stdoutObserver.post);
const debuggerUtil = new debugUtil.CoreClrDebugUtil(path.resolve('.'), logger);

return packageManager.DownloadPackages(logger)
return packageManager.DownloadPackages(eventStream)
.then(() => {
return packageManager.InstallPackages(logger);
return packageManager.InstallPackages(eventStream);
})
.then(() => {
return util.touchInstallFile(util.InstallFileType.Lock)
Expand Down
9 changes: 7 additions & 2 deletions src/observers/BaseLoggerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down