-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3871 Extract 'Hosted mode' in separate extension
Signed-off-by: Yevhen Vydolob <[email protected]>
- Loading branch information
Showing
37 changed files
with
542 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Theia - Plugin Development | ||
|
||
See [here](https://www.theia-ide.org/doc/index.html) for a detailed documentation. | ||
|
||
## Contribution points: | ||
- Hosted Instance uri post processor | ||
|
||
## License | ||
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/) | ||
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../configs/base.tsconfig", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"lib": [ | ||
"es6", | ||
"dom" | ||
] | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "@theia/plugin-dev", | ||
"version": "0.7.0", | ||
"description": "Theia - Plugin Development Extension", | ||
"main": "lib/common/index.js", | ||
"typings": "lib/common/index.d.ts", | ||
"dependencies": { | ||
"@theia/core": "^0.7.0", | ||
"@theia/plugin-ext": "^0.7.0", | ||
"@theia/preferences": "^0.7.0", | ||
"ps-tree": "1.1.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"backend": "lib/node/plugin-dev-backend-module", | ||
"backendElectron": "lib/node-electron/plugin-dev-electron-backend-module", | ||
"frontend": "lib/browser/plugin-dev-frontend-module" | ||
} | ||
], | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/theia-ide/theia.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/theia-ide/theia/issues" | ||
}, | ||
"homepage": "https://github.com/theia-ide/theia", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"prepare": "yarn run clean && yarn run build", | ||
"clean": "theiaext clean", | ||
"build": "theiaext build", | ||
"watch": "theiaext watch", | ||
"test": "theiaext test" | ||
}, | ||
"devDependencies": { | ||
"@theia/ext-scripts": "^0.7.0" | ||
}, | ||
"nyc": { | ||
"extends": "../../configs/nyc.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/plugin-dev/src/browser/hosted-plugin-frontend-contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { injectable, inject } from 'inversify'; | ||
import { CommandRegistry, CommandContribution } from '@theia/core/lib/common'; | ||
import { HostedPluginManagerClient, HostedPluginCommands } from './hosted-plugin-manager-client'; | ||
|
||
@injectable() | ||
export class HostedPluginFrontendContribution implements CommandContribution { | ||
|
||
@inject(HostedPluginManagerClient) | ||
protected readonly hostedPluginManagerClient: HostedPluginManagerClient; | ||
|
||
registerCommands(commands: CommandRegistry): void { | ||
commands.registerCommand(HostedPluginCommands.START, { | ||
execute: () => this.hostedPluginManagerClient.start() | ||
}); | ||
commands.registerCommand(HostedPluginCommands.DEBUG, { | ||
execute: () => this.hostedPluginManagerClient.debug() | ||
}); | ||
commands.registerCommand(HostedPluginCommands.STOP, { | ||
execute: () => this.hostedPluginManagerClient.stop() | ||
}); | ||
commands.registerCommand(HostedPluginCommands.RESTART, { | ||
execute: () => this.hostedPluginManagerClient.restart() | ||
}); | ||
commands.registerCommand(HostedPluginCommands.SELECT_PATH, { | ||
execute: () => this.hostedPluginManagerClient.selectPluginPath() | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
packages/plugin-dev/src/browser/plugin-dev-frontend-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { HostedPluginLogViewer } from './hosted-plugin-log-viewer'; | ||
import { HostedPluginManagerClient } from './hosted-plugin-manager-client'; | ||
import { HostedPluginInformer } from './hosted-plugin-informer'; | ||
import { bindHostedPluginPreferences } from './hosted-plugin-preferences'; | ||
import { HostedPluginController } from './hosted-plugin-controller'; | ||
import { ContainerModule } from 'inversify'; | ||
import { FrontendApplicationContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser'; | ||
import { HostedPluginFrontendContribution } from './hosted-plugin-frontend-contribution'; | ||
import { CommandContribution } from '@theia/core/lib/common/command'; | ||
import { HostedPluginServer, hostedServicePath } from '../common/plugin-dev-protocol'; | ||
import { HostedPluginWatcher } from '@theia/plugin-ext/lib/hosted/browser/hosted-plugin-watcher'; | ||
|
||
export default new ContainerModule((bind, unbind, isBound, rebind) => { | ||
bindHostedPluginPreferences(bind); | ||
bind(HostedPluginLogViewer).toSelf().inSingletonScope(); | ||
bind(HostedPluginManagerClient).toSelf().inSingletonScope(); | ||
|
||
bind(FrontendApplicationContribution).to(HostedPluginInformer).inSingletonScope(); | ||
bind(FrontendApplicationContribution).to(HostedPluginController).inSingletonScope(); | ||
|
||
bind(HostedPluginFrontendContribution).toSelf().inSingletonScope(); | ||
bind(CommandContribution).toService(HostedPluginFrontendContribution); | ||
|
||
bind(HostedPluginServer).toDynamicValue(ctx => { | ||
const connection = ctx.container.get(WebSocketConnectionProvider); | ||
const hostedWatcher = ctx.container.get(HostedPluginWatcher); | ||
return connection.createProxy<HostedPluginServer>(hostedServicePath, hostedWatcher.getHostedPluginClient()); | ||
}).inSingletonScope(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
// Exports contribution point for uri postprocessor of hosted plugin manager. | ||
// This could be used to alter hosted instance uri, for example, change port. | ||
export * from '../node/hosted-plugin-uri-postprocessor'; | ||
|
||
export * from './plugin-dev-protocol'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { JsonRpcServer } from '@theia/core/lib/common/messaging/proxy-factory'; | ||
import { PluginMetadata } from '@theia/plugin-ext/lib/common/plugin-protocol'; | ||
|
||
export const hostedServicePath = '/services/plugin-dev'; | ||
export const HostedPluginServer = Symbol('HostedPluginServer'); | ||
export interface HostedPluginServer extends JsonRpcServer<HostedPluginClient> { | ||
getHostedPlugin(): Promise<PluginMetadata | undefined>; | ||
runHostedPluginInstance(uri: string): Promise<string>; | ||
runDebugHostedPluginInstance(uri: string, debugConfig: DebugConfiguration): Promise<string>; | ||
terminateHostedPluginInstance(): Promise<void>; | ||
isHostedPluginInstanceRunning(): Promise<boolean>; | ||
getHostedPluginInstanceURI(): Promise<string>; | ||
getHostedPluginURI(): Promise<string>; | ||
|
||
runWatchCompilation(uri: string): Promise<void>; | ||
stopWatchCompilation(uri: string): Promise<void>; | ||
isWatchCompilationRunning(uri: string): Promise<boolean>; | ||
|
||
isPluginValid(uri: string): Promise<boolean>; | ||
} | ||
|
||
export interface HostedPluginClient { | ||
} | ||
|
||
export interface DebugConfiguration { | ||
port?: number; | ||
debugMode?: string; | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/plugin-dev/src/node-electron/plugin-dev-electron-backend-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { HostedInstanceManager, ElectronNodeHostedPluginRunner } from '../node/hosted-instance-manager'; | ||
import { ContainerModule } from 'inversify'; | ||
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module'; | ||
import { bindCommonHostedBackend } from '../node/plugin-dev-backend-module'; | ||
|
||
const hostedBackendConnectionModule = ConnectionContainerModule.create(({ bind }) => { | ||
bind(HostedInstanceManager).to(ElectronNodeHostedPluginRunner); | ||
}); | ||
|
||
export default new ContainerModule(bind => { | ||
bindCommonHostedBackend(bind); | ||
bind(ConnectionContainerModule).toConstantValue(hostedBackendConnectionModule); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.