mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 01:25:38 -05:00
Native installers for azdata in auto deployment (#8285)
* code complete * minor fixes from self-review * installation searchaPaths and display logs fixes * revert inadvertent change * fixing installaton roott for debian and mac * Chaning from getos to linux-release-info with sync api usage for figuring out os distribution * adding file missed in previous commit * fixing indvertent compile error that creeped in * fix default install root for azli
This commit is contained in:
@@ -7,7 +7,7 @@ import * as path from 'path';
|
||||
import { SemVer, compare } from 'semver';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, ITool, OsType, ToolStatus, ToolType } from '../../interfaces';
|
||||
import { Command, ITool, OsDistribution, ToolStatus, ToolType } from '../../interfaces';
|
||||
import { getErrorMessage } from '../../utils';
|
||||
import { IPlatformService } from '../platformService';
|
||||
|
||||
@@ -44,7 +44,6 @@ export const messageByDependencyType: Map<dependencyType, string> = new Map<depe
|
||||
|
||||
export abstract class ToolBase implements ITool {
|
||||
constructor(private _platformService: IPlatformService) {
|
||||
this._osType = this._platformService.osType();
|
||||
}
|
||||
|
||||
abstract name: string;
|
||||
@@ -53,8 +52,8 @@ export abstract class ToolBase implements ITool {
|
||||
abstract type: ToolType;
|
||||
abstract homePage: string;
|
||||
abstract autoInstallSupported: boolean;
|
||||
protected abstract readonly allInstallationCommands: Map<OsType, Command[]>;
|
||||
protected readonly dependenciesByOsType: Map<OsType, dependencyType[]> = new Map<OsType, dependencyType[]>();
|
||||
protected abstract readonly allInstallationCommands: Map<OsDistribution, Command[]>;
|
||||
protected readonly dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>();
|
||||
|
||||
protected abstract getVersionFromOutput(output: string): SemVer | undefined;
|
||||
protected readonly _onDidUpdateData = new vscode.EventEmitter<ITool>();
|
||||
@@ -63,7 +62,7 @@ export abstract class ToolBase implements ITool {
|
||||
protected abstract readonly versionCommand: Command;
|
||||
|
||||
public get dependencyMessages(): string[] {
|
||||
return (this.dependenciesByOsType.get(this.osType) || []).map((msgType: dependencyType) => messageByDependencyType.get(msgType)!);
|
||||
return (this.dependenciesByOsType.get(this.osDistribution) || []).map((msgType: dependencyType) => messageByDependencyType.get(msgType)!);
|
||||
}
|
||||
|
||||
protected async getInstallationPath(): Promise<string | undefined> {
|
||||
@@ -125,8 +124,8 @@ export abstract class ToolBase implements ITool {
|
||||
return this._platformService.storagePath();
|
||||
}
|
||||
|
||||
public get osType(): OsType {
|
||||
return this._osType;
|
||||
public get osDistribution(): OsDistribution {
|
||||
return this._platformService.osDistribution();
|
||||
}
|
||||
|
||||
protected get version(): SemVer | undefined {
|
||||
@@ -152,7 +151,7 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
protected get installationCommands(): Command[] | undefined {
|
||||
return this.allInstallationCommands.get(this.osType);
|
||||
return this.allInstallationCommands.get(this.osDistribution);
|
||||
}
|
||||
|
||||
protected async getPip3InstallLocation(packageName: string): Promise<string> {
|
||||
@@ -272,10 +271,10 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
protected discoveryCommandString(toolBinary: string) {
|
||||
switch (this.osType) {
|
||||
case OsType.win32:
|
||||
switch (this.osDistribution) {
|
||||
case OsDistribution.win32:
|
||||
return `where.exe ${toolBinary}`;
|
||||
case OsType.darwin:
|
||||
case OsDistribution.darwin:
|
||||
return `command -v ${toolBinary}`;
|
||||
default:
|
||||
return `which ${toolBinary}`;
|
||||
@@ -304,7 +303,6 @@ export abstract class ToolBase implements ITool {
|
||||
}
|
||||
|
||||
private _status: ToolStatus = ToolStatus.NotInstalled;
|
||||
private _osType: OsType;
|
||||
private _version?: SemVer;
|
||||
private _statusDescription?: string;
|
||||
private _installationPath!: string;
|
||||
|
||||
Reference in New Issue
Block a user