-
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.
Support plugin copying for remote feature
- Loading branch information
Showing
28 changed files
with
313 additions
and
62 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
File renamed without changes.
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,34 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 TypeFox 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-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import type { OS } from '../../common/os'; | ||
import type { MaybePromise } from '../../common/types'; | ||
|
||
export interface RemotePlatform { | ||
os: OS.Type | ||
arch: string | ||
} | ||
|
||
export interface RemoteCliContext { | ||
platform: RemotePlatform; | ||
directory: string; | ||
} | ||
|
||
export const RemoteCliContribution = Symbol('RemoteCliContribution'); | ||
|
||
export interface RemoteCliContribution { | ||
enhanceArgs(context: RemoteCliContext): MaybePromise<string[]>; | ||
} |
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) 2024 TypeFox 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-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { MaybePromise } from '../../common/types'; | ||
|
||
export const RemoteCopyContribution = Symbol('RemoteCopyContribution'); | ||
|
||
export interface RemoteCopyContribution { | ||
copy(registry: RemoteCopyRegistry): MaybePromise<void> | ||
} | ||
|
||
export interface RemoteCopyOptions { | ||
/** | ||
* The mode that the file should be set to once copied to the remote. | ||
* | ||
* Only relevant for POSIX-like systems | ||
*/ | ||
mode?: number; | ||
} | ||
|
||
export interface RemoteFile { | ||
path: string | ||
target: string | ||
options?: RemoteCopyOptions; | ||
} | ||
|
||
export interface RemoteCopyRegistry { | ||
getFiles(): RemoteFile[]; | ||
glob(pattern: string, target?: string): Promise<void>; | ||
file(file: string, target?: string, options?: RemoteCopyOptions): void; | ||
directory(dir: string, target?: string): Promise<void>; | ||
} |
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
36 changes: 36 additions & 0 deletions
36
packages/plugin-ext/src/main/node/plugin-remote-cli-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,36 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 TypeFox 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-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { MaybePromise } from '@theia/core'; | ||
import { RemoteCliContext, RemoteCliContribution } from '@theia/core/lib/node/remote/remote-cli-contribution'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { PluginCliContribution } from './plugin-cli-contribution'; | ||
|
||
@injectable() | ||
export class PluginRemoteCliContribution implements RemoteCliContribution { | ||
|
||
@inject(PluginCliContribution) | ||
protected readonly pluginCliContribution: PluginCliContribution; | ||
|
||
enhanceArgs(context: RemoteCliContext): MaybePromise<string[]> { | ||
const pluginsFolder = this.pluginCliContribution.localDir(); | ||
if (!pluginsFolder) { | ||
return []; | ||
} else { | ||
return ['--plugins=local-dir:./plugins']; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
packages/plugin-ext/src/main/node/plugin-remote-copy-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,36 @@ | ||
// ***************************************************************************** | ||
// Copyright (C) 2024 TypeFox 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-only WITH Classpath-exception-2.0 | ||
// ***************************************************************************** | ||
|
||
import { RemoteCopyContribution, RemoteCopyRegistry } from '@theia/core/lib/node/remote/remote-copy-contribution'; | ||
import { inject, injectable } from '@theia/core/shared/inversify'; | ||
import { PluginCliContribution } from './plugin-cli-contribution'; | ||
import { FileUri } from '@theia/core/lib/common/file-uri'; | ||
|
||
@injectable() | ||
export class PluginRemoteCopyContribution implements RemoteCopyContribution { | ||
|
||
@inject(PluginCliContribution) | ||
protected readonly pluginCliContribution: PluginCliContribution; | ||
|
||
async copy(registry: RemoteCopyRegistry): Promise<void> { | ||
const localDir = this.pluginCliContribution.localDir(); | ||
if (localDir) { | ||
const fsPath = FileUri.fsPath(localDir); | ||
await registry.directory(fsPath, 'plugins'); | ||
} | ||
|
||
} | ||
} |
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
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
Oops, something went wrong.