vscodium/patches/build-version.patch
2022-08-16 13:51:45 +02:00

159 lines
8.4 KiB
Diff

diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js
index 489d9cc..51db755 100644
--- a/build/gulpfile.vscode.linux.js
+++ b/build/gulpfile.vscode.linux.js
@@ -83,7 +83,7 @@ function prepareDebPackage(arch) {
const dependencies = debianDependenciesGenerator.getDependencies(binaryDir, product.applicationName, debArch, sysroot);
gulp.src('resources/linux/debian/control.template', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
- .pipe(replace('@@VERSION@@', packageJson.version + '-' + linuxPackageRevision))
+ .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
.pipe(replace('@@ARCHITECTURE@@', debArch))
.pipe(replace('@@DEPENDS@@', dependencies.join(', ')))
.pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', ')))
@@ -188,8 +188,7 @@ function prepareRpmPackage(arch) {
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@ICON@@', product.linuxIconName))
- .pipe(replace('@@VERSION@@', packageJson.version))
- .pipe(replace('@@RELEASE@@', linuxPackageRevision))
+ .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
.pipe(replace('@@LICENSE@@', product.licenseName))
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
@@ -262,7 +261,7 @@ function prepareSnapPackage(arch) {
const snapcraft = gulp.src('resources/linux/snap/snapcraft.yaml', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
- .pipe(replace('@@VERSION@@', commit.substr(0, 8)))
+ .pipe(replace('@@VERSION@@', packageJson.version.replace('+', '.')))
// Possible run-on values https://snapcraft.io/docs/architectures
.pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
.pipe(rename('snap/snapcraft.yaml'));
diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js
index 4c1259c..0d41560 100644
--- a/build/gulpfile.vscode.web.js
+++ b/build/gulpfile.vscode.web.js
@@ -28,7 +28,7 @@ const WEB_FOLDER = path.join(REPO_ROOT, 'remote', 'web');
const commit = util.getVersion(REPO_ROOT);
const quality = product.quality;
-const version = (quality && quality !== 'stable') ? `${packageJson.version}-${quality}` : packageJson.version;
+const version = (quality && quality !== 'stable') ? `${packageJson.version.replace('+', '.')}-${quality}` : packageJson.version.replace('+', '.');
const vscodeWebResourceIncludes = [
// Workbench
diff --git a/build/gulpfile.vscode.win32.js b/build/gulpfile.vscode.win32.js
index 81ba509..a445749 100644
--- a/build/gulpfile.vscode.win32.js
+++ b/build/gulpfile.vscode.win32.js
@@ -91,8 +91,8 @@ function buildWin32Setup(arch, target) {
NameLong: product.nameLong,
NameShort: product.nameShort,
DirName: product.win32DirName,
- Version: pkg.version,
- RawVersion: pkg.version.replace(/-\w+$/, ''),
+ Version: pkg.version.replace('+', '.'),
+ RawVersion: pkg.version.replace(/-\w+$/, '').replace('+', '.'),
NameVersion: product.win32NameVersion + (target === 'user' ? ' (User)' : ''),
ExeBasename: product.nameShort,
RegValueName: product.win32RegValueName,
diff --git a/resources/linux/rpm/code.spec.template b/resources/linux/rpm/code.spec.template
index 00ddb6f..814c964 100644
--- a/resources/linux/rpm/code.spec.template
+++ b/resources/linux/rpm/code.spec.template
@@ -1,6 +1,6 @@
Name: @@NAME@@
Version: @@VERSION@@
-Release: @@RELEASE@@.el7
+Release: el7
Summary: Code editing. Redefined.
Group: Development/Tools
Vendor: Microsoft Corporation
diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
index 3515dea..c0aa528 100644
--- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
+++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
@@ -23,7 +23,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { IProductService } from 'vs/platform/product/common/productService';
import { asJson, asTextOrError, IRequestService, isSuccess } from 'vs/platform/request/common/request';
-import { resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace';
+import { getCoreVersion, resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -988,7 +988,8 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
return undefined;
}
- 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}`);
+ const coreVersion = getCoreVersion(version);
+ 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}`);
const Accept = isWeb ? 'api-version=6.1-preview.1' : '*/*;api-version=4.0-preview.1';
const commonHeaders = await this.commonHeadersPromise;
diff --git a/src/vs/platform/extensions/common/extensionValidator.ts b/src/vs/platform/extensions/common/extensionValidator.ts
index 0a5e7d2..e453393 100644
--- a/src/vs/platform/extensions/common/extensionValidator.ts
+++ b/src/vs/platform/extensions/common/extensionValidator.ts
@@ -9,6 +9,7 @@ import { URI } from 'vs/base/common/uri';
import * as nls from 'vs/nls';
import * as semver from 'vs/base/common/semver/semver';
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
+import { getCoreVersion } from 'vs/platform/externalServices/common/marketplace';
export interface IParsedVersion {
hasCaret: boolean;
@@ -371,7 +372,8 @@ function isVersionValid(currentVersion: string, date: ProductDate, requestedVers
}
}
- if (!isValidVersion(currentVersion, date, desiredVersion)) {
+ const coreVersion = getCoreVersion(currentVersion);
+ if (!isValidVersion(coreVersion, date, desiredVersion)) {
notices.push(nls.localize('versionMismatch', "Extension is not compatible with Code {0}. Extension requires: {1}.", currentVersion, requestedVersion));
return false;
}
diff --git a/src/vs/platform/externalServices/common/marketplace.ts b/src/vs/platform/externalServices/common/marketplace.ts
index 5923e1c..a1c9db8 100644
--- a/src/vs/platform/externalServices/common/marketplace.ts
+++ b/src/vs/platform/externalServices/common/marketplace.ts
@@ -13,6 +13,10 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
+export function getCoreVersion(version: string): string {
+ return version.replace(/\.[0-9]+$/, '');
+}
+
export async function resolveMarketplaceHeaders(version: string,
productService: IProductService,
environmentService: IEnvironmentService,
@@ -20,9 +24,10 @@ export async function resolveMarketplaceHeaders(version: string,
fileService: IFileService,
storageService: IStorageService | undefined,
telemetryService: ITelemetryService): Promise<IHeaders> {
+ const coreVersion = getCoreVersion(version);
const headers: IHeaders = {
- 'X-Market-Client-Id': `VSCode ${version}`,
- 'User-Agent': `VSCode ${version} (${productService.nameShort})`
+ 'X-Market-Client-Id': `VSCode ${coreVersion}`,
+ 'User-Agent': `VSCode ${coreVersion} (${productService.nameShort})`
};
const uuid = await getServiceMachineId(environmentService, fileService, storageService);
const { sessionId } = await telemetryService.getTelemetryInfo();
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
index 7e63a16..767f4f6 100644
--- a/src/vs/platform/product/common/product.ts
+++ b/src/vs/platform/product/common/product.ts
@@ -45,7 +45,7 @@ else if (typeof require?.__$__nodeRequire === 'function') {
}
Object.assign(product, {
- version: pkg.version
+ version: pkg.version.replace('+', '.')
});
}