Skip to content

Commit

Permalink
#68410 disable updating builtin extensions in stable
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Apr 13, 2022
1 parent e3f21a1 commit 7e3c3e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ export class Extension implements IExtension {
if (!this.gallery || !this.local) {
return false;
}
// Do not allow updating system extensions in stable
if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
return false;
}
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
return false;
}
Expand Down Expand Up @@ -1057,8 +1061,8 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
// Skip if check updates only for builtin extensions and current extension is not builtin.
continue;
}
if (installed.isBuiltin && !installed.local?.identifier.uuid) {
// Skip if the builtin extension does not have Marketplace id
if (installed.isBuiltin && (!installed.local?.identifier.uuid || this.productService.quality !== 'stable')) {
// Skip if the builtin extension does not have Marketplace identifier or the current quality is not stable.
continue;
}
infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import { URI } from 'vs/base/common/uri';
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { generateUuid } from 'vs/base/common/uuid';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { IProductService } from 'vs/platform/product/common/productService';

suite('Extension Test', () => {

let instantiationService: TestInstantiationService;

setup(() => {
instantiationService = new TestInstantiationService();
instantiationService.stub(IProductService, <Partial<IProductService>>{ quality: 'insiders' });
});

test('extension is not outdated when there is no local and gallery', () => {
Expand Down Expand Up @@ -51,6 +53,12 @@ suite('Extension Test', () => {
assert.strictEqual(extension.outdated, true);
});

test('extension is not outdated when local is built in and older than gallery but product quality is stable', () => {
instantiationService.stub(IProductService, <Partial<IProductService>>{ quality: 'stable' });
const extension = instantiationService.createInstance(Extension, () => ExtensionState.Installed, undefined, aLocalExtension('somext', { version: '1.0.0' }, { type: ExtensionType.System }), aGalleryExtension('somext', { version: '1.0.1' }));
assert.strictEqual(extension.outdated, false);
});

test('extension is outdated when local and gallery are on same version but on different target platforms', () => {
const extension = instantiationService.createInstance(Extension, () => ExtensionState.Installed, undefined, aLocalExtension('somext', {}, { targetPlatform: TargetPlatform.WIN32_IA32 }), aGalleryExtension('somext', {}, { targetPlatform: TargetPlatform.WIN32_X64 }));
assert.strictEqual(extension.outdated, true);
Expand Down

0 comments on commit 7e3c3e6

Please sign in to comment.