build-version.patch 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js
  2. index 489d9cc..51db755 100644
  3. --- a/build/gulpfile.vscode.linux.js
  4. +++ b/build/gulpfile.vscode.linux.js
  5. @@ -83,7 +83,7 @@ function prepareDebPackage(arch) {
  6. const dependencies = debianDependenciesGenerator.getDependencies(binaryDir, product.applicationName, debArch, sysroot);
  7. gulp.src('resources/linux/debian/control.template', { base: '.' })
  8. .pipe(replace('@@NAME@@', product.applicationName))
  9. - .pipe(replace('@@VERSION@@', packageJson.version + '-' + linuxPackageRevision))
  10. + .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
  11. .pipe(replace('@@ARCHITECTURE@@', debArch))
  12. .pipe(replace('@@DEPENDS@@', dependencies.join(', ')))
  13. .pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', ')))
  14. @@ -188,8 +188,7 @@ function prepareRpmPackage(arch) {
  15. .pipe(replace('@@NAME@@', product.applicationName))
  16. .pipe(replace('@@NAME_LONG@@', product.nameLong))
  17. .pipe(replace('@@ICON@@', product.linuxIconName))
  18. - .pipe(replace('@@VERSION@@', packageJson.version))
  19. - .pipe(replace('@@RELEASE@@', linuxPackageRevision))
  20. + .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
  21. .pipe(replace('@@ARCHITECTURE@@', rpmArch))
  22. .pipe(replace('@@LICENSE@@', product.licenseName))
  23. .pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
  24. @@ -262,7 +261,7 @@ function prepareSnapPackage(arch) {
  25. const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' })
  26. .pipe(replace('@@NAME@@', product.applicationName))
  27. - .pipe(replace('@@VERSION@@', commit.substr(0, 8)))
  28. + .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
  29. // Possible run-on values https://snapcraft.io/docs/architectures
  30. .pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
  31. .pipe(rename('snap/snapcraft.yaml'));
  32. diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js
  33. index 4c1259c..0d41560 100644
  34. --- a/build/gulpfile.vscode.web.js
  35. +++ b/build/gulpfile.vscode.web.js
  36. @@ -28,7 +28,7 @@ const WEB_FOLDER = path.join(REPO_ROOT, 'remote', 'web');
  37. const commit = util.getVersion(REPO_ROOT);
  38. const quality = product.quality;
  39. -const version = (quality && quality !== 'stable') ? `${packageJson.version}-${quality}` : packageJson.version;
  40. +const version = (quality && quality !== 'stable') ? `${packageJson.version.replace('+', '.')}-${quality}` : packageJson.version.replace('+', '.');
  41. const vscodeWebResourceIncludes = [
  42. // Workbench
  43. diff --git a/build/gulpfile.vscode.win32.js b/build/gulpfile.vscode.win32.js
  44. index 81ba509..a445749 100644
  45. --- a/build/gulpfile.vscode.win32.js
  46. +++ b/build/gulpfile.vscode.win32.js
  47. @@ -91,8 +91,8 @@ function buildWin32Setup(arch, target) {
  48. NameLong: product.nameLong,
  49. NameShort: product.nameShort,
  50. DirName: product.win32DirName,
  51. - Version: pkg.version,
  52. - RawVersion: pkg.version.replace(/-\w+$/, ''),
  53. + Version: pkg.version.replace('+', '.'),
  54. + RawVersion: pkg.version.replace(/-\w+$/, '').replace('+', '.'),
  55. NameVersion: product.win32NameVersion + (target === 'user' ? ' (User)' : ''),
  56. ExeBasename: product.nameShort,
  57. RegValueName: product.win32RegValueName,
  58. diff --git a/resources/linux/rpm/code.spec.template b/resources/linux/rpm/code.spec.template
  59. index 00ddb6f..814c964 100644
  60. --- a/resources/linux/rpm/code.spec.template
  61. +++ b/resources/linux/rpm/code.spec.template
  62. @@ -1,6 +1,6 @@
  63. Name: @@NAME@@
  64. Version: @@VERSION@@
  65. -Release: @@RELEASE@@.el7
  66. +Release: el7
  67. Summary: Code editing. Redefined.
  68. Group: Development/Tools
  69. Vendor: Microsoft Corporation
  70. diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
  71. index 3515dea..c0aa528 100644
  72. --- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
  73. +++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
  74. @@ -23,7 +23,7 @@ import { IFileService } from 'vs/platform/files/common/files';
  75. import { ILogService } from 'vs/platform/log/common/log';
  76. import { IProductService } from 'vs/platform/product/common/productService';
  77. import { asJson, asTextOrError, IRequestService, isSuccess } from 'vs/platform/request/common/request';
  78. -import { resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace';
  79. +import { getCoreVersion, resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace';
  80. import { IStorageService } from 'vs/platform/storage/common/storage';
  81. import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
  82. @@ -988,7 +988,8 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
  83. return undefined;
  84. }
  85. - const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${version}/statType/${type === StatisticType.Install ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`);
  86. + const coreVersion = getCoreVersion(version);
  87. + const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${coreVersion}/statType/${type === StatisticType.Install ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${coreVersion}/stats?statType=${type}`);
  88. const Accept = isWeb ? 'api-version=6.1-preview.1' : '*/*;api-version=4.0-preview.1';
  89. const commonHeaders = await this.commonHeadersPromise;
  90. diff --git a/src/vs/platform/extensions/common/extensionValidator.ts b/src/vs/platform/extensions/common/extensionValidator.ts
  91. index 0a5e7d2..e453393 100644
  92. --- a/src/vs/platform/extensions/common/extensionValidator.ts
  93. +++ b/src/vs/platform/extensions/common/extensionValidator.ts
  94. @@ -9,6 +9,7 @@ import { URI } from 'vs/base/common/uri';
  95. import * as nls from 'vs/nls';
  96. import * as semver from 'vs/base/common/semver/semver';
  97. import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
  98. +import { getCoreVersion } from 'vs/platform/externalServices/common/marketplace';
  99. export interface IParsedVersion {
  100. hasCaret: boolean;
  101. @@ -371,7 +372,8 @@ function isVersionValid(currentVersion: string, date: ProductDate, requestedVers
  102. }
  103. }
  104. - if (!isValidVersion(currentVersion, date, desiredVersion)) {
  105. + const coreVersion = getCoreVersion(currentVersion);
  106. + if (!isValidVersion(coreVersion, date, desiredVersion)) {
  107. notices.push(nls.localize('versionMismatch', "Extension is not compatible with Code {0}. Extension requires: {1}.", currentVersion, requestedVersion));
  108. return false;
  109. }
  110. diff --git a/src/vs/platform/externalServices/common/marketplace.ts b/src/vs/platform/externalServices/common/marketplace.ts
  111. index 5923e1c..a1c9db8 100644
  112. --- a/src/vs/platform/externalServices/common/marketplace.ts
  113. +++ b/src/vs/platform/externalServices/common/marketplace.ts
  114. @@ -13,6 +13,10 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
  115. import { ITelemetryService, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
  116. import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
  117. +export function getCoreVersion(version: string): string {
  118. + return version.replace(/\.[0-9]+$/, '');
  119. +}
  120. +
  121. export async function resolveMarketplaceHeaders(version: string,
  122. productService: IProductService,
  123. environmentService: IEnvironmentService,
  124. @@ -20,9 +24,10 @@ export async function resolveMarketplaceHeaders(version: string,
  125. fileService: IFileService,
  126. storageService: IStorageService | undefined,
  127. telemetryService: ITelemetryService): Promise<IHeaders> {
  128. + const coreVersion = getCoreVersion(version);
  129. const headers: IHeaders = {
  130. - 'X-Market-Client-Id': `VSCode ${version}`,
  131. - 'User-Agent': `VSCode ${version} (${productService.nameShort})`
  132. + 'X-Market-Client-Id': `VSCode ${coreVersion}`,
  133. + 'User-Agent': `VSCode ${coreVersion} (${productService.nameShort})`
  134. };
  135. const uuid = await getServiceMachineId(environmentService, fileService, storageService);
  136. const { sessionId } = await telemetryService.getTelemetryInfo();
  137. diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
  138. index 7e63a16..767f4f6 100644
  139. --- a/src/vs/platform/product/common/product.ts
  140. +++ b/src/vs/platform/product/common/product.ts
  141. @@ -45,7 +45,7 @@ else if (typeof require?.__$__nodeRequire === 'function') {
  142. }
  143. Object.assign(product, {
  144. - version: pkg.version
  145. + version: pkg.version.replace('+', '.')
  146. });
  147. }