Fix/use sqlops engine version (#1011)

* using sqlops as engine version instead of vscode
This commit is contained in:
Leila Lali
2018-03-28 11:30:44 -07:00
committed by GitHub
parent 2414f43757
commit b2a96bbe50
5 changed files with 21 additions and 10 deletions

View File

@@ -105,7 +105,8 @@ export interface IExtensionManifest {
name: string; name: string;
publisher: string; publisher: string;
version: string; version: string;
engines: { vscode: string }; // {{SQL CARBON EDIT}}
engines: { vscode: string; sqlops?: string };
displayName?: string; displayName?: string;
description?: string; description?: string;
main?: string; main?: string;

View File

@@ -263,8 +263,6 @@ function getVersionAsset(version: IRawGalleryExtensionVersion, type: string): IG
fallbackUri: `${version.fallbackAssetUri}/${type}` fallbackUri: `${version.fallbackAssetUri}/${type}`
}; };
} }
} }
function getDependencies(version: IRawGalleryExtensionVersion): string[] { function getDependencies(version: IRawGalleryExtensionVersion): string[] {
@@ -748,14 +746,17 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
return this.getAsset(asset, { headers }) return this.getAsset(asset, { headers })
.then(context => asJson<IExtensionManifest>(context)) .then(context => asJson<IExtensionManifest>(context))
.then(manifest => { .then(manifest => {
const engine = manifest.engines.vscode; if (manifest.engines && !manifest.engines.sqlops) {
manifest.engines.sqlops = '*';
}
const engine = manifest.engines.sqlops;
if (!this.isEngineValid(engine)) { if (!this.isEngineValid(engine)) {
return this.getLastValidExtensionVersionReccursively(extension, versions.slice(1)); return this.getLastValidExtensionVersionReccursively(extension, versions.slice(1));
} }
version.properties = version.properties || []; version.properties = version.properties || [];
version.properties.push({ key: PropertyType.Engine, value: manifest.engines.vscode }); version.properties.push({ key: PropertyType.Engine, value: manifest.engines.sqlops });
return version; return version;
}); });
} }

View File

@@ -23,6 +23,8 @@ export interface IExtensionDescription {
readonly activationEvents?: string[]; readonly activationEvents?: string[];
readonly engines: { readonly engines: {
vscode: string; vscode: string;
// {{SQL CARBON EDIT}}
sqlops?: string;
}; };
readonly main?: string; readonly main?: string;
readonly contributes?: { [point: string]: any; }; readonly contributes?: { [point: string]: any; };

View File

@@ -208,6 +208,8 @@ export interface IReducedExtensionDescription {
isBuiltin: boolean; isBuiltin: boolean;
engines: { engines: {
vscode: string; vscode: string;
// {{SQL CARBON EDIT}}
sqlops?: string;
}; };
main?: string; main?: string;
} }
@@ -219,7 +221,8 @@ export function isValidExtensionVersion(version: string, extensionDesc: IReduced
return true; return true;
} }
return isVersionValid(version, extensionDesc.engines.vscode, notices); // {{SQL CARBON EDIT}}
return (extensionDesc.engines.sqlops && extensionDesc.engines.sqlops === '*') || isVersionValid(version, extensionDesc.engines.sqlops, notices);
} }
export function isVersionValid(currentVersion: string, requestedVersion: string, notices: string[] = []): boolean { export function isVersionValid(currentVersion: string, requestedVersion: string, notices: string[] = []): boolean {
@@ -289,8 +292,8 @@ function baseIsValidExtensionDescription(extensionFolderPath: string, extensionD
notices.push(nls.localize('extensionDescription.engines', "property `{0}` is mandatory and must be of type `object`", 'engines')); notices.push(nls.localize('extensionDescription.engines', "property `{0}` is mandatory and must be of type `object`", 'engines'));
return false; return false;
} }
if (typeof extensionDescription.engines.vscode !== 'string') { if (typeof extensionDescription.engines.sqlops !== 'string') {
notices.push(nls.localize('extensionDescription.engines.vscode', "property `{0}` is mandatory and must be of type `string`", 'engines.vscode')); notices.push(nls.localize('extensionDescription.engines.sqlops', "property `{0}` is mandatory and must be of type `string`", 'engines.sqlops'));
return false; return false;
} }
if (typeof extensionDescription.extensionDependencies !== 'undefined') { if (typeof extensionDescription.extensionDependencies !== 'undefined') {

View File

@@ -58,6 +58,10 @@ class ExtensionManifestParser extends ExtensionManifestHandler {
if (manifest.__metadata) { if (manifest.__metadata) {
manifest.uuid = manifest.__metadata.id; manifest.uuid = manifest.__metadata.id;
} }
// {{SQL CARBON EDIT}}
if (manifest.engines && !manifest.engines.sqlops) {
manifest.engines.sqlops = '*';
}
delete manifest.__metadata; delete manifest.__metadata;
return manifest; return manifest;
} catch (e) { } catch (e) {