Implement extensions channel

This commit is contained in:
Asher 2019-07-08 10:33:58 -05:00
parent f51751ad21
commit a20fa4a97a
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
4 changed files with 52 additions and 21 deletions

View File

@ -55,6 +55,7 @@ How to [secure your setup](/doc/security/ssl.md).
export OUT=/path/to/some/directory`. Otherwise it will build in this
directory which will cause issues because then `yarn watch` will try to
compile the build directory as well.
- For now `@coder/nbin` is a global dependency.
- Run `yarn build ${vscodeVersion} ${target} ${arch}`in this directory (for example:
`yarn build 1.35.0 linux x64`).

View File

@ -44,7 +44,7 @@ class Watcher extends DiskFileSystemProvider {
/**
* See: src/vs/platform/remote/common/remoteAgentFileSystemChannel.ts.
*/
export class FileProviderChannel implements IServerChannel {
export class FileProviderChannel implements IServerChannel, IDisposable {
private readonly provider: DiskFileSystemProvider;
private readonly watchers = new Map<string, Watcher>();
@ -106,6 +106,11 @@ export class FileProviderChannel implements IServerChannel {
throw new Error(`Invalid call "${command}"`);
}
public dispose(): void {
this.watchers.forEach((w) => w.dispose());
this.watchers.clear();
}
private async stat(resource: UriComponents): Promise<IStat> {
return this.provider.stat(URI.from(resource));
}

View File

@ -200,11 +200,11 @@ function package-task() {
cd "${releasePath}"
if [[ "${target}" == "linux" ]] ; then
tar -czf "${archiveName}.tar.gz" "${archiveName}"
log "Archive: ${archivePath}.tar.gz"
else
zip -r "${archiveName}.zip" "${archiveName}"
log "Archive: ${archivePath}.zip"
fi
log "Archive: ${archivePath}"
}
# Package built code into a binary.

View File

@ -10,12 +10,25 @@ import { sanitizeFilePath } from "vs/base/common/extpath";
import { getMediaMime } from "vs/base/common/mime";
import { extname } from "vs/base/common/path";
import { UriComponents, URI } from "vs/base/common/uri";
import { IPCServer, ClientConnectionEvent } from "vs/base/parts/ipc/common/ipc";
import { IPCServer, ClientConnectionEvent, StaticRouter } from "vs/base/parts/ipc/common/ipc";
import { LogsDataCleaner } from "vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner";
import { IConfigurationService } from "vs/platform/configuration/common/configuration";
import { ConfigurationService } from "vs/platform/configuration/node/configurationService";
import { IDialogService } from "vs/platform/dialogs/common/dialogs";
import { DialogChannelClient } from "vs/platform/dialogs/node/dialogIpc";
import { IDownloadService } from "vs/platform/download/common/download";
import { DownloadServiceChannelClient } from "vs/platform/download/node/downloadIpc";
import { IEnvironmentService, ParsedArgs } from "vs/platform/environment/common/environment";
import { EnvironmentService } from "vs/platform/environment/node/environmentService";
import { IExtensionManagementService, IExtensionGalleryService } from "vs/platform/extensionManagement/common/extensionManagement";
import { ExtensionGalleryService } from "vs/platform/extensionManagement/node/extensionGalleryService";
import { ExtensionManagementChannel } from "vs/platform/extensionManagement/node/extensionManagementIpc";
import { ExtensionManagementService } from "vs/platform/extensionManagement/node/extensionManagementService";
import { SyncDescriptor } from "vs/platform/instantiation/common/descriptors";
import { InstantiationService } from "vs/platform/instantiation/common/instantiationService";
import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection";
import { ILocalizationsService } from "vs/platform/localizations/common/localizations";
import { LocalizationsService } from "vs/platform/localizations/node/localizations";
import { getLogLevel, ILogService } from "vs/platform/log/common/log";
import { LogLevelSetterChannel } from "vs/platform/log/common/logIpc";
import { SpdLogService } from "vs/platform/log/node/spdlogService";
@ -23,7 +36,12 @@ import { IProductConfiguration } from "vs/platform/product/common/product";
import product from "vs/platform/product/node/product";
import { ConnectionType, ConnectionTypeRequest } from "vs/platform/remote/common/remoteAgentConnection";
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from "vs/platform/remote/common/remoteAgentFileSystemChannel";
import { IRequestService } from "vs/platform/request/node/request";
import { RequestService } from "vs/platform/request/node/requestService";
import { ITelemetryService } from "vs/platform/telemetry/common/telemetry";
import { NullTelemetryService } from "vs/platform/telemetry/common/telemetryUtils";
import { RemoteExtensionLogFileName } from "vs/workbench/services/remote/common/remoteAgentService";
// import { TelemetryService } from "vs/workbench/services/telemetry/electron-browser/telemetryService";
import { IWorkbenchConstructionOptions } from "vs/workbench/workbench.web.api";
import { Connection, ManagementConnection, ExtensionHostConnection } from "vs/server/connection";
@ -141,28 +159,35 @@ export class MainServer extends Server {
});
const environmentService = new EnvironmentService(args, process.execPath);
this.services.set(IEnvironmentService, environmentService);
const logService = new SpdLogService(
RemoteExtensionLogFileName,
environmentService.logsPath,
getLogLevel(environmentService),
);
this.services.set(ILogService, logService);
const logService = new SpdLogService(RemoteExtensionLogFileName, environmentService.logsPath, getLogLevel(environmentService));
this.ipc.registerChannel("loglevel", new LogLevelSetterChannel(logService));
const router = new StaticRouter((context: any) => {
console.log("static router", context);
return context.clientId === "renderer";
});
this.services.set(ILogService, logService);
this.services.set(IEnvironmentService, environmentService);
this.services.set(IConfigurationService, new SyncDescriptor(ConfigurationService, [environmentService.machineSettingsResource]));
this.services.set(IRequestService, new SyncDescriptor(RequestService));
this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
this.services.set(ITelemetryService, NullTelemetryService); // TODO: telemetry
this.services.set(IDialogService, new DialogChannelClient(this.ipc.getChannel("dialog", router)));
this.services.set(IDownloadService, new DownloadServiceChannelClient(this.ipc.getChannel("download", router), () => getUriTransformer("renderer")));
this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
const instantiationService = new InstantiationService(this.services);
this.services.set(ILocalizationsService, instantiationService.createInstance(LocalizationsService));
instantiationService.invokeFunction(() => {
instantiationService.createInstance(LogsDataCleaner);
this.ipc.registerChannel(
REMOTE_FILE_SYSTEM_CHANNEL_NAME,
new FileProviderChannel(logService),
);
this.ipc.registerChannel(
"remoteextensionsenvironment",
new ExtensionEnvironmentChannel(environmentService, logService),
);
this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(logService));
this.ipc.registerChannel("remoteextensionsenvironment", new ExtensionEnvironmentChannel(environmentService, logService));
const extensionsService = this.services.get(IExtensionManagementService) as IExtensionManagementService;
const extensionsChannel = new ExtensionManagementChannel(extensionsService, (context) => getUriTransformer(context.remoteAuthority));
this.ipc.registerChannel("extensions", extensionsChannel);
});
}