feat:添加IDEVersion字段,编译出deb版本号、在about页面和命令行查看显示IDEVersion版本号

This commit is contained in:
wangpenglong 2024-03-14 19:11:52 +08:00
parent 3461c787ea
commit ba6b8fdd8d
12 changed files with 39 additions and 31 deletions

View File

@ -286,14 +286,15 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
version += '-' + quality;
}
const IDEVersion = packageJson.IDEVersion;
const name = product.nameShort;
const packageJsonStream = gulp.src(['remote/package.json'], { base: 'remote' })
.pipe(json({ name, version, dependencies: undefined, optionalDependencies: undefined }));
.pipe(json({ name, IDEVersion, version, dependencies: undefined, optionalDependencies: undefined }));
const date = new Date().toISOString();
const productJsonStream = gulp.src(['product.json'], { base: '.' })
.pipe(json({ commit, date, version }));
.pipe(json({ commit, date, IDEVersion, version }));
const license = gulp.src(['remote/LICENSE'], { base: 'remote', allowEmpty: true });

View File

@ -238,8 +238,9 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
version += '-' + quality;
}
const IDEVersion = packageJson.IDEVersion;
const name = product.nameShort;
const packageJsonUpdates = { name, version };
const packageJsonUpdates = { name, version, IDEVersion };
// for linux url handling
if (platform === 'linux') {
@ -250,7 +251,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
.pipe(json(packageJsonUpdates));
const date = new Date().toISOString();
const productJsonUpdate = { commit, date, checksums, version };
const productJsonUpdate = { commit, date, checksums, version, IDEVersion };
const productJsonStream = gulp.src(['product.json'], { base: '.' })
.pipe(json(productJsonUpdate));

View File

@ -23,7 +23,7 @@ const path = require('path');
const root = path.dirname(__dirname);
const commit = getVersion(root);
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
// const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
/**
* @param {string} arch
@ -86,7 +86,7 @@ function prepareDebPackage(arch) {
const dependencies = dependenciesGenerator.getDependencies('deb', 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.IDEVersion))
.pipe(replace('@@ARCHITECTURE@@', debArch))
.pipe(replace('@@DEPENDS@@', dependencies.join(', ')))
.pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', ')))
@ -186,19 +186,23 @@ function prepareRpmPackage(arch) {
const code = gulp.src(binaryDir + '/**/*', { base: binaryDir })
.pipe(rename(function (p) { p.dirname = 'BUILD/usr/share/' + product.applicationName + '/' + p.dirname; }));
const dependencies = dependenciesGenerator.getDependencies('rpm', binaryDir, product.applicationName, rpmArch);
const spec = gulp.src('resources/linux/rpm/code.spec.template', { base: '.' })
const spec = code.pipe(es.through(
async function () {
const that = this;
const dependencies = await dependenciesGenerator.getDependencies('rpm', binaryDir, product.applicationName, rpmArch);
gulp.src('resources/linux/rpm/code.spec.template', { base: '.' })
.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.IDEVersion))
.pipe(replace('@@ARCHITECTURE@@', rpmArch))
.pipe(replace('@@LICENSE@@', product.licenseName))
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
.pipe(replace('@@DEPENDENCIES@@', dependencies.join(', ')))
.pipe(rename('SPECS/' + product.applicationName + '.spec'));
.pipe(rename('SPECS/' + product.applicationName + '.spec'))
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
}));
const specIcon = gulp.src('resources/linux/rpm/code.xpm', { base: '.' })
.pipe(rename('SOURCES/' + product.applicationName + '.xpm'));
@ -265,7 +269,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.IDEVersion))
// Possible run-on values https://snapcraft.io/docs/architectures
.pipe(replace('@@ARCHITECTURE@@', arch === 'x64' ? 'amd64' : arch))
.pipe(rename('snap/snapcraft.yaml'));

View File

