feat: add release number (#1192)

This commit is contained in:
Baptiste Augrain
2022-08-16 13:51:45 +02:00
committed by GitHub
parent ed5a695d2c
commit 118ea7993d
16 changed files with 336 additions and 99 deletions

158
patches/build-version.patch Normal file
View File

@@ -0,0 +1,158 @@
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('+', '.')
});
}

View File

@@ -1,36 +1,25 @@
diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts
index f822373..30a0a66 100644
index 1ae8079..eb56045 100644
--- a/src/vs/base/common/product.ts
+++ b/src/vs/base/common/product.ts
@@ -70,6 +70,7 @@ export interface IProductConfiguration {
readonly extensionsGallery?: {
@@ -72,2 +72,3 @@ export interface IProductConfiguration {
readonly serviceUrl: string;
+ readonly cacheUrl?: string;
readonly itemUrl: string;
readonly publisherUrl: string;
readonly resourceUrlTemplate: string;
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
index 7e63a16..3bfeab8 100644
--- a/src/vs/platform/product/common/product.ts
+++ b/src/vs/platform/product/common/product.ts
@@ -4,11 +4,12 @@
*--------------------------------------------------------------------------------------------*/
@@ -6,3 +6,3 @@
import { FileAccess } from 'vs/base/common/network';
-import { globals } from 'vs/base/common/platform';
+import { globals, isWindows } from 'vs/base/common/platform';
import { env } from 'vs/base/common/process';
import { IProductConfiguration } from 'vs/base/common/product';
import { dirname, joinPath } from 'vs/base/common/resources';
@@ -11,2 +11,3 @@ import { dirname, joinPath } from 'vs/base/common/resources';
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
/**
* @deprecated You MUST use `IProductService` if possible.
@@ -34,6 +35,32 @@ else if (typeof require?.__$__nodeRequire === 'function') {
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string };
@@ -36,2 +37,28 @@ else if (typeof require?.__$__nodeRequire === 'function') {
+ // Merge user-customized product.json
+ try {
@@ -59,11 +48,7 @@ index 7e63a16..3bfeab8 100644
+ }
+
// Running out of sources
if (env['VSCODE_DEV']) {
Object.assign(product, {
@@ -44,6 +71,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
});
}
@@ -46,2 +73,15 @@ else if (typeof require?.__$__nodeRequire === 'function') {
+ // Set user-defined extension gallery
+ const { serviceUrl, cacheUrl, itemUrl, controlUrl, recommendationsUrl } = product.extensionsGallery || {}
@@ -79,5 +64,3 @@ index 7e63a16..3bfeab8 100644
+ })
+
Object.assign(product, {
version: pkg.version
});