diff --git a/README.md b/README.md index 69f7d67b01aa0b40ae9f20e619576002eac6ee7c..770d8c10e33f1268b07b80643ada06182025ac7e 100644 --- a/README.md +++ b/README.md @@ -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`). diff --git a/channel.ts b/channel.ts index 5ae9f22fc74ebccbb8990a7f093bea5b8fe50341..eb50a340c926b5153fffd0d4d7ef7f80900c677d 100644 --- a/channel.ts +++ b/channel.ts @@ -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(); @@ -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 { return this.provider.stat(URI.from(resource)); } diff --git a/scripts/tasks.bash b/scripts/tasks.bash index e96c413f975ae229e535d787533ecb9cc072d0c2..84b285c905a604b3d64c5a43ccb35a3d36ee2c06 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -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. diff --git a/server.ts b/server.ts index cc5d2a092ea46e133886831783ee16de71c69007..d8e869854efa4b1e4be23cda19f795c3f452a5c0 100644 --- a/server.ts +++ b/server.ts @@ -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.ipc.registerChannel("loglevel", new LogLevelSetterChannel(logService)); - const logService = new SpdLogService( - RemoteExtensionLogFileName, - environmentService.logsPath, - getLogLevel(environmentService), - ); - this.services.set(ILogService, logService); + const router = new StaticRouter((context: any) => { + console.log("static router", context); + return context.clientId === "renderer"; + }); - this.ipc.registerChannel("loglevel", new LogLevelSetterChannel(logService)); + 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); }); }