@ -28,7 +28,7 @@ const WEB_FOLDER = path.join(REPO_ROOT, 'remote', 'web');
const commit = getVersion(REPO_ROOT);
const quality = product.quality;
const version = (quality && quality !== 'stable') ? `${packageJson.version}-${quality}` : packageJson.version;
const version = (quality && quality !== 'stable') ? `${packageJson.IDEVersion}-${quality}` : packageJson.IDEVersion;
const vscodeWebResourceIncludes = [
// Workbench

View File

@ -88,8 +88,8 @@ function buildWin32Setup(arch, target) {
NameLong: product.nameLong,
NameShort: product.nameShort,
DirName: product.win32DirName,
Version: pkg.version,
RawVersion: pkg.version.replace(/-\w+$/, ''),
Version: pkg.IDEVersion,
RawVersion: pkg.IDEVersion.replace(/-\w+$/, ''),
NameVersion: product.win32NameVersion + (target === 'user' ? ' (User)' : ''),
ExeBasename: product.nameShort,
RegValueName: product.win32RegValueName,

View File

@ -55,6 +55,7 @@ export type ExtensionVirtualWorkspaceSupport = {
};
export interface IProductConfiguration {
readonly IDEVersion: string;
readonly version: string;
readonly date?: string;
readonly quality?: string;

View File

@ -83,12 +83,12 @@ export async function main(argv: string[]): Promise<any> {
// Help
if (args.help) {
const executable = `${product.applicationName}${isWindows ? '.exe' : ''}`;
console.log(buildHelpMessage(product.nameLong, executable, product.version, OPTIONS));
console.log(buildHelpMessage(product.nameLong, executable, product.IDEVersion, OPTIONS));
}
// Version Info
else if (args.version) {
console.log(buildVersionMessage(product.version, product.commit));
console.log(buildVersionMessage(product.IDEVersion, product.commit));
}
// Shell integration

View File

@ -222,7 +222,7 @@ export class DiagnosticsService implements IDiagnosticsService {
private formatEnvironment(info: IMainProcessDiagnostics): string {
const output: string[] = [];
output.push(`Version: ${this.productService.nameShort} ${this.productService.version} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`);
output.push(`Version: ${this.productService.nameShort} ${this.productService.IDEVersion} (${this.productService.commit || 'Commit unknown'}, ${this.productService.date || 'Date unknown'})`);
output.push(`OS Version: ${osLib.type()} ${osLib.arch()} ${osLib.release()}`);
const cpus = osLib.cpus();
if (cpus && cpus.length > 0) {

View File

@ -41,9 +41,10 @@ else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
// want to have it running out of sources so we
// read it from package.json only when we need it.
if (!product.version) {
const pkg = globalThis._VSCODE_PACKAGE_JSON as { version: string };
const pkg = globalThis._VSCODE_PACKAGE_JSON as { IDEVersion: string; version: string };
Object.assign(product, {
IDEVersion: pkg.IDEVersion,
version: pkg.version
});
}

View File

@ -177,12 +177,12 @@ function eventuallyExit(code: number): void {
export async function run(args: ServerParsedArgs, REMOTE_DATA_FOLDER: string, optionDescriptions: OptionDescriptions<ServerParsedArgs>): Promise<void> {
if (args.help) {
const executable = product.serverApplicationName + (isWindows ? '.cmd' : '');
console.log(buildHelpMessage(product.nameLong, executable, product.version, optionDescriptions, { noInputFiles: true, noPipe: true }));
console.log(buildHelpMessage(product.nameLong, executable, product.IDEVersion, optionDescriptions, { noInputFiles: true, noPipe: true }));
return;
}
// Version Info
if (args.version) {
console.log(buildVersionMessage(product.version, product.commit));
console.log(buildVersionMessage(product.IDEVersion, product.commit));
return;
}

View File

@ -79,7 +79,7 @@ export class BrowserDialogHandler extends AbstractDialogHandler {
const detailString = (useAgo: boolean): string => {
return localize('aboutDetail',
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
this.productService.version || 'Unknown',
this.productService.IDEVersion || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
navigator.userAgent

View File

@ -67,7 +67,7 @@ export class NativeDialogHandler extends AbstractDialogHandler {
}
async about(): Promise<void> {
let version = this.productService.version;
let version = this.productService.IDEVersion;
if (this.productService.target) {
version = `${version} (${this.productService.target} setup)`;
} else if (this.productService.darwinUniversalAssetId) {