mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 01:25:38 -05:00
Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -51,7 +51,7 @@ export const enum UpdateType {
|
||||
|
||||
export type Uninitialized = { type: StateType.Uninitialized };
|
||||
export type Idle = { type: StateType.Idle, updateType: UpdateType, error?: string };
|
||||
export type CheckingForUpdates = { type: StateType.CheckingForUpdates, context: any };
|
||||
export type CheckingForUpdates = { type: StateType.CheckingForUpdates, explicit: boolean };
|
||||
export type AvailableForDownload = { type: StateType.AvailableForDownload, update: IUpdate };
|
||||
export type Downloading = { type: StateType.Downloading, update: IUpdate };
|
||||
export type Downloaded = { type: StateType.Downloaded, update: IUpdate };
|
||||
@@ -63,7 +63,7 @@ export type State = Uninitialized | Idle | CheckingForUpdates | AvailableForDown
|
||||
export const State = {
|
||||
Uninitialized: { type: StateType.Uninitialized } as Uninitialized,
|
||||
Idle: (updateType: UpdateType, error?: string) => ({ type: StateType.Idle, updateType, error }) as Idle,
|
||||
CheckingForUpdates: (context: any) => ({ type: StateType.CheckingForUpdates, context } as CheckingForUpdates),
|
||||
CheckingForUpdates: (explicit: boolean) => ({ type: StateType.CheckingForUpdates, explicit } as CheckingForUpdates),
|
||||
AvailableForDownload: (update: IUpdate) => ({ type: StateType.AvailableForDownload, update } as AvailableForDownload),
|
||||
Downloading: (update: IUpdate) => ({ type: StateType.Downloading, update } as Downloading),
|
||||
Downloaded: (update: IUpdate) => ({ type: StateType.Downloaded, update } as Downloaded),
|
||||
@@ -86,7 +86,7 @@ export interface IUpdateService {
|
||||
readonly onStateChange: Event<State>;
|
||||
readonly state: State;
|
||||
|
||||
checkForUpdates(context: any): Promise<void>;
|
||||
checkForUpdates(explicit: boolean): Promise<void>;
|
||||
downloadUpdate(): Promise<void>;
|
||||
applyUpdate(): Promise<void>;
|
||||
quitAndInstall(): Promise<void>;
|
||||
|
||||
74
src/vs/platform/update/common/updateIpc.ts
Normal file
74
src/vs/platform/update/common/updateIpc.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IUpdateService, State } from 'vs/platform/update/common/update';
|
||||
|
||||
export class UpdateChannel implements IServerChannel {
|
||||
|
||||
constructor(private service: IUpdateService) { }
|
||||
|
||||
listen(_: unknown, event: string): Event<any> {
|
||||
switch (event) {
|
||||
case 'onStateChange': return this.service.onStateChange;
|
||||
}
|
||||
|
||||
throw new Error(`Event not found: ${event}`);
|
||||
}
|
||||
|
||||
call(_: unknown, command: string, arg?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'checkForUpdates': return this.service.checkForUpdates(arg);
|
||||
case 'downloadUpdate': return this.service.downloadUpdate();
|
||||
case 'applyUpdate': return this.service.applyUpdate();
|
||||
case 'quitAndInstall': return this.service.quitAndInstall();
|
||||
case '_getInitialState': return Promise.resolve(this.service.state);
|
||||
case 'isLatestVersion': return this.service.isLatestVersion();
|
||||
}
|
||||
|
||||
throw new Error(`Call not found: ${command}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class UpdateChannelClient implements IUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly _onStateChange = new Emitter<State>();
|
||||
readonly onStateChange: Event<State> = this._onStateChange.event;
|
||||
|
||||
private _state: State = State.Uninitialized;
|
||||
get state(): State { return this._state; }
|
||||
set state(state: State) {
|
||||
this._state = state;
|
||||
this._onStateChange.fire(state);
|
||||
}
|
||||
|
||||
constructor(private readonly channel: IChannel) {
|
||||
this.channel.listen<State>('onStateChange')(state => this.state = state);
|
||||
this.channel.call<State>('_getInitialState').then(state => this.state = state);
|
||||
}
|
||||
|
||||
checkForUpdates(explicit: boolean): Promise<void> {
|
||||
return this.channel.call('checkForUpdates', explicit);
|
||||
}
|
||||
|
||||
downloadUpdate(): Promise<void> {
|
||||
return this.channel.call('downloadUpdate');
|
||||
}
|
||||
|
||||
applyUpdate(): Promise<void> {
|
||||
return this.channel.call('applyUpdate');
|
||||
}
|
||||
|
||||
quitAndInstall(): Promise<void> {
|
||||
return this.channel.call('quitAndInstall');
|
||||
}
|
||||
|
||||
isLatestVersion(): Promise<boolean> {
|
||||
return this.channel.call('isLatestVersion');
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,15 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { IConfigurationService, getMigratedSettingValue } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IUpdateService, State, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IRequestService } from 'vs/platform/request/common/request';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export function createUpdateURL(platform: string, quality: string): string {
|
||||
return `${product.updateUrl}/api/update/${platform}/${quality}/${product.commit}`;
|
||||
export function createUpdateURL(platform: string, quality: string, productService: IProductService): string {
|
||||
return `${productService.updateUrl}/api/update/${platform}/${quality}/${productService.commit}`;
|
||||
}
|
||||
|
||||
export type UpdateNotAvailableClassification = {
|
||||
@@ -46,9 +46,10 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
constructor(
|
||||
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
|
||||
@IConfigurationService protected configurationService: IConfigurationService,
|
||||
@IEnvironmentMainService private readonly environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@IRequestService protected requestService: IRequestService,
|
||||
@ILogService protected logService: ILogService,
|
||||
@IProductService protected readonly productService: IProductService
|
||||
) { }
|
||||
|
||||
/**
|
||||
@@ -57,16 +58,16 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
* https://github.com/microsoft/vscode/issues/89784
|
||||
*/
|
||||
initialize(): void {
|
||||
if (!this.environmentService.isBuilt) {
|
||||
if (!this.environmentMainService.isBuilt) {
|
||||
return; // updates are never enabled when running out of sources
|
||||
}
|
||||
|
||||
if (this.environmentService.disableUpdates) {
|
||||
if (this.environmentMainService.disableUpdates) {
|
||||
this.logService.info('update#ctor - updates are disabled by the environment');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!product.updateUrl || !product.commit) {
|
||||
if (!this.productService.updateUrl || !this.productService.commit) {
|
||||
this.logService.info('update#ctor - updates are disabled as there is no update URL');
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +97,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
this.logService.info('update#ctor - startup checks only; automatic updates are disabled by user preference');
|
||||
|
||||
// Check for updates only once after 30 seconds
|
||||
setTimeout(() => this.checkForUpdates(null), 30 * 1000);
|
||||
setTimeout(() => this.checkForUpdates(false), 30 * 1000);
|
||||
} else {
|
||||
// Start checking for updates after 30 seconds
|
||||
this.scheduleCheckForUpdates(30 * 1000).then(undefined, err => this.logService.error(err));
|
||||
@@ -104,26 +105,26 @@ export abstract class AbstractUpdateService implements IUpdateService {
|
||||
}
|
||||
|
||||
private getProductQuality(updateMode: string): string | undefined {
|
||||
return updateMode === 'none' ? undefined : product.quality;
|
||||
return updateMode === 'none' ? undefined : this.productService.quality;
|
||||
}
|
||||
|
||||
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
|
||||
return timeout(delay)
|
||||
.then(() => this.checkForUpdates(null))
|
||||
.then(() => this.checkForUpdates(false))
|
||||
.then(() => {
|
||||
// Check again after 1 hour
|
||||
return this.scheduleCheckForUpdates(60 * 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
async checkForUpdates(context: any): Promise<void> {
|
||||
async checkForUpdates(explicit: boolean): Promise<void> {
|
||||
this.logService.trace('update#checkForUpdates, state = ', this.state.type);
|
||||
|
||||
if (this.state.type !== StateType.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.doCheckForUpdates(context);
|
||||
this.doCheckForUpdates(explicit);
|
||||
}
|
||||
|
||||
async downloadUpdate(): Promise<void> {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
|
||||
export class UpdateChannel implements IServerChannel {
|
||||
|
||||
constructor(private service: IUpdateService) { }
|
||||
|
||||
listen(_: unknown, event: string): Event<any> {
|
||||
switch (event) {
|
||||
case 'onStateChange': return this.service.onStateChange;
|
||||
}
|
||||
|
||||
throw new Error(`Event not found: ${event}`);
|
||||
}
|
||||
|
||||
call(_: unknown, command: string, arg?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'checkForUpdates': return this.service.checkForUpdates(arg);
|
||||
case 'downloadUpdate': return this.service.downloadUpdate();
|
||||
case 'applyUpdate': return this.service.applyUpdate();
|
||||
case 'quitAndInstall': return this.service.quitAndInstall();
|
||||
case '_getInitialState': return Promise.resolve(this.service.state);
|
||||
case 'isLatestVersion': return this.service.isLatestVersion();
|
||||
}
|
||||
|
||||
throw new Error(`Call not found: ${command}`);
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,10 @@ import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/e
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { AbstractUpdateService, createUpdateURL, UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
import { IRequestService } from 'vs/platform/request/common/request';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
export class DarwinUpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly disposables = new DisposableStore();
|
||||
|
||||
@memoize private get onRawError(): Event<string> { return Event.fromNodeEventEmitter(electron.autoUpdater, 'error', (_, message) => message); }
|
||||
@@ -32,14 +30,15 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IEnvironmentMainService environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
|
||||
@IRequestService requestService: IRequestService,
|
||||
@ILogService logService: ILogService
|
||||
@ILogService logService: ILogService,
|
||||
@IProductService productService: IProductService
|
||||
) {
|
||||
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
|
||||
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService, productService);
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
override initialize(): void {
|
||||
super.initialize();
|
||||
this.onRawError(this.onError, this, this.disposables);
|
||||
this.onRawUpdateAvailable(this.onUpdateAvailable, this, this.disposables);
|
||||
@@ -51,19 +50,19 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
this.logService.error('UpdateService error:', err);
|
||||
|
||||
// only show message when explicitly checking for updates
|
||||
const shouldShowMessage = this.state.type === StateType.CheckingForUpdates ? !!this.state.context : true;
|
||||
const shouldShowMessage = this.state.type === StateType.CheckingForUpdates ? this.state.explicit : true;
|
||||
const message: string | undefined = shouldShowMessage ? err : undefined;
|
||||
this.setState(State.Idle(UpdateType.Archive, message));
|
||||
}
|
||||
|
||||
protected buildUpdateFeedUrl(quality: string): string | undefined {
|
||||
let assetID: string;
|
||||
if (!product.darwinUniversalAssetId) {
|
||||
if (!this.productService.darwinUniversalAssetId) {
|
||||
assetID = process.arch === 'x64' ? 'darwin' : 'darwin-arm64';
|
||||
} else {
|
||||
assetID = product.darwinUniversalAssetId;
|
||||
assetID = this.productService.darwinUniversalAssetId;
|
||||
}
|
||||
const url = createUpdateURL(assetID, quality);
|
||||
const url = createUpdateURL(assetID, quality, this.productService);
|
||||
try {
|
||||
electron.autoUpdater.setFeedURL({ url });
|
||||
} catch (e) {
|
||||
@@ -104,12 +103,12 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
||||
if (this.state.type !== StateType.CheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!this.state.context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: this.state.explicit });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Archive));
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
|
||||
electron.autoUpdater.quitAndInstall();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { State, IUpdate, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update';
|
||||
@@ -17,22 +17,21 @@ import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeH
|
||||
|
||||
export class LinuxUpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IEnvironmentMainService environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
|
||||
@IRequestService requestService: IRequestService,
|
||||
@ILogService logService: ILogService,
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||
@IProductService productService: IProductService
|
||||
) {
|
||||
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
|
||||
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService, productService);
|
||||
}
|
||||
|
||||
protected buildUpdateFeedUrl(quality: string): string {
|
||||
return createUpdateURL(`linux-${process.arch}`, quality);
|
||||
return createUpdateURL(`linux-${process.arch}`, quality, this.productService);
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
@@ -61,11 +60,11 @@ export class LinuxUpdateService extends AbstractUpdateService {
|
||||
});
|
||||
}
|
||||
|
||||
protected async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
protected override async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
// Use the download URL if available as we don't currently detect the package type that was
|
||||
// installed and the website download page is more useful than the tarball generally.
|
||||
if (product.downloadUrl && product.downloadUrl.length > 0) {
|
||||
this.nativeHostMainService.openExternal(undefined, product.downloadUrl);
|
||||
if (this.productService.downloadUrl && this.productService.downloadUrl.length > 0) {
|
||||
this.nativeHostMainService.openExternal(undefined, this.productService.downloadUrl);
|
||||
} else if (state.update.url) {
|
||||
this.nativeHostMainService.openExternal(undefined, state.update.url);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { spawn } from 'child_process';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { UpdateNotAvailableClassification } from 'vs/platform/update/electron-main/abstractUpdateService';
|
||||
|
||||
abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
abstract class AbstractUpdateService implements IUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
@@ -36,10 +36,10 @@ abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
|
||||
constructor(
|
||||
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
|
||||
@IEnvironmentMainService environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
|
||||
@ILogService protected logService: ILogService,
|
||||
) {
|
||||
if (environmentService.disableUpdates) {
|
||||
if (environmentMainService.disableUpdates) {
|
||||
this.logService.info('update#ctor - updates are disabled');
|
||||
return;
|
||||
}
|
||||
@@ -52,21 +52,21 @@ abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
|
||||
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
|
||||
return timeout(delay)
|
||||
.then(() => this.checkForUpdates(null))
|
||||
.then(() => this.checkForUpdates(false))
|
||||
.then(() => {
|
||||
// Check again after 1 hour
|
||||
return this.scheduleCheckForUpdates(60 * 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
async checkForUpdates(context: any): Promise<void> {
|
||||
async checkForUpdates(explicit: boolean): Promise<void> {
|
||||
this.logService.trace('update#checkForUpdates, state = ', this.state.type);
|
||||
|
||||
if (this.state.type !== StateType.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.doCheckForUpdates(context);
|
||||
this.doCheckForUpdates(explicit);
|
||||
}
|
||||
|
||||
async downloadUpdate(): Promise<void> {
|
||||
@@ -132,25 +132,23 @@ abstract class AbstractUpdateService2 implements IUpdateService {
|
||||
protected abstract doCheckForUpdates(context: any): void;
|
||||
}
|
||||
|
||||
export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
export class SnapUpdateService extends AbstractUpdateService {
|
||||
|
||||
constructor(
|
||||
private snap: string,
|
||||
private snapRevision: string,
|
||||
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
|
||||
@IEnvironmentMainService environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
|
||||
@ILogService logService: ILogService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService
|
||||
) {
|
||||
super(lifecycleMainService, environmentService, logService);
|
||||
super(lifecycleMainService, environmentMainService, logService);
|
||||
|
||||
const watcher = watch(path.dirname(this.snap));
|
||||
const onChange = Event.fromNodeEventEmitter(watcher, 'change', (_, fileName: string) => fileName);
|
||||
const onCurrentChange = Event.filter(onChange, n => n === 'current');
|
||||
const onDebouncedCurrentChange = Event.debounce(onCurrentChange, (_, e) => e, 2000);
|
||||
const listener = onDebouncedCurrentChange(this.checkForUpdates, this);
|
||||
const listener = onDebouncedCurrentChange(() => this.checkForUpdates(false));
|
||||
|
||||
lifecycleMainService.onWillShutdown(() => {
|
||||
listener.dispose();
|
||||
@@ -158,24 +156,24 @@ export class SnapUpdateService extends AbstractUpdateService2 {
|
||||
});
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
this.setState(State.CheckingForUpdates(context));
|
||||
protected doCheckForUpdates(): void {
|
||||
this.setState(State.CheckingForUpdates(false));
|
||||
this.isUpdateAvailable().then(result => {
|
||||
if (result) {
|
||||
this.setState(State.Ready({ version: 'something', productVersion: 'something' }));
|
||||
} else {
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: false });
|
||||
|
||||
this.setState(State.Idle(UpdateType.Snap));
|
||||
}
|
||||
}, err => {
|
||||
this.logService.error(err);
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: !!context });
|
||||
this.telemetryService.publicLog2<{ explicit: boolean }, UpdateNotAvailableClassification>('update:notAvailable', { explicit: false });
|
||||
this.setState(State.Idle(UpdateType.Snap, err.message || err));
|
||||
});
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
|
||||
|
||||
// Allow 3 seconds for VS Code to close
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as pfs from 'vs/base/node/pfs';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { State, IUpdate, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
@@ -49,13 +49,11 @@ function getUpdateType(): UpdateType {
|
||||
|
||||
export class Win32UpdateService extends AbstractUpdateService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private availableUpdate: IAvailableUpdate | undefined;
|
||||
|
||||
@memoize
|
||||
get cachePath(): Promise<string> {
|
||||
const result = path.join(tmpdir(), `sqlops-update-${product.target}-${process.arch}`);
|
||||
const result = path.join(tmpdir(), `sqlops-update-${this.productService.target}-${process.arch}`);
|
||||
return fs.promises.mkdir(result, { recursive: true }).then(() => result);
|
||||
}
|
||||
|
||||
@@ -63,16 +61,17 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
@ILifecycleMainService lifecycleMainService: ILifecycleMainService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IEnvironmentMainService environmentService: IEnvironmentMainService,
|
||||
@IEnvironmentMainService environmentMainService: IEnvironmentMainService,
|
||||
@IRequestService requestService: IRequestService,
|
||||
@ILogService logService: ILogService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||
@IProductService productService: IProductService
|
||||
) {
|
||||
super(lifecycleMainService, configurationService, environmentService, requestService, logService);
|
||||
super(lifecycleMainService, configurationService, environmentMainService, requestService, logService, productService);
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
override initialize(): void {
|
||||
super.initialize();
|
||||
|
||||
if (getUpdateType() === UpdateType.Setup) {
|
||||
@@ -86,7 +85,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
"target" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryService.publicLog('update:win32SetupTarget', { target: product.target });
|
||||
this.telemetryService.publicLog('update:win32SetupTarget', { target: this.productService.target });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +98,11 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
|
||||
if (getUpdateType() === UpdateType.Archive) {
|
||||
platform += '-archive';
|
||||
} else if (product.target === 'user') {
|
||||
} else if (this.productService.target === 'user') {
|
||||
platform += '-user';
|
||||
}
|
||||
|
||||
return createUpdateURL(platform, quality);
|
||||
return createUpdateURL(platform, quality, this.productService);
|
||||
}
|
||||
|
||||
protected doCheckForUpdates(context: any): void {
|
||||
@@ -155,7 +154,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
this.availableUpdate = { packagePath };
|
||||
|
||||
if (fastUpdatesEnabled && update.supportsFastUpdate) {
|
||||
if (product.target === 'user') {
|
||||
if (this.productService.target === 'user') {
|
||||
this.doApplyUpdate();
|
||||
} else {
|
||||
this.setState(State.Downloaded(update));
|
||||
@@ -176,7 +175,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
});
|
||||
}
|
||||
|
||||
protected async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
protected override async doDownloadUpdate(state: AvailableForDownload): Promise<void> {
|
||||
if (state.update.url) {
|
||||
this.nativeHostMainService.openExternal(undefined, state.update.url);
|
||||
}
|
||||
@@ -185,12 +184,11 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
|
||||
private async getUpdatePackagePath(version: string): Promise<string> {
|
||||
const cachePath = await this.cachePath;
|
||||
// {{SQL CARBON EDIT}}
|
||||
return path.join(cachePath, `AzureDataStudioSetup-${product.quality}-${version}.exe`);
|
||||
return path.join(cachePath, `AzureDataStudioSetup-${this.productService.quality}-${version}.exe`); // {{SQL CARBON EDIT}}
|
||||
}
|
||||
|
||||
private async cleanup(exceptVersion: string | null = null): Promise<any> {
|
||||
const filter = exceptVersion ? (one: string) => !(new RegExp(`${product.quality}-${exceptVersion}\\.exe$`).test(one)) : () => true;
|
||||
const filter = exceptVersion ? (one: string) => !(new RegExp(`${this.productService.quality}-${exceptVersion}\\.exe$`).test(one)) : () => true;
|
||||
|
||||
const cachePath = await this.cachePath;
|
||||
const versions = await pfs.readdir(cachePath);
|
||||
@@ -206,7 +204,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
protected async doApplyUpdate(): Promise<void> {
|
||||
protected override async doApplyUpdate(): Promise<void> {
|
||||
if (this.state.type !== StateType.Downloaded && this.state.type !== StateType.Downloading) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -220,7 +218,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
|
||||
const cachePath = await this.cachePath;
|
||||
|
||||
this.availableUpdate.updateFilePath = path.join(cachePath, `CodeSetup-${product.quality}-${update.version}.flag`);
|
||||
this.availableUpdate.updateFilePath = path.join(cachePath, `CodeSetup-${this.productService.quality}-${update.version}.flag`);
|
||||
|
||||
await pfs.writeFile(this.availableUpdate.updateFilePath, 'flag');
|
||||
const child = spawn(this.availableUpdate.packagePath, ['/verysilent', `/update="${this.availableUpdate.updateFilePath}"`, '/nocloseapplications', '/mergetasks=runcode,!desktopicon,!quicklaunchicon'], {
|
||||
@@ -234,7 +232,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
this.setState(State.Idle(getUpdateType()));
|
||||
});
|
||||
|
||||
const readyMutexName = `${product.win32MutexName}-ready`;
|
||||
const readyMutexName = `${this.productService.win32MutexName}-ready`;
|
||||
const mutex = await import('windows-mutex');
|
||||
|
||||
// poll for mutex-ready
|
||||
@@ -242,7 +240,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
.then(() => this.setState(State.Ready(update)));
|
||||
}
|
||||
|
||||
protected doQuitAndInstall(): void {
|
||||
protected override doQuitAndInstall(): void {
|
||||
if (this.state.type !== StateType.Ready || !this.availableUpdate) {
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +257,7 @@ export class Win32UpdateService extends AbstractUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
protected getUpdateType(): UpdateType {
|
||||
protected override getUpdateType(): UpdateType {
|
||||
return getUpdateType();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user