|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +import * as jsonc from 'jsonc-parser'; |
| 4 | +import * as path from 'path'; |
| 5 | +import * as vscode from 'vscode'; |
| 6 | +import { ICodeDeployer, IExecuteAPI, IExternalAPI, IPreferencesAPI } from 'vscode-wpilibapi'; |
| 7 | +import { gradleRun, readFileAsync } from '../utilities'; |
| 8 | + |
| 9 | +class DeployCodeDeployer implements ICodeDeployer { |
| 10 | + private preferences: IPreferencesAPI; |
| 11 | + private executeApi: IExecuteAPI; |
| 12 | + |
| 13 | + constructor(externalApi: IExternalAPI) { |
| 14 | + this.preferences = externalApi.getPreferencesAPI(); |
| 15 | + this.executeApi = externalApi.getExecuteAPI(); |
| 16 | + } |
| 17 | + |
| 18 | + public async getIsCurrentlyValid(workspace: vscode.WorkspaceFolder): Promise<boolean> { |
| 19 | + const prefs = this.preferences.getPreferences(workspace); |
| 20 | + const currentLanguage = prefs.getCurrentLanguage(); |
| 21 | + return currentLanguage === 'none' || currentLanguage === 'java'; |
| 22 | + } |
| 23 | + |
| 24 | + public async runDeployer(teamNumber: number, workspace: vscode.WorkspaceFolder, |
| 25 | + _: vscode.Uri | undefined, ...args: string[]): Promise<boolean> { |
| 26 | + // TODO actaully deploy |
| 27 | + return false; |
| 28 | + } |
| 29 | + |
| 30 | + public getDisplayName(): string { |
| 31 | + return 'python'; |
| 32 | + } |
| 33 | + |
| 34 | + public getDescription(): string { |
| 35 | + return 'Python Deploy'; |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +export class DeployDebug { |
| 40 | + private deployDeployer: DeployCodeDeployer; |
| 41 | + |
| 42 | + constructor(externalApi: IExternalAPI) { |
| 43 | + const deployDebugApi = externalApi.getDeployDebugAPI(); |
| 44 | + deployDebugApi.addLanguageChoice('python'); |
| 45 | + |
| 46 | + //this.deployDebuger = new DebugCodeDeployer(externalApi); |
| 47 | + this.deployDeployer = new DeployCodeDeployer(externalApi); |
| 48 | + //this.simulator = new SimulateCodeDeployer(externalApi); |
| 49 | + |
| 50 | + deployDebugApi.registerCodeDeploy(this.deployDeployer); |
| 51 | + |
| 52 | + // if (allowDebug) { |
| 53 | + // deployDebugApi.registerCodeDebug(this.deployDebuger); |
| 54 | + // deployDebugApi.registerCodeSimulate(this.simulator); |
| 55 | + // } |
| 56 | + } |
| 57 | + |
| 58 | + public dispose() { |
| 59 | + // |
| 60 | + } |
| 61 | + } |
0 commit comments